XMLNode as argument<root name="example"> <element name="first"> <element name="second"/> </element> </root>If we create an iterator on the root node:
next() method will return the root nodenext() method will return the first nodenext() method will return the second nodehasNext() methods will return false<root name="example"> <element name="first"> <element name="second"/> </element> </root>If we create an iterator on the root node:
nextNode() method will return the first nodenextNode() method will return the second nodehasNext() methods will return falsey:ProxyAutoBoundsNode:NodeFilter filter = new NodeFilter("MyFilter", "y:ProxyAutoBoundsNode");The following nodes are compatible with the filter:
<y:ProxyAutoBoundsNode/> <y:ProxyAutoBoundsNode name="myName"/>The following filter looks for nodes whose name is
y:ProxyAutoBoundsNode and the visible attribute is equal to "true":NodeFilter filter = new NodeFilter("MyFilter", "y:ProxyAutoBoundsNode"); filter.addAttribute("visible", "true");Ony the last node is compatible with the filter:
<y:ProxyAutoBoundsNode/> <y:ProxyAutoBoundsNode name="myName"/> <y:ProxyAutoBoundsNode name="myName" visible="false"/> <y:ProxyAutoBoundsNode name="myName" visible="true"/>
next() or nextNode(), the current node is compatible with one of the filters:<root name="theRoot"> <filteredNode name="one" visible="true"> <element name="two"/> </filteredNode> <filteredNode name="three"> <element name="four"/> </filteredNode> <element name="five"/> </root>And the filter:
NodeFilter filter = new NodeFilter("MyFilter", "filteredNode"); filter.addAttribute("visible", "true");If we create an iterator on the
theRoot node:nextNode() method will return the one node. The getCurrentFilterName() must return "MyFilter". The inParentFilter("MyFilter") must return truenextNode() method will return the one node. The hasCurrentFilterName() must return false. The inParentFilter("MyFilter") must return truenextNode() method will return the three node, the hasCurrentFilterName() must return false, and the inParentFilter("MyFilter") must return falseCopyright 2006-2024 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences