X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=src%2Fde%2Fj32%2Futil%2FXmlUtil.java;h=0bc9ebc9248b0d15245c04268e56ef6f85ddc167;hb=276d9a69fa796728169c2992921a1e4bd875f549;hp=693e4025027b775b050ff1bc9d0cdaf2d339a29b;hpb=aeb7d91db3d650d30a9191cbe84192d6b3b23df7;p=jpim.git diff --git a/src/de/j32/util/XmlUtil.java b/src/de/j32/util/XmlUtil.java index 693e402..0bc9ebc 100644 --- a/src/de/j32/util/XmlUtil.java +++ b/src/de/j32/util/XmlUtil.java @@ -10,7 +10,6 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; -import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.EntityResolver; @@ -40,24 +39,24 @@ public class XmlUtil } } - public static Iterable iterateElements(final NodeList nodes) + public static Iterable iterate(final NodeList nodes, final Class type) { - return new Iterable() { - public Iterator iterator() { - return new NodeListIterator(nodes, Element.class); + return new Iterable() { + public Iterator iterator() { + return new NodeListIterator(nodes, type); } }; } - + static class NodeListIterator implements Iterator { - Class nodeType_; + Class nodeType_; NodeList nodes_; int i_ = 0; E next_; - public NodeListIterator(NodeList nodes, Class nodeType) + public NodeListIterator(NodeList nodes, Class nodeType) { nodes_ = nodes; nodeType_ = nodeType;