: Class Node | WebReference

: Class Node


com.exploringxml.xml
Class Node

java.lang.Object
  |
  +--com.exploringxml.xml.Node

public class Node
extends java.lang.Object

A node of an XML DOM tree;


Field Summary
 java.util.Hashtable attributes
           
(package private) static java.lang.String CharData
           
(package private) static java.lang.String Comment
           
 JSArray contents
           
(package private) static java.lang.String Element
           
 JSArray index
           
 java.lang.String name
           
(package private) static java.lang.String PI
           
 java.lang.String type
           
 int uid
           
 java.lang.String value
           
 
Constructor Summary
Node()
           
 
Method Summary
(package private) static Node createChardata()
          factory method for chardata nodes
(package private) static Node createComment()
          factory method for comment nodes
(package private) static Node createElement()
          factory method for element nodes
(package private) static Node createPi()
          factory method for PI nodes
(package private) static Node createRootelement()
          factory method for the root element
 Node find(java.lang.String path, int occur)
          find the node matching a certain occurance of the path description
(package private)  Node findChildElement(Node parent, java.lang.String simplePath, int occur)
          find the child node matching a certain occurance of a simple path description
 java.lang.String getCharacters()
          returns the character data in the first child element; returns nonsense if the first child element ist not chardata
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

type

public java.lang.String type

name

public java.lang.String name

value

public java.lang.String value

attributes

public java.util.Hashtable attributes

uid

public int uid

contents

public JSArray contents

index

public JSArray index

Element

static final java.lang.String Element

CharData

static final java.lang.String CharData

PI

static final java.lang.String PI

Comment

static final java.lang.String Comment
Constructor Detail

Node

public Node()
Method Detail

createElement

static Node createElement()
factory method for element nodes
Returns:
a Node of type element

createRootelement

static Node createRootelement()
factory method for the root element
Returns:
a rootelement Node

createChardata

static Node createChardata()
factory method for chardata nodes
Returns:
a chardata Node

createPi

static Node createPi()
factory method for PI nodes
Returns:
a PI Node

createComment

static Node createComment()
factory method for comment nodes
Returns:
a comment Node

getCharacters

public java.lang.String getCharacters()
returns the character data in the first child element; returns nonsense if the first child element ist not chardata
Returns:
the characters following an element

find

public Node find(java.lang.String path,
                 int occur)
find the node matching a certain occurance of the path description
Parameters:
path - an XPath style expression without leading slash
occur - the n'th occurance of a node matching the path expression
Returns:
the n'th Node matching the path description

findChildElement

Node findChildElement(Node parent,
                      java.lang.String simplePath,
                      int occur)
find the child node matching a certain occurance of a simple path description
Parameters:
parent - the parent node to start from
simplePath - one element of an XPath style expression
occur - the n'th occurance of a node matching the path expression
Returns:
the n'th child Node matching the simple path description