本文整理汇总了Java中org.w3c.dom.ls.LSParserFilter.FILTER_INTERRUPT属性的典型用法代码示例。如果您正苦于以下问题:Java LSParserFilter.FILTER_INTERRUPT属性的具体用法?Java LSParserFilter.FILTER_INTERRUPT怎么用?Java LSParserFilter.FILTER_INTERRUPT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.w3c.dom.ls.LSParserFilter
的用法示例。
在下文中一共展示了LSParserFilter.FILTER_INTERRUPT属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startElement
public void startElement(String uri, String localName, String qName,
Attributes atts)
throws SAXException
{
if (rejecting || interrupted)
{
return;
}
Element element = createElement(uri, localName, qName, atts);
ctx = element;
short decision = getDecision(element, true);
nodes.addLast(element);
decisions.addLast(new Short(decision));
switch (decision)
{
case LSParserFilter.FILTER_REJECT:
rejecting = true;
break;
case LSParserFilter.FILTER_INTERRUPT:
interrupted = true;
break;
}
}
示例2: characters
public void characters(char[] c, int off, int len)
throws SAXException
{
if (rejecting || interrupted)
{
return;
}
Text text = createText(c, off, len);
short decision = getDecision(text, false);
switch (decision)
{
case LSParserFilter.FILTER_ACCEPT:
ctx.appendChild(text);
break;
case LSParserFilter.FILTER_INTERRUPT:
interrupted = true;
break;
}
}
示例3: processingInstruction
public void processingInstruction(String target, String data)
throws SAXException
{
if (rejecting || interrupted || inDTD)
{
return;
}
Node pi = createProcessingInstruction(target, data);
short decision = getDecision(pi, false);
switch (decision)
{
case LSParserFilter.FILTER_ACCEPT:
ctx.appendChild(pi);
break;
case LSParserFilter.FILTER_INTERRUPT:
interrupted = true;
break;
}
}
示例4: endDTD
public void endDTD()
throws SAXException
{
if (interrupted)
{
return;
}
Node doctype = (Node) nodes.removeLast();
decisions.removeLast();
inDTD = false;
ctx = doc;
short decision = getDecision(doctype, false);
switch (decision)
{
case LSParserFilter.FILTER_ACCEPT:
ctx.appendChild(doctype);
break;
case LSParserFilter.FILTER_INTERRUPT:
interrupted = true;
break;
}
}
示例5: startElement
public void startElement(String uri, String localName, String qName,
Attributes atts)
throws SAXException
{
if (rejecting || interrupted)
{
return;
}
Element element = createElement(uri, localName, qName, atts);
ctx = element;
short decision = getDecision(element, true);
nodes.addLast(element);
decisions.addLast(new Short(decision));
switch (decision)
{
case LSParserFilter.FILTER_REJECT:
rejecting = true;
break;
case LSParserFilter.FILTER_INTERRUPT:
interrupted = true;
break;
}
}
示例6: createAttr
protected Attr createAttr(Attributes atts, int index)
{
Attr attr = super.createAttr(atts, index);
short decision = getDecision(attr, false);
switch (decision)
{
case LSParserFilter.FILTER_REJECT:
return null;
case LSParserFilter.FILTER_INTERRUPT:
interrupted = true;
return null;
}
return attr;
}
示例7: endElement
public void endElement(String uri, String localName, String qName)
throws SAXException
{
if (rejecting || interrupted)
{
return;
}
super.endElement(uri, localName, qName);
Element element = (Element) nodes.removeLast();
Node parent = nodes.isEmpty() ? doc : (Node) nodes.getLast();
ctx = parent;
short decision = ((Short) decisions.removeLast()).shortValue();
switch (decision)
{
case LSParserFilter.FILTER_SKIP:
// Add all children of element to parent
for (Node child = element.getFirstChild(); child != null;
child = child.getNextSibling())
{
parent.insertBefore(child, element);
}
return;
case LSParserFilter.FILTER_REJECT:
rejecting = false;
break;
}
decision = getDecision(element, false);
switch (decision)
{
case LSParserFilter.FILTER_ACCEPT:
parent.appendChild(element);
break;
case LSParserFilter.FILTER_INTERRUPT:
interrupted = true;
break;
}
}
示例8: endElement
public void endElement(String uri, String localName, String qName)
throws SAXException
{
if (rejecting || interrupted)
{
return;
}
super.endElement(uri, localName, qName);
Element element = (Element) nodes.removeLast();
Node parent = nodes.isEmpty() ? doc : (Node) nodes.getLast();
ctx = parent;
short decision = ((Short) decisions.removeLast()).shortValue();
switch (decision)
{
case LSParserFilter.FILTER_SKIP:
// Add all children of element to parent
for (Node child = element.getFirstChild(); child != null;
child = child.getNextSibling())
{
parent.insertBefore(child, element);
}
return;
case LSParserFilter.FILTER_REJECT:
rejecting = false;
break;
}
decision = getDecision(element, false);
switch (decision)
{
case LSParserFilter.FILTER_ACCEPT:
parent.appendChild(element);
break;
case LSParserFilter.FILTER_INTERRUPT:
interrupted = true;
break;
}
}
示例9: endCDATA
/**
* The end of a CDATA section.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void endCDATA (Augmentations augs) throws XNIException {
fInCDATASection = false;
if (!fDeferNodeExpansion) {
if (fFilterReject) {
return;
}
if (fCurrentCDATASection !=null) {
if (fDOMFilter !=null && !fInEntityRef &&
(fDOMFilter.getWhatToShow () & NodeFilter.SHOW_CDATA_SECTION)!= 0) {
short code = fDOMFilter.acceptNode (fCurrentCDATASection);
switch (code) {
case LSParserFilter.FILTER_INTERRUPT:{
throw Abort.INSTANCE;
}
case LSParserFilter.FILTER_REJECT:{
// fall through to SKIP since CDATA section has no children.
}
case LSParserFilter.FILTER_SKIP: {
Node parent = fCurrentNode.getParentNode ();
parent.removeChild (fCurrentCDATASection);
fCurrentNode = parent;
return;
}
default: {
// accept node
}
}
}
fCurrentNode = fCurrentNode.getParentNode ();
fCurrentCDATASection = null;
}
}
else {
if (fCurrentCDATASectionIndex !=-1) {
fCurrentNodeIndex =
fDeferredDocumentImpl.getParentNode (fCurrentNodeIndex, false);
fCurrentCDATASectionIndex = -1;
}
}
}
示例10: setCharacterData
protected void setCharacterData (boolean sawChars){
// handle character data
fFirstChunk = sawChars;
// if we have data in the buffer we must have created
// a text node already.
Node child = fCurrentNode.getLastChild ();
if (child != null) {
if (fStringBuilder.length () > 0) {
// REVISIT: should this check be performed?
if (child.getNodeType () == Node.TEXT_NODE) {
if (fDocumentImpl != null) {
((TextImpl)child).replaceData (fStringBuilder.toString ());
}
else {
((Text)child).setData (fStringBuilder.toString ());
}
}
// reset string buffer
fStringBuilder.setLength (0);
}
if (fDOMFilter !=null && !fInEntityRef) {
if ( (child.getNodeType () == Node.TEXT_NODE ) &&
((fDOMFilter.getWhatToShow () & NodeFilter.SHOW_TEXT)!= 0) ) {
short code = fDOMFilter.acceptNode (child);
switch (code) {
case LSParserFilter.FILTER_INTERRUPT:{
throw Abort.INSTANCE;
}
case LSParserFilter.FILTER_REJECT:{
// fall through to SKIP since Comment has no children.
}
case LSParserFilter.FILTER_SKIP: {
fCurrentNode.removeChild (child);
return;
}
default: {
// accept node -- do nothing
}
}
}
} // end-if fDOMFilter !=null
} // end-if child !=null
}
示例11: setCharacterData
protected void setCharacterData (boolean sawChars){
// handle character data
fFirstChunk = sawChars;
// if we have data in the buffer we must have created
// a text node already.
Node child = fCurrentNode.getLastChild ();
if (child != null) {
if (fStringBuffer.length () > 0) {
// REVISIT: should this check be performed?
if (child.getNodeType () == Node.TEXT_NODE) {
if (fDocumentImpl != null) {
((TextImpl)child).replaceData (fStringBuffer.toString ());
}
else {
((Text)child).setData (fStringBuffer.toString ());
}
}
// reset string buffer
fStringBuffer.setLength (0);
}
if (fDOMFilter !=null && !fInEntityRef) {
if ( (child.getNodeType () == Node.TEXT_NODE ) &&
((fDOMFilter.getWhatToShow () & NodeFilter.SHOW_TEXT)!= 0) ) {
short code = fDOMFilter.acceptNode (child);
switch (code) {
case LSParserFilter.FILTER_INTERRUPT:{
throw Abort.INSTANCE;
}
case LSParserFilter.FILTER_REJECT:{
// fall through to SKIP since Comment has no children.
}
case LSParserFilter.FILTER_SKIP: {
fCurrentNode.removeChild (child);
return;
}
default: {
// accept node -- do nothing
}
}
}
} // end-if fDOMFilter !=null
} // end-if child !=null
}