本文整理汇总了Java中org.w3c.dom.ls.LSParserFilter.FILTER_ACCEPT属性的典型用法代码示例。如果您正苦于以下问题:Java LSParserFilter.FILTER_ACCEPT属性的具体用法?Java LSParserFilter.FILTER_ACCEPT怎么用?Java LSParserFilter.FILTER_ACCEPT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.w3c.dom.ls.LSParserFilter
的用法示例。
在下文中一共展示了LSParserFilter.FILTER_ACCEPT属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
示例2: 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;
}
}
示例3: 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;
}
}
示例4: 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;
}
}
示例5: 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;
}
}
示例6: acceptNode
@Override
public short acceptNode(Node nodeArg) {
String textContent = nodeArg.getTextContent();
if (textContent.trim().isEmpty()) {
return LSParserFilter.FILTER_REJECT;
} else {
return LSParserFilter.FILTER_ACCEPT;
}
}
示例7: getDecision
short getDecision(Node node, boolean start)
{
boolean show = (whatToShow == NodeFilter.SHOW_ALL);
if (!show)
{
switch (node.getNodeType())
{
case Node.ATTRIBUTE_NODE:
show = ((whatToShow & NodeFilter.SHOW_ATTRIBUTE) != 0);
break;
case Node.TEXT_NODE:
show = ((whatToShow & NodeFilter.SHOW_TEXT) != 0);
break;
case Node.CDATA_SECTION_NODE:
show = ((whatToShow & NodeFilter.SHOW_CDATA_SECTION) != 0);
break;
case Node.ELEMENT_NODE:
show = ((whatToShow & NodeFilter.SHOW_ELEMENT) != 0);
break;
case Node.COMMENT_NODE:
show = ((whatToShow & NodeFilter.SHOW_COMMENT) != 0);
break;
case Node.DOCUMENT_NODE:
show = ((whatToShow & NodeFilter.SHOW_DOCUMENT) != 0);
break;
case Node.PROCESSING_INSTRUCTION_NODE:
show = ((whatToShow & NodeFilter.SHOW_PROCESSING_INSTRUCTION) != 0);
break;
case Node.DOCUMENT_FRAGMENT_NODE:
show = ((whatToShow & NodeFilter.SHOW_DOCUMENT_FRAGMENT) != 0);
break;
case Node.DOCUMENT_TYPE_NODE:
show = ((whatToShow & NodeFilter.SHOW_DOCUMENT_TYPE) != 0);
break;
case Node.ENTITY_REFERENCE_NODE:
show = ((whatToShow & NodeFilter.SHOW_ENTITY_REFERENCE) != 0);
break;
case Node.ENTITY_NODE:
show = ((whatToShow & NodeFilter.SHOW_ENTITY) != 0);
break;
case Node.NOTATION_NODE:
show = ((whatToShow & NodeFilter.SHOW_NOTATION) != 0);
break;
}
}
if (!show)
{
return LSParserFilter.FILTER_ACCEPT;
}
if (start)
{
return filter.startElement((Element) node);
}
return filter.acceptNode(node);
}
示例8: getDecision
short getDecision(Node node, boolean start)
{
boolean show = (whatToShow == NodeFilter.SHOW_ALL);
if (!show)
{
switch (node.getNodeType())
{
case Node.ATTRIBUTE_NODE:
show = ((whatToShow & NodeFilter.SHOW_ATTRIBUTE) != 0);
break;
case Node.TEXT_NODE:
show = ((whatToShow & NodeFilter.SHOW_TEXT) != 0);
break;
case Node.CDATA_SECTION_NODE:
show = ((whatToShow & NodeFilter.SHOW_CDATA_SECTION) != 0);
break;
case Node.ELEMENT_NODE:
show = ((whatToShow & NodeFilter.SHOW_ELEMENT) != 0);
break;
case Node.COMMENT_NODE:
show = ((whatToShow & NodeFilter.SHOW_COMMENT) != 0);
break;
case Node.DOCUMENT_NODE:
show = ((whatToShow & NodeFilter.SHOW_DOCUMENT) != 0);
break;
case Node.PROCESSING_INSTRUCTION_NODE:
show = ((whatToShow & NodeFilter.SHOW_PROCESSING_INSTRUCTION) != 0);
break;
case Node.DOCUMENT_FRAGMENT_NODE:
show = ((whatToShow & NodeFilter.SHOW_DOCUMENT_FRAGMENT) != 0);
break;
case Node.DOCUMENT_TYPE_NODE:
show = ((whatToShow & NodeFilter.SHOW_DOCUMENT_TYPE) != 0);
break;
case Node.ENTITY_REFERENCE_NODE:
show = ((whatToShow & NodeFilter.SHOW_ENTITY_REFERENCE) != 0);
break;
case Node.ENTITY_NODE:
show = ((whatToShow & NodeFilter.SHOW_ENTITY) != 0);
break;
case Node.NOTATION_NODE:
show = ((whatToShow & NodeFilter.SHOW_NOTATION) != 0);
break;
}
}
if (!show)
{
return LSParserFilter.FILTER_ACCEPT;
}
if (start)
{
return filter.startElement((Element) node);
}
return filter.acceptNode(node);
}
示例9: acceptNode
public short acceptNode(Node nodeArg) {
return LSParserFilter.FILTER_ACCEPT;
}
示例10: startElement
public short startElement(Element elementArg) {
return LSParserFilter.FILTER_ACCEPT;
}
示例11: startElement
/**
* @see org.w3c.dom.ls.LSParserFilter#startElement(Element)
*/
public short startElement(Element elt) {
return LSParserFilter.FILTER_ACCEPT;
}
示例12: startElement
@Override
public short startElement(Element elementArg) {
return LSParserFilter.FILTER_ACCEPT;
}