xmlstreamparser
Class Node

java.lang.Object
  extended by xmlstreamparser.Node

public class Node
extends java.lang.Object

Basic functions: - hasAttribute= attributes.containsKey("attribute name"); - Get attribute value= attributes.get("attribute name"); - Add attribute= attributes.put("attribute name", "attribute value"); - Get child= children.get(i); - Add child= children.add(child); Note that string values must not be null: empty strings are used instead.


Field Summary
 java.util.Hashtable attributes
          Node attributes. key = attribute name, value = attribute value.
 java.util.Vector children
          Children nodes, in order of appearance in the xml document.
 java.lang.String name
          Node name ex: "stream:stream", or "iq"
 Node parent
          Parent node.
 java.lang.String text
          Node text.
 
Constructor Summary
Node(HttpNode _node)
          Constructor/Converter
Node(Node _parent)
          Constructor.
 
Method Summary
 Node getChild(java.lang.String _nodeName)
          Returns a child node given its name (node name).
 Node getChild(java.lang.String _nodeName, java.lang.String _attrName, java.lang.String _attrVal)
          Returns a child node given its name (node name) and given attribute value.
 java.util.Vector getChildren()
           
 java.lang.String getValue(java.lang.String _attributeName)
          Returns the value of an attribute given its name.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

public Node parent
Parent node. It is null if there is no parent (main node)


name

public java.lang.String name
Node name ex: "stream:stream", or "iq"


attributes

public java.util.Hashtable attributes
Node attributes. key = attribute name, value = attribute value. ex: <... to="greg@w9f05952" ...> key="to" value="greg@w9f05952" ex: <... novalue ...> key="novalue" value=empty string.


text

public java.lang.String text
Node text. It is an empty string if there is no text. ex: mytext jflf text="mytext jflf " ex: text=empty string


children

public java.util.Vector children
Children nodes, in order of appearance in the xml document.

Constructor Detail

Node

public Node(Node _parent)
Constructor. Values (such as name, attributes, text, children..) are given later with basic operations. ex: node.name="stream:stream";

Parameters:
_parent - Parent node. Is null if the node has no parent (main node).

Node

public Node(HttpNode _node)
Constructor/Converter

Parameters:
_node -
Method Detail

getValue

public java.lang.String getValue(java.lang.String _attributeName)
Returns the value of an attribute given its name.

Returns:
value of the given attribute. Returns null if there is no such attribute. Returns an empty string if the attribute has no value.

getChild

public Node getChild(java.lang.String _nodeName)
Returns a child node given its name (node name). Returns null if there is no such child. If several children have the same name, this method returns the first matching child.


getChild

public Node getChild(java.lang.String _nodeName,
                     java.lang.String _attrName,
                     java.lang.String _attrVal)
Returns a child node given its name (node name) and given attribute value. Returns null if there is no such child. If several children have the same name and attribute, this method returns the first matching child.

Parameters:
String - String String
Returns:
Node

getChildren

public java.util.Vector getChildren()
Returns:
Vector

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
String