NodeSetFilter extends FullXmlFilter { public NodeSetFilter(String targetElement, ContentHandler handler) { this(null, targetElement, true, false, handler); } NodeSetFilter(String targetElement, ContentHandler handler);  NodeSetFilter(Map<String,String> namespaceMap, String targetElement, boolean includeTarget, boolean includeRoot, ContentHandler handler); void startNode(String uri, String localName, String qName); void endNode(String uri, String localName, String qName); @Override void startPrefixMapping(String prefix, String uri); @Override void endPrefixMapping(String prefix); @Override void startElement(String uri, String localName, String qName, Attributes atts); @Override void endElement(String uri, String localName, String qName); @Override void characters(char[] ch, int start, int length); @Override void comment(char[] ch, int start, int length); @Override void startCDATA(); @Override void endCDATA(); @Override void startEntity(String name); @Override void endEntity(String name); @Override void ignorableWhitespace(char[] ch, int start, int length);  }
@Test public void testNodeSetFilter() throws Exception { NodeSetFilter targetElementFilter = new NodeSetFilter(null, null, false, false, null); String expected="<prefix- uri=\"urn:tja\">\n" + "\t<sub1 xmlns=\"urn:tja\">\n" + "\t\t<a>x</a>\n" + "\t</sub1>\n" + "</prefix->\n" + "<prefix- uri=\"urn:tja\">\n" + "\t<x xmlns=\"urn:tja\">\n" + "\t\t<sub2>\n" + "\t\t\t<a>y</a>\n" + "\t\t\t<b>y</b>\n" + "\t\t</sub2>\n" + "\t</x>\n" + "</prefix->\n" + "<prefix- uri=\"urn:tja\">\n" + "\t<sub2 xmlns=\"urn:tja\">\n" + "\t\t<a>y</a>\n" + "\t\t<b>y</b>\n" + "\t</sub2>\n" + "</prefix->\n" + "<prefix- uri=\"urn:tja\">\n" + "\t<xx xmlns=\"urn:tja\"/>\n" + "</prefix->"; testNodeSetFilter(targetElementFilter, "a", false, document, expected); }