| java.lang.Object org.enhydra.xml.NodeImpl
All known Subclasses: org.enhydra.xml.AttrImpl, org.enhydra.xml.ElementImpl, org.enhydra.xml.CharacterDataImpl,
Field Summary | |
protected NodeImpl | firstChild The first (leftmost) child node of this node, or
null if this node is a leaf node. | protected NodeImpl | lastChild The last (rightmost) child node of this node, or
null if this node is a leaf node. | protected NodeImpl | nextSibling The next (right) sibling node of this node, or
null if this node is its parent's last child node. | protected String | nodeName The name (tag) of the node as a String . | protected String | nodeValue The value of the node as a String . | protected int | numChildren The number of child nodes. | protected Document | ownerDocument Owner document. | protected NodeImpl | parent The parent node of this node, or null if this node
forms the root of its own tree. | protected NodeImpl | previousSibling The previous (left) sibling node of this node, or
null if this node is its parent's first child node. | protected short | type The type of the node as a short . |
Constructor Summary | |
public | NodeImpl() Constructs an empty NodeImpl . | public | NodeImpl(NodeImpl node) Constructs a NodeImpl from the given node,
without creating entire children subtree. | public | NodeImpl(Node node) | public | NodeImpl(Node node, boolean deep) Constructs an NodeImpl from a given node, as a Node ,
and deep as boolean . | public | NodeImpl(Document ownerDoc, String name) Constructs a NodeImpl from the given document owner and node name. | public | NodeImpl(Document ownerDoc, String nodeName, short type) Constructs an NodeImpl from a given document owner,
node name and node type. | public | NodeImpl(Document ownerDoc, String nodeName, short type, String value) Constructs an NodeImpl from a given document owner,
node name, node type and node value. |
Method Summary | |
public Node | appendChild(Node newChild) Adds the node newChild to the end of the list of
children of this node.
Parameters: newChild - the Node to insert. | protected void | beginToString(StringBuffer sb, Indent indent) Method beginToString should be redefined in extended classes.
Each type of node has its own beginToString and
endToString . | protected void | checkNode(Node node) Check that the node is either null or an
NodeImpl . | public Node | cloneNode(boolean deep) Returns a duplicate of this node. | public short | compareDocumentPosition(Node other) | protected void | endToString(StringBuffer sb, Indent indent) Method endToString should be redefined in extended classes.
Each type of node has its own beginToString and
endToString . | public NamedNodeMap | getAttributes() Returns all attribute nodes of this node. | public String | getBaseURI() | public NodeList | getChildNodes() Returns all child nodes of this node, or null if
the node has no children. | public Object | getFeature(String feature, String version) | public Node | getFirstChild() Returns the first child of this node, or null if
the node has no children. | public Node | getLastChild() Returns the last child of this node, or null if
the node has no children. | public int | getLength() Returns number of child nodes. | public String | getLocalName() Equivalent to getNodeName . | public String | getNamespaceURI() | public Node | getNextSibling() Returns the next sibling of this node, or null if
the node has no next sibling. | public String | getNodeName() Returns the name associated with this node. | public short | getNodeType() Returns the node type. | public String | getNodeValue() Returns the value associated with this node. | public Document | getOwnerDocument() Returns null , since NodeImpl s
do not belong to any Document . | public Node | getParentNode() Returns the parent of this node. | public String | getPrefix() Returns null , since namespaces are not supported. | public Node | getPreviousSibling() Returns the previous sibling of this node, or null
if this node has no previous sibling. | public String | getTextContent() | public Object | getUserData(String key) | public boolean | hasAttributes() Returns true , if this node has attributes, otherwise
false . | public boolean | hasChildNodes() Returns true if this node has child nodes. | protected void | initNodeImplChildren(Node node) Creates the children subtree and adds to this node. | public Node | insertBefore(Node newChild, Node refChild) Inserts the node newChild before the existing
child node refChild . | public boolean | isDefaultNamespace(String namespaceURI) | public boolean | isEqualNode(Node arg) | public boolean | isSameNode(Node other) | public boolean | isSupported(String feature, String version) Returns false since DOM features are not
supported. | public Node | item(int index) Returns child node with the given index. | public String | lookupNamespaceURI(String prefix) | public String | lookupPrefix(String namespaceURI) | protected Node | newCommentInstance(Node node) Creates new instance of the CommentImpl class.
Parameters: node - , as a Node . | protected Node | newDefaultInstance(Node node) Creates new instance of the NodeImpl class.
Parameters: node - , as a Node . | protected Node | newElementInstance(Node node) Creates new instance of the ElementImpl class.
Parameters: node - , as a Node . | protected Node | newTextInstance(Node node) Creates new instance of the TextImpl class.
Parameters: node - , as a Node . | public void | normalize() Does nothing, since NodeImpl s do not
contain Text children. | public Node | removeChild(Node oldChild) Removes the child node indicated by oldChild from
the list of children, and returns it.
Parameters: oldChild - the Node to be removed. | public Node | replaceChild(Node newChild, Node oldChild) Replaces the child node oldChild with
newChild in the list of children, and returns the
oldChild node.
Parameters: newChild - the Node to insert. Parameters: oldChild - the Node to be replaced. | public void | setNodeValue(String nodeValue) Sets the node value of this node. | public void | setPrefix(String prefix) Does nothing, since namespaces are not supported. | public void | setTextContent(String textContent) | public Object | setUserData(String key, Object data, UserDataHandler handler) | public String | toString() Returns String representation of this node. | public String | toString(String tab) Returns String representation of this node.
Parameters: tab - tab for node indentation. |
firstChild | protected NodeImpl firstChild(Code) | | The first (leftmost) child node of this node, or
null if this node is a leaf node.
|
lastChild | protected NodeImpl lastChild(Code) | | The last (rightmost) child node of this node, or
null if this node is a leaf node.
|
nextSibling | protected NodeImpl nextSibling(Code) | | The next (right) sibling node of this node, or
null if this node is its parent's last child node.
|
nodeName | protected String nodeName(Code) | | The name (tag) of the node as a String .
|
nodeValue | protected String nodeValue(Code) | | The value of the node as a String .
|
numChildren | protected int numChildren(Code) | | The number of child nodes.
|
parent | protected NodeImpl parent(Code) | | The parent node of this node, or null if this node
forms the root of its own tree.
|
previousSibling | protected NodeImpl previousSibling(Code) | | The previous (left) sibling node of this node, or
null if this node is its parent's first child node.
|
type | protected short type(Code) | | The type of the node as a short .
|
NodeImpl | public NodeImpl()(Code) | | Constructs an empty NodeImpl .
|
NodeImpl | public NodeImpl(NodeImpl node)(Code) | | Constructs a NodeImpl from the given node,
without creating entire children subtree.
Parameters: node - , as a NodeImpl . |
NodeImpl | public NodeImpl(Node node)(Code) | | Constructs an NodeImpl from a given node (creates the children subtree too),
as a Node
Parameters: node - , as a Node . |
NodeImpl | public NodeImpl(Node node, boolean deep)(Code) | | Constructs an NodeImpl from a given node, as a Node ,
and deep as boolean .
Parameters: node - , as a Node . Parameters: deep - if true , recursively clone the subtreeunder the specified node; if false , clone only thenode itself. |
NodeImpl | public NodeImpl(Document ownerDoc, String name)(Code) | | Constructs a NodeImpl from the given document owner and node name.
Parameters: ownerDoc - the document owner of the node, as a Document . Parameters: name - the name of the node, as a String . |
NodeImpl | public NodeImpl(Document ownerDoc, String nodeName, short type)(Code) | | Constructs an NodeImpl from a given document owner,
node name and node type.
Parameters: ownerDoc - the document owner of the node, as a Document . Parameters: nodeName - the name of the node, as a String . Parameters: type - the type of the node, as a short . |
NodeImpl | public NodeImpl(Document ownerDoc, String nodeName, short type, String value)(Code) | | Constructs an NodeImpl from a given document owner,
node name, node type and node value.
Parameters: ownerDoc - the document owner of the node, as a Document . Parameters: nodeName - the name of the node, as a String . Parameters: type - the type of the node, as a short . Parameters: value - the value of the node, as a String . |
appendChild | public Node appendChild(Node newChild)(Code) | | Adds the node newChild to the end of the list of
children of this node.
Parameters: newChild - the Node to insert. the node added. exception: IllegalArgumentException - if newChild isnull . |
beginToString | protected void beginToString(StringBuffer sb, Indent indent)(Code) | | Method beginToString should be redefined in extended classes.
Each type of node has its own beginToString and
endToString . This was added to support
writing of the xml file. The Element
type of node: it writes the beginning tag, then calls
the child's toString , and then writes the ending tag.
Parameters: sb - string buffer to add resulting string. Parameters: indent - used in formating the output. |
checkNode | protected void checkNode(Node node) throws DOMException(Code) | | Check that the node is either null or an
NodeImpl .
Parameters: node - , as a Node . exception: DOMException - if node is not an instance of NodeImpl . |
cloneNode | public Node cloneNode(boolean deep)(Code) | | Returns a duplicate of this node. The duplicate node has no
parent (getParentNode returns null ).
If a shallow clone is being performed (deep is
false ), the new node will not have any children or
siblings. If a deep clone is being performed, the new node
will form the root of a complete cloned subtree.
Parameters: deep - if true , recursively clone the subtreeunder the specified node; if false , clone only thenode itself. the duplicate node. |
endToString | protected void endToString(StringBuffer sb, Indent indent)(Code) | | Method endToString should be redefined in extended classes.
Each type of node has its own beginToString and
endToString . This was added to support
writing of the xml file. The Element
type of node: it writes the beginning tag, then calls
the child's toString , and then writes the ending tag.
Parameters: sb - string buffer to add resulting string. Parameters: indent - used in formating the output. |
getAttributes | public NamedNodeMap getAttributes()(Code) | | Returns all attribute nodes of this node.
all attribute nodes of this node. |
getChildNodes | public NodeList getChildNodes()(Code) | | Returns all child nodes of this node, or null if
the node has no children.
all child nodes of this node, as a Node , ornull . |
getFirstChild | public Node getFirstChild()(Code) | | Returns the first child of this node, or null if
the node has no children.
the first child, as a Node , ornull |
getLastChild | public Node getLastChild()(Code) | | Returns the last child of this node, or null if
the node has no children.
the last child, as a Node , ornull . |
getLength | public int getLength()(Code) | | Returns number of child nodes.
all number of child nodes. |
getLocalName | public String getLocalName()(Code) | | Equivalent to getNodeName .
the node name, as a String . |
getNextSibling | public Node getNextSibling()(Code) | | Returns the next sibling of this node, or null if
the node has no next sibling.
the next sibling, as a Node , ornull . |
getNodeName | public String getNodeName()(Code) | | Returns the name associated with this node.
the name, as a String . |
getNodeType | public short getNodeType()(Code) | | Returns the node type.
the short value node type. |
getNodeValue | public String getNodeValue()(Code) | | Returns the value associated with this node.
the node value, as a String . |
getOwnerDocument | public Document getOwnerDocument()(Code) | | Returns null , since NodeImpl s
do not belong to any Document .
document owner as Document . |
getParentNode | public Node getParentNode()(Code) | | Returns the parent of this node. A null value
indicates that the node is the root of its own tree. To add a
node to an existing tree, use one of the
insertBefore , replaceChild , or
appendChild methods.
the parent, as a Node . See Also: NodeImpl.insertBefore See Also: NodeImpl.replaceChild See Also: NodeImpl.appendChild |
getPreviousSibling | public Node getPreviousSibling()(Code) | | Returns the previous sibling of this node, or null
if this node has no previous sibling.
the previous sibling, as a Node , ornull . |
hasAttributes | public boolean hasAttributes()(Code) | | Returns true , if this node has attributes, otherwise
false .
true if node has attributes, otherwise false .. |
hasChildNodes | public boolean hasChildNodes()(Code) | | Returns true if this node has child nodes.
true if this node has children. |
initNodeImplChildren | protected void initNodeImplChildren(Node node)(Code) | | Creates the children subtree and adds to this node.
(this part had to be splited from the constructor)
Parameters: node - a Node . |
insertBefore | public Node insertBefore(Node newChild, Node refChild)(Code) | | Inserts the node newChild before the existing
child node refChild . If refChild is
null , insert newChild at the end of
the list of children.
Parameters: newChild - the Node to insert. Parameters: refChild - the reference Node . the node being inserted. exception: IllegalArgumentException - if newChild isnull . |
isDefaultNamespace | public boolean isDefaultNamespace(String namespaceURI)(Code) | | |
isEqualNode | public boolean isEqualNode(Node arg)(Code) | | |
isSameNode | public boolean isSameNode(Node other)(Code) | | |
isSupported | public boolean isSupported(String feature, String version)(Code) | | Returns false since DOM features are not
supported.
false . Parameters: feature - a String , which is ignored. Parameters: version - a String , which is ignored. |
item | public Node item(int index)(Code) | | Returns child node with the given index.
child node with the given index. Parameters: index - represents index |
newCommentInstance | protected Node newCommentInstance(Node node)(Code) | | Creates new instance of the CommentImpl class.
Parameters: node - , as a Node . Node new instance of the CommentImpl class. |
newDefaultInstance | protected Node newDefaultInstance(Node node)(Code) | | Creates new instance of the NodeImpl class.
Parameters: node - , as a Node . Node new instance of the NodeImpl class. |
newElementInstance | protected Node newElementInstance(Node node)(Code) | | Creates new instance of the ElementImpl class.
Parameters: node - , as a Node . Node new instance of the ElementImpl class. |
newTextInstance | protected Node newTextInstance(Node node)(Code) | | Creates new instance of the TextImpl class.
Parameters: node - , as a Node . Node new instance of the TextImpl class. |
normalize | public void normalize()(Code) | | Does nothing, since NodeImpl s do not
contain Text children.
|
removeChild | public Node removeChild(Node oldChild)(Code) | | Removes the child node indicated by oldChild from
the list of children, and returns it.
Parameters: oldChild - the Node to be removed. the node removed. exception: IllegalArgumentException - if oldChild isnull . |
replaceChild | public Node replaceChild(Node newChild, Node oldChild)(Code) | | Replaces the child node oldChild with
newChild in the list of children, and returns the
oldChild node.
Parameters: newChild - the Node to insert. Parameters: oldChild - the Node to be replaced. the node replaced. exception: IllegalArgumentException - if newChild isnull . |
setNodeValue | public void setNodeValue(String nodeValue)(Code) | | Sets the node value of this node.
Parameters: nodeValue - new node value, as a String . |
setPrefix | public void setPrefix(String prefix)(Code) | | Does nothing, since namespaces are not supported.
Parameters: prefix - a String , which is ignored. See Also: NodeImpl.getPrefix |
toString | public String toString()(Code) | | Returns String representation of this node.
String representation of this node. |
toString | public String toString(String tab)(Code) | | Returns String representation of this node.
Parameters: tab - tab for node indentation. String representation of this node. |
|
|