Public Member Functions | Static Public Attributes | Protected Member Functions

org.exolab.castor.types.AnyNode Class Reference

List of all members.

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 ()

Detailed Description

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:

Author:
Assaf Arkin
Arnaud Blandin
Keith Visco
Version:
Revision:
1.1.1.1
Date:
2003/03/03 07:08:53
Todo:

Processing Instructions

Full handling of namespaces


Constructor & Destructor Documentation

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.

Parameters:
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.


Member Function Documentation

void org.exolab.castor.types.AnyNode.addAnyNode ( AnyNode  node  ) 
void org.exolab.castor.types.AnyNode.addAttribute ( AnyNode  node  ) 
void org.exolab.castor.types.AnyNode.addChild ( AnyNode  node  ) 
void org.exolab.castor.types.AnyNode.addNamespace ( AnyNode  node  ) 
void org.exolab.castor.types.AnyNode.appendSibling ( AnyNode  node  )  [protected]
AnyNode org.exolab.castor.types.AnyNode.getFirstAttribute (  ) 
AnyNode org.exolab.castor.types.AnyNode.getFirstChild (  ) 
AnyNode org.exolab.castor.types.AnyNode.getFirstChildNode (  )  [protected]

Returns the first child node in the tree.

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 (  ) 
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.

Returns:
The local name of the node, or null if the node has no name

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.

Returns:
The namespace prefix, or null
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.

Returns:
The namespace URI of the node, or null if the node has no namespace URI
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.

Returns:
the next sibling of the current node

Referenced by org.exolab.castor.types.AnyNode.getStringValue(), and org.exolab.castor.xml.schema.AnnotationItem.getStringValue().

short org.exolab.castor.types.AnyNode.getNodeType (  ) 
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.

Returns:
The string value of the 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.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().


Member Data Documentation

final short org.exolab.castor.types.AnyNode.COMMENT = 5 [static]
final short org.exolab.castor.types.AnyNode.ELEMENT = 1 [static]
final short org.exolab.castor.types.AnyNode.PI = 4 [static]
final short org.exolab.castor.types.AnyNode.TEXT = 6 [static]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties