public final class AnyNode extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static short |
ATTRIBUTE
Representation for an attribute node.
|
static short |
COMMENT
Representation for a comment node.
|
static short |
ELEMENT
Representation for an element node.
|
static short |
NAMESPACE
Representation for a Namespace node.
|
static short |
PI
Representation for a processing instruction node.
|
static short |
TEXT
Representation for a text node.
|
Constructor and Description |
---|
AnyNode()
Default constructor: creates an empty element node
|
AnyNode(short type,
String localName,
String prefix,
String uri,
String value)
Creates a node given all the necessary information:
type, localName, prefix, uri and value.
|
Modifier and Type | Method and Description |
---|---|
void |
addAnyNode(AnyNode node)
Adds an AnyNode to the current node
|
void |
addAttribute(AnyNode node)
Adds an attribute to the current node.
|
void |
addChild(AnyNode node)
Adds a child AnyNode to this node.
|
void |
addNamespace(AnyNode node)
Appends an namespace to the current node.
|
protected void |
appendSibling(AnyNode node)
Appends a sibling AnyNode to the current node.
|
AnyNode |
getFirstAttribute()
Returns the first attribute of the current ELEMENT node
or null.
|
AnyNode |
getFirstChild()
Returns the first Child node of this node.
|
protected AnyNode |
getFirstChildNode()
Returns the first child node in the tree.
|
AnyNode |
getFirstNamespace()
Returns the first namespace of the current ELEMENT node or null.
|
String |
getLocalName()
Returns the local name of the node.
|
String |
getNamespacePrefix()
Returns the namespace prefix associated with the namespace URI of this
node.
|
String |
getNamespaceURI()
Returns the namespace URI of the node.
|
AnyNode |
getNextSibling()
Returns the next sibling of the current node.
|
short |
getNodeType()
Returns the type of this node.
|
String |
getStringValue()
Returns the string value of the node.
|
String |
toString()
Returns the String representation of this AnyNode.
|
public static final short ELEMENT
public static final short ATTRIBUTE
public static final short NAMESPACE
public static final short PI
public static final short COMMENT
public static final short TEXT
public AnyNode()
public AnyNode(short type, String localName, String prefix, String uri, String value)
type
- the node type.localName
- the name of the node.prefix
- the prefix if any of the namespace.uri
- the namespace uri of this node.value
- the value of this node.public void addAnyNode(AnyNode node)
node
- the node to appendpublic void addChild(AnyNode node)
Adds a child AnyNode to this node. A 'child' can be either an ELEMENT node, a COMMENT node, a TEXT node or a PROCESSING INSTRUCTION. If the current node already has a child then the node to add will be append as a sibling.
Note: you cannot add a child to a TEXT node.
node
- the node to add.public void addAttribute(AnyNode node)
node
- the attribute to add.public void addNamespace(AnyNode node)
node
- the attribute to add.public AnyNode getFirstAttribute()
public AnyNode getFirstNamespace()
public AnyNode getFirstChild()
public AnyNode getNextSibling()
public short getNodeType()
public String getLocalName()
public String getNamespaceURI()
public String getStringValue()
public String getNamespacePrefix()
public String toString()
protected void appendSibling(AnyNode node)
node
- the node to addprotected AnyNode getFirstChildNode()
Copyright © 2013. All rights reserved.