Public Member Functions | |
AnyNode () | |
AnyNode (short type, String localName, String prefix, String uri, String value) | |
void | addAnyNode (AnyNode node) |
void | addChild (AnyNode node) |
void | addAttribute (AnyNode node) |
void | addNamespace (AnyNode node) |
AnyNode | getFirstAttribute () |
AnyNode | getFirstNamespace () |
AnyNode | getFirstChild () |
AnyNode | getNextSibling () |
short | getNodeType () |
String | getLocalName () |
String | getNamespaceURI () |
String | getStringValue () |
String | getNamespacePrefix () |
String | toString () |
Static Public Attributes | |
static final short | ELEMENT = 1 |
static final short | ATTRIBUTE = 2 |
static final short | NAMESPACE = 3 |
static final short | PI = 4 |
static final short | COMMENT = 5 |
static final short | TEXT = 6 |
Protected Member Functions | |
void | appendSibling (AnyNode node) |
AnyNode | getFirstChildNode () |
A class used to represent an XML node. This is an alternative to DOM which is too heavy for our purpose (mainly handle XML Fragment when <any> is used in an XML schema). The model is based on XPath Node. An AnyNode can be a:
Processing Instructions
Full handling of namespaces
org.exolab.castor.types.AnyNode.AnyNode | ( | ) |
Default constructor: creates an empty element node
References org.exolab.castor.types.AnyNode.ELEMENT.
org.exolab.castor.types.AnyNode.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. This constructor is not user-friendly and launched RunTime exception is you try to instantiate non-valid node.
short | type the node type. | |
String | localName the name of the node. | |
String | prefix the prefix if any of the namespace. | |
String | uri the namespace uri of this node. | |
String | value the value of this node. |
References org.exolab.castor.types.AnyNode.ELEMENT, org.exolab.castor.types.AnyNode.NAMESPACE, and org.exolab.castor.types.AnyNode.PI.
void org.exolab.castor.types.AnyNode.addAnyNode | ( | AnyNode | node | ) |
Adds an AnyNode to the current node
node | the node to append |
References org.exolab.castor.types.AnyNode.addAttribute(), org.exolab.castor.types.AnyNode.addChild(), org.exolab.castor.types.AnyNode.addNamespace(), org.exolab.castor.types.AnyNode.ATTRIBUTE, org.exolab.castor.types.AnyNode.getNodeType(), and org.exolab.castor.types.AnyNode.NAMESPACE.
void org.exolab.castor.types.AnyNode.addAttribute | ( | AnyNode | node | ) |
Adds an attribute to the current node.
node | the attribute to add. |
References org.exolab.castor.types.AnyNode.addAttribute(), org.exolab.castor.types.AnyNode.addChild(), org.exolab.castor.types.AnyNode.appendSibling(), org.exolab.castor.types.AnyNode.ATTRIBUTE, org.exolab.castor.types.AnyNode.getNodeType(), and org.exolab.castor.types.AnyNode.NAMESPACE.
Referenced by org.exolab.castor.types.AnyNode.addAnyNode(), org.exolab.castor.types.AnyNode.addAttribute(), org.exolab.castor.xml.util.SAX2ANY.startElement(), org.exolab.castor.xml.schema.reader.DocumentationUnmarshaller.startElement(), and org.exolab.castor.xml.schema.reader.AppInfoUnmarshaller.startElement().
void org.exolab.castor.types.AnyNode.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. |
References org.exolab.castor.types.AnyNode.addChild(), org.exolab.castor.types.AnyNode.appendSibling(), org.exolab.castor.types.AnyNode.ATTRIBUTE, org.exolab.castor.types.AnyNode.getNodeType(), org.exolab.castor.types.AnyNode.NAMESPACE, and org.exolab.castor.types.AnyNode.TEXT.
Referenced by org.exolab.castor.types.AnyNode.addAnyNode(), org.exolab.castor.types.AnyNode.addAttribute(), org.exolab.castor.types.AnyNode.addChild(), org.exolab.castor.types.AnyNode.addNamespace(), org.exolab.castor.xml.util.SAX2ANY.characters(), org.exolab.castor.xml.schema.reader.DocumentationUnmarshaller.characters(), org.exolab.castor.xml.schema.reader.AppInfoUnmarshaller.characters(), and org.exolab.castor.xml.util.SAX2ANY.endElement().
void org.exolab.castor.types.AnyNode.addNamespace | ( | AnyNode | node | ) |
Appends an namespace to the current node.
node | the attribute to add. |
References org.exolab.castor.types.AnyNode.addChild(), org.exolab.castor.types.AnyNode.addNamespace(), org.exolab.castor.types.AnyNode.appendSibling(), org.exolab.castor.types.AnyNode.ATTRIBUTE, org.exolab.castor.types.AnyNode.getNodeType(), and org.exolab.castor.types.AnyNode.NAMESPACE.
Referenced by org.exolab.castor.types.AnyNode.addAnyNode(), org.exolab.castor.types.AnyNode.addNamespace(), org.exolab.castor.xml.util.SAX2ANY.startElement(), org.exolab.castor.xml.schema.reader.DocumentationUnmarshaller.startElement(), and org.exolab.castor.xml.schema.reader.AppInfoUnmarshaller.startElement().
void org.exolab.castor.types.AnyNode.appendSibling | ( | AnyNode | node | ) | [protected] |
Appends a sibling AnyNode to the current node. The node to append will be added at the end of the sibling branch.
node | the node to add |
References org.exolab.castor.types.AnyNode.appendSibling(), org.exolab.castor.types.AnyNode.ATTRIBUTE, org.exolab.castor.types.AnyNode.getNodeType(), org.exolab.castor.types.AnyNode.NAMESPACE, and org.exolab.castor.types.AnyNode.TEXT.
Referenced by org.exolab.castor.types.AnyNode.addAttribute(), org.exolab.castor.types.AnyNode.addChild(), org.exolab.castor.types.AnyNode.addNamespace(), and org.exolab.castor.types.AnyNode.appendSibling().
AnyNode org.exolab.castor.types.AnyNode.getFirstAttribute | ( | ) |
Returns the first attribute of the current ELEMENT node or null. The next attribute,if any,is the sibling of the returned node.
References org.exolab.castor.types.AnyNode.COMMENT, org.exolab.castor.types.AnyNode.ELEMENT, org.exolab.castor.types.AnyNode.getFirstChildNode(), org.exolab.castor.types.AnyNode.getNodeType(), org.exolab.castor.types.AnyNode.NAMESPACE, org.exolab.castor.types.AnyNode.PI, and org.exolab.castor.types.AnyNode.TEXT.
AnyNode org.exolab.castor.types.AnyNode.getFirstChild | ( | ) |
Returns the first Child node of this node. A 'child' can be either an ELEMENT node, a COMMENT node, a TEXT node or a PROCESSING INSTRUCTION.
References org.exolab.castor.types.AnyNode.ATTRIBUTE, org.exolab.castor.types.AnyNode.COMMENT, org.exolab.castor.types.AnyNode.ELEMENT, org.exolab.castor.types.AnyNode.getFirstChildNode(), org.exolab.castor.types.AnyNode.getNodeType(), org.exolab.castor.types.AnyNode.NAMESPACE, org.exolab.castor.types.AnyNode.PI, and org.exolab.castor.types.AnyNode.TEXT.
Referenced by org.exolab.castor.types.AnyNode.getStringValue(), and org.exolab.castor.xml.schema.AnnotationItem.getStringValue().
AnyNode org.exolab.castor.types.AnyNode.getFirstChildNode | ( | ) | [protected] |
Returns the first child node in the tree.
Referenced by org.exolab.castor.types.AnyNode.getFirstAttribute(), org.exolab.castor.types.AnyNode.getFirstChild(), and org.exolab.castor.types.AnyNode.getFirstNamespace().
AnyNode org.exolab.castor.types.AnyNode.getFirstNamespace | ( | ) |
Returns the first namespace of the current ELEMENT node or null. The next attribute if any is the sibling of the returned node.
References org.exolab.castor.types.AnyNode.ATTRIBUTE, org.exolab.castor.types.AnyNode.COMMENT, org.exolab.castor.types.AnyNode.ELEMENT, org.exolab.castor.types.AnyNode.getFirstChildNode(), org.exolab.castor.types.AnyNode.getNodeType(), org.exolab.castor.types.AnyNode.PI, and org.exolab.castor.types.AnyNode.TEXT.
String org.exolab.castor.types.AnyNode.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.
Referenced by org.exolab.castor.xml.util.SAX2ANY.endElement().
String org.exolab.castor.types.AnyNode.getNamespacePrefix | ( | ) |
Returns the namespace prefix associated with the namespace URI of this node. Returns null if no prefix. is defined for this namespace URI. Returns an empty string if the default prefix is associated with this namespace URI.
String org.exolab.castor.types.AnyNode.getNamespaceURI | ( | ) |
Returns the namespace URI of the node. Returns the namespace URI of an element, attribute or namespace node, or null for all other node types.
AnyNode org.exolab.castor.types.AnyNode.getNextSibling | ( | ) |
Returns the next sibling of the current node. When the AnyNode is an ATTRIBUTE, it will return the next ATTRIBUTE node. When the AnyNode is a NAMESPACE, it will return the next NAMESPACE node.
Referenced by org.exolab.castor.types.AnyNode.getStringValue(), and org.exolab.castor.xml.schema.AnnotationItem.getStringValue().
short org.exolab.castor.types.AnyNode.getNodeType | ( | ) |
Returns the type of this node.
Referenced by org.exolab.castor.types.AnyNode.addAnyNode(), org.exolab.castor.types.AnyNode.addAttribute(), org.exolab.castor.types.AnyNode.addChild(), org.exolab.castor.types.AnyNode.addNamespace(), org.exolab.castor.types.AnyNode.appendSibling(), org.exolab.castor.types.AnyNode.getFirstAttribute(), org.exolab.castor.types.AnyNode.getFirstChild(), org.exolab.castor.types.AnyNode.getFirstNamespace(), org.exolab.castor.types.AnyNode.getStringValue(), and org.exolab.castor.xml.schema.AnnotationItem.getStringValue().
String org.exolab.castor.types.AnyNode.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.
References org.exolab.castor.types.AnyNode.ATTRIBUTE, org.exolab.castor.types.AnyNode.COMMENT, org.exolab.castor.types.AnyNode.ELEMENT, org.exolab.castor.types.AnyNode.getFirstChild(), org.exolab.castor.types.AnyNode.getNextSibling(), org.exolab.castor.types.AnyNode.getNodeType(), org.exolab.castor.types.AnyNode.getStringValue(), org.exolab.castor.types.AnyNode.NAMESPACE, org.exolab.castor.types.AnyNode.PI, org.exolab.castor.types.AnyNode.TEXT, and org.exolab.castor.types.AnyNode.toString().
Referenced by org.exolab.castor.types.AnyNode.getStringValue(), and org.exolab.castor.xml.schema.AnnotationItem.getStringValue().
String org.exolab.castor.types.AnyNode.toString | ( | ) |
Returns the String representation of this AnyNode The String representation is a xml well-formed fragment corresponding to the representation of this node.
Referenced by org.exolab.castor.types.AnyNode.getStringValue().
final short org.exolab.castor.types.AnyNode.ATTRIBUTE = 2 [static] |
Representation for an attribute node.
Referenced by org.exolab.castor.types.AnyNode.addAnyNode(), org.exolab.castor.types.AnyNode.addAttribute(), org.exolab.castor.types.AnyNode.addChild(), org.exolab.castor.types.AnyNode.addNamespace(), org.exolab.castor.types.AnyNode.appendSibling(), org.exolab.castor.types.AnyNode.getFirstChild(), org.exolab.castor.types.AnyNode.getFirstNamespace(), and org.exolab.castor.types.AnyNode.getStringValue().
final short org.exolab.castor.types.AnyNode.COMMENT = 5 [static] |
Representation for a comment node.
Referenced by org.exolab.castor.types.AnyNode.getFirstAttribute(), org.exolab.castor.types.AnyNode.getFirstChild(), org.exolab.castor.types.AnyNode.getFirstNamespace(), and org.exolab.castor.types.AnyNode.getStringValue().
final short org.exolab.castor.types.AnyNode.ELEMENT = 1 [static] |
Representation for an element node.
Referenced by org.exolab.castor.types.AnyNode.AnyNode(), org.exolab.castor.types.AnyNode.getFirstAttribute(), org.exolab.castor.types.AnyNode.getFirstChild(), org.exolab.castor.types.AnyNode.getFirstNamespace(), and org.exolab.castor.types.AnyNode.getStringValue().
final short org.exolab.castor.types.AnyNode.NAMESPACE = 3 [static] |
Representation for a Namespace node.
Referenced by org.exolab.castor.types.AnyNode.addAnyNode(), org.exolab.castor.types.AnyNode.addAttribute(), org.exolab.castor.types.AnyNode.addChild(), org.exolab.castor.types.AnyNode.addNamespace(), org.exolab.castor.types.AnyNode.AnyNode(), org.exolab.castor.types.AnyNode.appendSibling(), org.exolab.castor.types.AnyNode.getFirstAttribute(), org.exolab.castor.types.AnyNode.getFirstChild(), and org.exolab.castor.types.AnyNode.getStringValue().
final short org.exolab.castor.types.AnyNode.PI = 4 [static] |
Representation for a processing instruction node.
Referenced by org.exolab.castor.types.AnyNode.AnyNode(), org.exolab.castor.types.AnyNode.getFirstAttribute(), org.exolab.castor.types.AnyNode.getFirstChild(), org.exolab.castor.types.AnyNode.getFirstNamespace(), and org.exolab.castor.types.AnyNode.getStringValue().
final short org.exolab.castor.types.AnyNode.TEXT = 6 [static] |
Representation for a text node.
Referenced by org.exolab.castor.types.AnyNode.addChild(), org.exolab.castor.types.AnyNode.appendSibling(), org.exolab.castor.types.AnyNode.getFirstAttribute(), org.exolab.castor.types.AnyNode.getFirstChild(), org.exolab.castor.types.AnyNode.getFirstNamespace(), org.exolab.castor.types.AnyNode.getStringValue(), and org.exolab.castor.xml.schema.AnnotationItem.getStringValue().