Qizx/Open v0.3

net.xfra.qizxopen.dm
Interface Node

All Known Subinterfaces:
Node
All Known Implementing Classes:
CoreDM.BaseNode, FONIDM.BaseNode, NodeBase

public interface Node

Node as defined by the XQuery1/XPath2 Data Model, with extensions.


Field Summary
static int ATTRIBUTE
           
static int COMMENT
           
static int DOCUMENT
           
static int ELEMENT
           
static int NAMESPACE
           
static int PROCESSING_INSTRUCTION
           
static int TEXT
           
static int TYPE_BINARY
           
static int TYPE_BOOLEAN
           
static int TYPE_DATETIME
           
static int TYPE_DOUBLE
           
static int TYPE_INTEGER
           
static int TYPE_NODE
           
static int TYPE_STRING
           
 
Method Summary
 void addText(java.lang.String text)
          Adds text inside the node.
 NodeSequence ancestors(NodeTest nodeTest)
          Returns an iterator on ancestors that match the node test.
 NodeSequence ancestorsOrSelf(NodeTest nodeTest)
           
 Node attribute(QName name)
          get attribute by name.
 NodeSequence attributes()
          Accessor dm:attributes.
 NodeSequence attributes(NodeTest nodeTest)
           
 NodeSequence children()
          Accessor dm:children.
 NodeSequence children(NodeTest nodeTest)
           
 int compareStringValues(Node node, java.text.Collator collator)
           
 boolean contains(Node node)
          Returns true if this node is an ancestor of the node, or the node itself.
 NodeSequence descendants(NodeTest nodeTest)
           
 NodeSequence descendantsOrSelf(NodeTest nodeTest)
           
 int docPosition()
          Returns an arbitrary value that is stable on the whole document (for order comparison).
 Node document()
          Returns the document node if any, else the top-level node.
 NodeSequence following(NodeTest nodeTest)
           
 NodeSequence followingSiblings(NodeTest nodeTest)
           
 int getAtomType()
          returns the real type of the atom value: TYPE_STRING, TYPE_BINARY, etc.
 java.lang.Object getAtomValue()
          Returns the real value of the atom: byte[], Boolean, Date, Double, Long, String.
 java.lang.String getBaseURI()
          Accessor dm:base-uri().
 char[] getChars()
          get text as char array (atomic nodes only).
 int getDefinedNSCount()
          Number of Namespaces defined on this node.
 java.lang.String getDocumentURI()
           
 double getDoubleValue()
          Returns the double value (attempts to convert).
 long getIntegerValue()
          Returns the integer value (attempts to convert).
 int getNature()
          Returns a numeric node kind: DOCUMENT, ELEMENT etc.
 java.lang.String getNodeKind()
          Accessor dm:node-kind().
 QName getNodeName()
          Accessor dm:node-name().
 java.lang.String getNsPrefix(java.lang.String nsuri)
          Returns a matching prefix for the Namespace by looking up the namespace nodes.
 java.lang.String getNsUri(java.lang.String prefix)
          Returns a matching Namespace for the prefix by looking up the namespace nodes.
 java.lang.String getStringValue()
          Accessor dm:string-value().
 boolean isElement()
          Convenience: quick test of elements.
 NodeSequence namespaces(boolean inScope)
          Accessor dm:namespaces().
 int orderCompare(Node node)
          Returns -1 if this node is strictly before the argument node in document order, 0 if nodes are identical, 1 if after the argument node.
 Node parent()
          Accessor dm:parent().
 NodeSequence parent(NodeTest nodeTest)
          Returns a sequence of length 1 (if the parent matches the nodeTest) else 0.
 NodeSequence preceding(NodeTest nodeTest)
          Preceding nodes in document order.
 NodeSequence precedingSiblings(NodeTest nodeTest)
          Preceding siblings in document order.
 

Field Detail

DOCUMENT

public static final int DOCUMENT
See Also:
Constant Field Values

ELEMENT

public static final int ELEMENT
See Also:
Constant Field Values

ATTRIBUTE

public static final int ATTRIBUTE
See Also:
Constant Field Values

TEXT

public static final int TEXT
See Also:
Constant Field Values

PROCESSING_INSTRUCTION

public static final int PROCESSING_INSTRUCTION
See Also:
Constant Field Values

COMMENT

public static final int COMMENT
See Also:
Constant Field Values

NAMESPACE

public static final int NAMESPACE
See Also:
Constant Field Values

TYPE_NODE

public static final int TYPE_NODE
See Also:
Constant Field Values

TYPE_BINARY

public static final int TYPE_BINARY
See Also:
Constant Field Values

TYPE_BOOLEAN

public static final int TYPE_BOOLEAN
See Also:
Constant Field Values

TYPE_DATETIME

public static final int TYPE_DATETIME
See Also:
Constant Field Values

TYPE_DOUBLE

public static final int TYPE_DOUBLE
See Also:
Constant Field Values

TYPE_INTEGER

public static final int TYPE_INTEGER
See Also:
Constant Field Values

TYPE_STRING

public static final int TYPE_STRING
See Also:
Constant Field Values
Method Detail

getNodeKind

public java.lang.String getNodeKind()
Accessor dm:node-kind().

Returns:
the node kind as a string: "element", "attribute" etc.

getNodeName

public QName getNodeName()
Accessor dm:node-name().

Returns:
null if the node has no name (document, text, comment, pi).

parent

public Node parent()
Accessor dm:parent().

Returns:
null if the node has no parent.

getStringValue

public java.lang.String getStringValue()
Accessor dm:string-value().


getBaseURI

public java.lang.String getBaseURI()
Accessor dm:base-uri().


getDocumentURI

public java.lang.String getDocumentURI()

children

public NodeSequence children()
Accessor dm:children. Only for Document and Elements: other kinds yields an empty sequence.


attributes

public NodeSequence attributes()
Accessor dm:attributes. Only for Elements: other kinds yields an empty sequence.


namespaces

public NodeSequence namespaces(boolean inScope)
Accessor dm:namespaces(). Returns namespaces visible by this node. On non-element nodes, always returns the empty sequence.

Parameters:
inScope - if true, return the closure of in-scope namespaces, else namespaces defined specifically on this node.

getNature

public int getNature()
Returns a numeric node kind: DOCUMENT, ELEMENT etc.


document

public Node document()
Returns the document node if any, else the top-level node.


docPosition

public int docPosition()
Returns an arbitrary value that is stable on the whole document (for order comparison).


isElement

public boolean isElement()
Convenience: quick test of elements.


attribute

public Node attribute(QName name)
get attribute by name.


getChars

public char[] getChars()
get text as char array (atomic nodes only).


getDefinedNSCount

public int getDefinedNSCount()
Number of Namespaces defined on this node.


getNsPrefix

public java.lang.String getNsPrefix(java.lang.String nsuri)
Returns a matching prefix for the Namespace by looking up the namespace nodes.

Returns:
null if none is found, the first suitable prefix otherwise.

getNsUri

public java.lang.String getNsUri(java.lang.String prefix)
Returns a matching Namespace for the prefix by looking up the namespace nodes.

Returns:
null if none is found, the first suitable namespace URI otherwise.

orderCompare

public int orderCompare(Node node)
Returns -1 if this node is strictly before the argument node in document order, 0 if nodes are identical, 1 if after the argument node. If the two nodes belong to different documents, returns an arbitrary but stable "order of documents".


compareStringValues

public int compareStringValues(Node node,
                               java.text.Collator collator)

contains

public boolean contains(Node node)
Returns true if this node is an ancestor of the node, or the node itself.


ancestors

public NodeSequence ancestors(NodeTest nodeTest)
Returns an iterator on ancestors that match the node test.

Parameters:
nodeTest - concrete classes are BaseNodeTest(node-kind?, nsuri?, ncname?), UnionNodeTest, DocumentTest.

ancestorsOrSelf

public NodeSequence ancestorsOrSelf(NodeTest nodeTest)

parent

public NodeSequence parent(NodeTest nodeTest)
Returns a sequence of length 1 (if the parent matches the nodeTest) else 0.


children

public NodeSequence children(NodeTest nodeTest)

descendants

public NodeSequence descendants(NodeTest nodeTest)

descendantsOrSelf

public NodeSequence descendantsOrSelf(NodeTest nodeTest)

attributes

public NodeSequence attributes(NodeTest nodeTest)

followingSiblings

public NodeSequence followingSiblings(NodeTest nodeTest)

precedingSiblings

public NodeSequence precedingSiblings(NodeTest nodeTest)
Preceding siblings in document order.


following

public NodeSequence following(NodeTest nodeTest)

preceding

public NodeSequence preceding(NodeTest nodeTest)
Preceding nodes in document order.


addText

public void addText(java.lang.String text)
Adds text inside the node. For an element, creates a text child node if necessary.


getAtomType

public int getAtomType()
returns the real type of the atom value: TYPE_STRING, TYPE_BINARY, etc.


getAtomValue

public java.lang.Object getAtomValue()
Returns the real value of the atom: byte[], Boolean, Date, Double, Long, String.


getDoubleValue

public double getDoubleValue()
                      throws DataModelException
Returns the double value (attempts to convert).

Throws:
DataModelException - if not convertible to double.

getIntegerValue

public long getIntegerValue()
                     throws DataModelException
Returns the integer value (attempts to convert).

Throws:
DataModelException - if not convertible to integer.

 Copyright Xavier FRANC 2003-2004