Qizx/open API

net.axyana.qizxopen.dm
Class FONIDataModel.BaseNode

java.lang.Object
  extended bynet.axyana.qizxopen.dm.FONIDataModel.BaseNode
All Implemented Interfaces:
Node, java.io.Serializable
Direct Known Subclasses:
XQFONIDataModel.INode
Enclosing class:
FONIDataModel

public static class FONIDataModel.BaseNode
extends java.lang.Object
implements Node, java.io.Serializable

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface net.axyana.qizxopen.dm.Node
ATOM_ANY, ATOM_BOOL, ATOM_DATE, ATOM_DOUBLE, ATOM_INT, ATTRIBUTE, COMMENT, DOCUMENT, ELEMENT, NAMESPACE, PROCESSING_INSTRUCTION, TEXT
 
Constructor Summary
FONIDataModel.BaseNode()
           
FONIDataModel.BaseNode(int id, FONIDataModel dm)
           
 
Method Summary
 void addAttribute(Node attribute)
           
 void addChild(Node child)
           
 void addText(java.lang.String value)
          Adds text inside the node.
 NodeSequence ancestors(NodeTest nodeTest)
          Returns an iterator on ancestors that match the node test.
 NodeSequence ancestorsOrSelf(NodeTest nodeTest)
          Returns an iterator on ancestors (including the node itself) that match the node test.
 Node attribute(QName name)
          Gets an attribute [of this element] by name.
 NodeSequence attributes()
          Accessor dm:attributes.
 NodeSequence attributes(NodeTest nodeTest)
          Returns an iterator on attributes that match the node test.
 NodeSequence children()
          Accessor dm:children.
 NodeSequence children(NodeTest nodeTest)
          Returns an iterator on children that match the node test.
 int compareStringValues(Node node, java.text.Collator collator)
          Compares the string values of two nodes, optionally using a collation.
 boolean contains(Node node)
          Returns true if this node is an ancestor of the parameter node or the node itself.
 boolean deepEqual(Node node, java.text.Collator collator)
           
 NodeSequence descendants(NodeTest nodeTest)
          Returns an iterator on descendants that match the node test.
 NodeSequence descendantsOrSelf(NodeTest nodeTest)
          Returns an iterator on descendants (including the node itself) that match the node test.
 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.
 boolean equals(java.lang.Object that)
           
 NodeSequence following(NodeTest nodeTest)
          Returns an iterator on following nodes that match the node test.
 NodeSequence followingSiblings(NodeTest nodeTest)
          Returns an iterator on following siblings that match the node test.
 java.lang.String getBaseURI()
          Accessor dm:base-uri().
 char[] getChars()
          Gets text contents as a char array.
 int getDefinedNSCount()
          Number of Namespaces defined on this particular node.
 int getDocId()
           
 java.lang.String getDocumentURI()
          Returns the URI of the document.
 FONIDocument getDom()
           
 long getIntegerValue()
          Returns the integer value (attempts to convert).
 int getNature()
          Returns a numeric node kind: DOCUMENT, ELEMENT etc.
 int getNodeDepth()
           
 int getNodeId()
           
 java.lang.String getNodeKind()
          Accessor dm:node-kind().
 QName getNodeName()
          Accessor dm:node-name().
 int getNodeSpan()
           
 java.lang.String getNsPrefix(java.lang.String nsuri)
          Returns a matching prefix for the Namespace by looking up the namespace nodes on this element and its ancestors.
 java.lang.String getNsUri(java.lang.String prefix)
          Returns a matching Namespace for the prefix by looking up the namespace nodes on this element and its ancestors.
 java.lang.String getStringValue()
          Accessor dm:string-value().
 java.lang.Object getValue()
          Returns the value of an atomic node.
 int hashCode()
           
 boolean isAtom()
          Convenience: quick test of atomic nodes (text, comment, typed atoms).
 boolean isElement()
          Convenience: quick test of elements.
 boolean isRemote()
          Tests whether the node is a remote reference or is local to the JVM.
 NodeSequence namespaces(boolean inScope)
          Accessor dm:namespaces().
 int orderCompare(Node node)
          Returns -1 if this node is strictly before that node in document order, 0 if nodes are identical, 1 if after the that 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)
          Returns an iterator preceding nodes (in document order) that match the node test.
 NodeSequence precedingSiblings(NodeTest nodeTest)
          Returns an iterator on preceding siblings (in document order) that match the node test.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FONIDataModel.BaseNode

public FONIDataModel.BaseNode()

FONIDataModel.BaseNode

public FONIDataModel.BaseNode(int id,
                              FONIDataModel dm)
Method Detail

getDocId

public int getDocId()
             throws DataModelException
Throws:
DataModelException

getNodeId

public int getNodeId()

getDom

public final FONIDocument getDom()

isRemote

public boolean isRemote()
Description copied from interface: Node
Tests whether the node is a remote reference or is local to the JVM.

This helps to choose an optimal strategy to retrieve the node contents: an remote node is more efficiently retrieved using methods like XMLDocument.exportNode.

Note: a node from a CoreDataModel is never remote.

Specified by:
isRemote in interface Node

getNodeKind

public java.lang.String getNodeKind()
                             throws DataModelException
Description copied from interface: Node
Accessor dm:node-kind().

Specified by:
getNodeKind in interface Node
Returns:
the node kind as a string: "element", "attribute" etc.
Throws:
DataModelException

getNodeName

public QName getNodeName()
                  throws DataModelException
Description copied from interface: Node
Accessor dm:node-name().

Specified by:
getNodeName in interface Node
Returns:
null if the node has no name (document, text, comment, pi).
Throws:
DataModelException

parent

public Node parent()
            throws DataModelException
Description copied from interface: Node
Accessor dm:parent().

Specified by:
parent in interface Node
Returns:
null if the node has no parent.
Throws:
DataModelException

getStringValue

public java.lang.String getStringValue()
                                throws DataModelException
Description copied from interface: Node
Accessor dm:string-value().

Returns the string value of the node. For an element, it is the concatenation of text nodes contained in the element.

Specified by:
getStringValue in interface Node
Throws:
DataModelException

getDocumentURI

public java.lang.String getDocumentURI()
                                throws DataModelException
Description copied from interface: Node
Returns the URI of the document.

Specified by:
getDocumentURI in interface Node
Throws:
DataModelException

getBaseURI

public java.lang.String getBaseURI()
Description copied from interface: Node
Accessor dm:base-uri().

Specified by:
getBaseURI in interface Node

children

public NodeSequence children()
Description copied from interface: Node
Accessor dm:children. Returns the children in document order.

Only for Document and Elements: other kinds return an empty sequence.

Specified by:
children in interface Node

attributes

public NodeSequence attributes()
Description copied from interface: Node
Accessor dm:attributes. Only for Elements: other kinds return an empty sequence.

Specified by:
attributes in interface Node

getDefinedNSCount

public int getDefinedNSCount()
Description copied from interface: Node
Number of Namespaces defined on this particular node.

Specified by:
getDefinedNSCount in interface Node

namespaces

public NodeSequence namespaces(boolean inScope)
Description copied from interface: Node
Accessor dm:namespaces(). According to the parameter, returns in-scope namespaces for this node, or namespaces defined by this node. On non-element nodes, always returns the empty sequence.

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

docPosition

public int docPosition()
                throws DataModelException
Description copied from interface: Node
Returns an arbitrary value that is stable on the whole document (for order comparison).

Specified by:
docPosition in interface Node
Throws:
DataModelException

getNature

public int getNature()
              throws DataModelException
Description copied from interface: Node
Returns a numeric node kind: DOCUMENT, ELEMENT etc.

Specified by:
getNature in interface Node
Throws:
DataModelException

isElement

public boolean isElement()
                  throws DataModelException
Description copied from interface: Node
Convenience: quick test of elements.

Specified by:
isElement in interface Node
Throws:
DataModelException

isAtom

public boolean isAtom()
               throws DataModelException
Description copied from interface: Node
Convenience: quick test of atomic nodes (text, comment, typed atoms).

Specified by:
isAtom in interface Node
Throws:
DataModelException

document

public Node document()
              throws DataModelException
Description copied from interface: Node
Returns the document node if any, else the top-level node.

Specified by:
document in interface Node
Throws:
DataModelException

toString

public java.lang.String toString()

attribute

public Node attribute(QName name)
               throws DataModelException
Description copied from interface: Node
Gets an attribute [of this element] by name.

Specified by:
attribute in interface Node
Returns:
An attribute node; null if not found or not applied to an element.
Throws:
DataModelException

getNsPrefix

public java.lang.String getNsPrefix(java.lang.String nsuri)
                             throws DataModelException
Description copied from interface: Node
Returns a matching prefix for the Namespace by looking up the namespace nodes on this element and its ancestors.

Specified by:
getNsPrefix in interface Node
Returns:
the first suitable prefix, otherwise null if none is found.
Throws:
DataModelException

getNsUri

public java.lang.String getNsUri(java.lang.String prefix)
                          throws DataModelException
Description copied from interface: Node
Returns a matching Namespace for the prefix by looking up the namespace nodes on this element and its ancestors.

Specified by:
getNsUri in interface Node
Returns:
the first suitable namespace URI, otherwise null if none is found.
Throws:
DataModelException

orderCompare

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

Specified by:
orderCompare in interface Node

contains

public boolean contains(Node node)
Description copied from interface: Node
Returns true if this node is an ancestor of the parameter node or the node itself.

Specified by:
contains in interface Node

getNodeSpan

public int getNodeSpan()
                throws DataModelException
Throws:
DataModelException

getNodeDepth

public int getNodeDepth()
                 throws DataModelException
Throws:
DataModelException

equals

public boolean equals(java.lang.Object that)

hashCode

public int hashCode()

deepEqual

public boolean deepEqual(Node node,
                         java.text.Collator collator)
                  throws DataModelException
Throws:
DataModelException

compareStringValues

public int compareStringValues(Node node,
                               java.text.Collator collator)
                        throws DataModelException
Description copied from interface: Node
Compares the string values of two nodes, optionally using a collation.

Specified by:
compareStringValues in interface Node
Throws:
DataModelException

ancestors

public NodeSequence ancestors(NodeTest nodeTest)
Description copied from interface: Node
Returns an iterator on ancestors that match the node test.

Specified by:
ancestors in interface Node
Parameters:
nodeTest - concrete classes are BaseNodeTest, UnionNodeTest.

ancestorsOrSelf

public NodeSequence ancestorsOrSelf(NodeTest nodeTest)
Description copied from interface: Node
Returns an iterator on ancestors (including the node itself) that match the node test.

Specified by:
ancestorsOrSelf in interface Node
Parameters:
nodeTest - concrete classes are BaseNodeTest, UnionNodeTest.

parent

public NodeSequence parent(NodeTest nodeTest)
Description copied from interface: Node
Returns a sequence of length 1 (if the parent matches the nodeTest) else 0.

Specified by:
parent in interface Node

children

public NodeSequence children(NodeTest nodeTest)
Description copied from interface: Node
Returns an iterator on children that match the node test.

Specified by:
children in interface Node

descendants

public NodeSequence descendants(NodeTest nodeTest)
Description copied from interface: Node
Returns an iterator on descendants that match the node test.

Specified by:
descendants in interface Node

descendantsOrSelf

public NodeSequence descendantsOrSelf(NodeTest nodeTest)
Description copied from interface: Node
Returns an iterator on descendants (including the node itself) that match the node test.

Specified by:
descendantsOrSelf in interface Node

attributes

public NodeSequence attributes(NodeTest nodeTest)
Description copied from interface: Node
Returns an iterator on attributes that match the node test.

Specified by:
attributes in interface Node

followingSiblings

public NodeSequence followingSiblings(NodeTest nodeTest)
Description copied from interface: Node
Returns an iterator on following siblings that match the node test.

Specified by:
followingSiblings in interface Node

precedingSiblings

public NodeSequence precedingSiblings(NodeTest nodeTest)
Description copied from interface: Node
Returns an iterator on preceding siblings (in document order) that match the node test.

Specified by:
precedingSiblings in interface Node

following

public NodeSequence following(NodeTest nodeTest)
Description copied from interface: Node
Returns an iterator on following nodes that match the node test.

Specified by:
following in interface Node

preceding

public NodeSequence preceding(NodeTest nodeTest)
Description copied from interface: Node
Returns an iterator preceding nodes (in document order) that match the node test.

Specified by:
preceding in interface Node

addChild

public void addChild(Node child)

addAttribute

public void addAttribute(Node attribute)

addText

public void addText(java.lang.String value)
Description copied from interface: Node
Adds text inside the node. For an element, creates a text child node if necessary.

Caution: Some implementations do not support modification and can raise a run-time exception.

Specified by:
addText in interface Node

getChars

public char[] getChars()
                throws DataModelException
Description copied from interface: Node
Gets text contents as a char array. Applicable only to text nodes, PI nodes and attributes.

Specified by:
getChars in interface Node
Throws:
DataModelException

getValue

public java.lang.Object getValue()
                          throws DataModelException
Description copied from interface: Node
Returns the value of an atomic node.

Specified by:
getValue in interface Node
Returns:
Generally a String, but for typed atoms it is an object of class Boolean (ATOM_BOOL), Long (ATOM_INT), Double (ATOM_BOOL) or any class (ATOM_ANY).
Throws:
DataModelException

getIntegerValue

public long getIntegerValue()
                     throws DataModelException
Description copied from interface: Node
Returns the integer value (attempts to convert).

Specified by:
getIntegerValue in interface Node
Throws:
DataModelException - if not convertible to integer.

© 2005 Axyana Software