Class XMLNode
java.lang.Object
org.castor.xmlctf.xmldiff.xml.nodes.XMLNode
- Direct Known Subclasses:
Attribute
,ParentNode
,ProcessingInstruction
,Text
The base node for all XMLNode types.
- Since:
- Castor 1.1
- Version:
- $Revision: 0000 $ $Date: 2007-01-11 00:00:00 -0600 (Thu, 11 Jan 2007) $
- Author:
- Edward Kuns
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Node is an attribute.static final int
Node is an element.static final int
Node is a processing instruction.static final int
Node is a root node.static final int
Node is a text node. -
Method Summary
Modifier and TypeMethodDescriptionReturns the local name of the node.Returns the namespace URI the node.getNamespaceURI
(String prefix) Returns the namespace URI associated with this namespace prefix, as defined in the context of this node.Finds and returns the location of this node in its root's tree.final int
Returns the type of this node.Returns the parent node, or null if the node has no parent.Returns the root node.abstract String
Returns the string value of the node.protected String
getXPath()
Returns the XPath from the root node to this node.void
setNamespace
(String namespace) Sets the namespace URI for this XMLNode.
-
Field Details
-
ROOT
public static final int ROOTNode is a root node.- See Also:
-
ELEMENT
public static final int ELEMENTNode is an element.- See Also:
-
ATTRIBUTE
public static final int ATTRIBUTENode is an attribute.- See Also:
-
TEXT
public static final int TEXTNode is a text node.- See Also:
-
PROCESSING_INSTRUCTION
public static final int PROCESSING_INSTRUCTIONNode is a processing instruction.- See Also:
-
-
Method Details
-
getNodeType
public final int getNodeType()Returns the type of this node.- Returns:
- The type of this node
-
getLocalName
Returns the local name of the node. Returns the local name of an element or attribute, the prefix of a namespace node, the target of a processing instruction, or null for all other node types.- Returns:
- The local name of the node, or null if the node has no name
-
getNamespaceURI
Returns the namespace URI the node. Returns the namespace URI of an element, attribute or namespace node, or null for all other node types.- Returns:
- The namespace URI of the node, or null if the node has no namespace URI
-
getParentNode
Returns the parent node, or null if the node has no parent. This method is valid on all node types except the root node. Attribute and namespace nodes have the element as their parent node.- Returns:
- The parent node, or null
-
getRootNode
Returns the root node.- Returns:
- The root node
-
getStringValue
Returns the string value of the node. The string value of a text node or an attribute node is its text value. The string value of an element or a root node is the concatenation of the string value of all its child nodes. The string value of a namespace node is its namespace URI. The string value of a processing instruction is the instruction, and the string value of a comment is the comment text.- Returns:
- The string value of the node
-
getNamespaceURI
Returns the namespace URI associated with this namespace prefix, as defined in the context of this node. Returns null if the prefix is undefined. Returns empty if the prefix is defined and associated with no namespace. This method is valid only for element nodes.- Parameters:
prefix
- The namespace prefix- Returns:
- The namespace URI, or null
-
setNamespace
Sets the namespace URI for this XMLNode.- Parameters:
namespace
- the Namespace URI
-
getNodeLocation
Finds and returns the location of this node in its root's tree.- Returns:
- the location of this node in its root's tree.
-
getXPath
Returns the XPath from the root node to this node.- Returns:
- the XPath from the root node to this node.
-