diff options
Diffstat (limited to 'netx/net/sourceforge/jnlp/Node.java')
-rw-r--r-- | netx/net/sourceforge/jnlp/Node.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/netx/net/sourceforge/jnlp/Node.java b/netx/net/sourceforge/jnlp/Node.java index 3ab00ca..2c754d7 100644 --- a/netx/net/sourceforge/jnlp/Node.java +++ b/netx/net/sourceforge/jnlp/Node.java @@ -19,6 +19,7 @@ class Node { private XMLElement xml; private Node next; private Node children[]; + private List <String> attributeNames= null; Node(XMLElement xml) { this.xml = xml; @@ -60,6 +61,21 @@ class Node { return children; } + + /** + * To retrieve all attribute names + * @return all attribute names of the Node in ArrayList<String> + */ + List<String> getAttributeNames() { + if (attributeNames == null) { + attributeNames= new ArrayList<String>(); + + for (Enumeration e = xml.enumerateAttributeNames(); e.hasMoreElements();) + attributeNames.add(new String((String) e.nextElement())); + } + + return attributeNames; + } String getAttribute(String name) { return (String) xml.getAttribute(name); @@ -86,6 +102,7 @@ class Node { private ParsedXML tinyNode; private Node next; private Node children[]; + private String attributeNames[]; Node(ParsedXML tinyNode) { this.tinyNode = tinyNode; @@ -127,6 +144,19 @@ class Node { return children; } + + String[] getAttributeNames() { + if (attributeNames == null) { + List<String> list = new ArrayList<String>(); + + for (Enumeration e = xml.enumerateAttributeNames(); e.hasMoreElements();) + list.add(new String((String) e.nextElement())); + + attributeNames = list.toArray(new String[list.size()]); + + } + return attributeNames; + } String getAttribute(String name) { return tinyNode.getAttribute(name); |