jd.xml.xpath.model.build.normal
Class RootNode

java.lang.Object
  extended byjd.xml.xpath.model.build.AbstractXPathNode
      extended byjd.xml.xpath.model.build.normal.Node
          extended byjd.xml.xpath.model.build.normal.TreeNode
              extended byjd.xml.xpath.model.build.normal.CompositeNode
                  extended byjd.xml.xpath.model.build.normal.RootNode
All Implemented Interfaces:
XPathNode, XPathRootNode

final class RootNode
extends CompositeNode
implements XPathRootNode

An implementation for the XPath root node.


Field Summary
protected  TreeNode firstChild_
           
static String MODEL_NAME
           
protected  TreeNode next_
           
protected  CompositeNode parent_
           
protected  TreeNode previous_
           
protected  int serialNumber_
           
 
Fields inherited from interface jd.xml.xpath.model.XPathNode
ATTRIBUTE, COMMENT, ELEMENT, NAMESPACE, PI, ROOT, TEXT, TYPE_NAMES, TYPES, UNKNOWN
 
Constructor Summary
RootNode(String baseUri, NodeNamePool nodeNamePool, int documentId)
           
 
Method Summary
 void accept(NodeVisitor visitor)
          Dispatch method for NodeVisitors.
(package private)  void addUnparsedEntity(String name, String systemId)
           
 void cleanup()
          Release any resources allocated by the model.
 int compareToNode(XPathNode node)
          Compare to another XPathNode from the same document.
(package private)  Node copy(CompositeNode parent)
           
(package private)  Node createCopy()
           
 boolean equalsNode(XPathNode node)
          Test if the node equals the given node.
 XPathNode getCacheableNode()
          Return this.
 int getChildCount()
          Return 0.
 String getDocumentBaseUri()
          Return the base uri of document.
 int getDocumentId()
          Return an integer that identifies the document to which this node belongs.
 XPathNode getElementForId(String id)
          Return the element with the given ID.
 XPathNode getFirstChild()
          Return the first child.
(package private)  Node getFirstChildImpl()
          Return null.
 XPathRootNode getFragment(String fragmentId)
          Build a fragment with this node as document node.
 String getGlobalId()
          Return an unique identifier for the node.
 String getGlobalId(int serialNumber)
          Generate a unique id for the serialNumber
 int getLineNumber()
          Return the line number of this node in a source document.
(package private)  int getLineNumber(Node node)
          Return the line number of the node in a source document.
 int getLocalId()
          Return a number for the node that is unique within the document.
 String getModelName()
          Return the name of the XPath model implementation.
 NamespaceContext getNamespaceContext()
          Return the namespace context of the node.
 XPathNode getNextSibling()
          Return the next XPathNode sibling.
 NodeNamePool getNodeNamePool()
          Return null.
 XPathNode getParent()
          Return the parent XPathNode.
 XPathNode getPrevSibling()
          Return the previous XPathNode sibling.
 XPathRootNode getRoot()
          Return the root.
 String getTextValue()
          Return the concatenation of the value of all text node descendants.
 int getType()
          Return the type.
 String getUnparsedEntityUri(String entityName)
          Return the unparsed-entity-uri of the unparsed entity with the specified name.
 String getValue()
          Return the string value of this node.
(package private)  void increaseChildCount()
           
(package private)  boolean isComplexElement()
           
 boolean preserveSpace()
          Return if a text child with whitespace text should be preserved.
(package private)  void setFirstChild(TreeNode child)
           
(package private)  void setIdElement(String id, ElementNode element)
          Map an id to an element
(package private)  void setLineNumberMap(LineNumberMap map)
           
(package private)  void setNextSibling(TreeNode node)
           
(package private)  void setSerialNumber(int serialNumber)
           
 String toString()
          Return a string representation of the node.
 
Methods inherited from class jd.xml.xpath.model.build.AbstractXPathNode
equals, getAttributes, getBaseUri, getFirstSibling, getInheritedAttribute, getLanguage, getLocalName, getName, getNamespaceNodes, getNamespaceUri, getNodeName, getPrefix, getTypeName, hashCode, hasName, hasNamespaceUri, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jd.xml.xpath.model.XPathNode
compareToNode, equals, equalsNode, getAttributes, getBaseUri, getCacheableNode, getChildCount, getFirstChild, getFirstSibling, getGlobalId, getLanguage, getLineNumber, getLocalId, getLocalName, getName, getNamespaceContext, getNamespaceNodes, getNamespaceUri, getNextSibling, getNodeName, getParent, getPrefix, getPrevSibling, getTypeName, hashCode, hasName, hasNamespaceUri
 

Field Detail

MODEL_NAME

public static final String MODEL_NAME
See Also:
Constant Field Values

firstChild_

protected TreeNode firstChild_

next_

protected TreeNode next_

previous_

protected TreeNode previous_

parent_

protected CompositeNode parent_

serialNumber_

protected int serialNumber_
Constructor Detail

RootNode

public RootNode(String baseUri,
                NodeNamePool nodeNamePool,
                int documentId)
Method Detail

getType

public int getType()
Return the type.

Specified by:
getType in interface XPathNode
Returns:
a type constant

getRoot

public XPathRootNode getRoot()
Return the root.

Specified by:
getRoot in interface XPathNode
Overrides:
getRoot in class Node

getValue

public String getValue()
Return the string value of this node.

Specified by:
getValue in interface XPathNode

getElementForId

public XPathNode getElementForId(String id)
Return the element with the given ID. This is the value of its attribute that is declared in the DTD as type ID.

Specified by:
getElementForId in interface XPathRootNode
Returns:
the element node or null if no such element exists.

setIdElement

void setIdElement(String id,
                  ElementNode element)
Map an id to an element


getUnparsedEntityUri

public String getUnparsedEntityUri(String entityName)
Return the unparsed-entity-uri of the unparsed entity with the specified name.

Specified by:
getUnparsedEntityUri in interface XPathRootNode
Returns:
the uri or null if there is no such entity.

addUnparsedEntity

void addUnparsedEntity(String name,
                       String systemId)

getDocumentId

public int getDocumentId()
Return an integer that identifies the document to which this node belongs.

Specified by:
getDocumentId in interface XPathRootNode

getGlobalId

public String getGlobalId(int serialNumber)
Generate a unique id for the serialNumber

Parameters:
serialNumber - the serialNumber of a node in this document.
Returns:
the id which has the form "d" + documentId + "n" + serialNumber

getDocumentBaseUri

public String getDocumentBaseUri()
Return the base uri of document.

Specified by:
getDocumentBaseUri in interface XPathRootNode

preserveSpace

public boolean preserveSpace()
Return if a text child with whitespace text should be preserved.

Specified by:
preserveSpace in class CompositeNode

getNodeNamePool

public NodeNamePool getNodeNamePool()
Return null.

Specified by:
getNodeNamePool in interface XPathRootNode
Returns:
the pool or null if no NamePool is used

getLineNumber

int getLineNumber(Node node)
Return the line number of the node in a source document.

Returns:
the line number or -1 if no line map was built when the document was parsed. The linenumber is only exact for element nodes.

setLineNumberMap

void setLineNumberMap(LineNumberMap map)

getFragment

public XPathRootNode getFragment(String fragmentId)
Build a fragment with this node as document node.

Specified by:
getFragment in interface XPathRootNode
Parameters:
fragmentId - the id of the element which will be the document element
Returns:
the new document or null if no such element exists.
Throws:
XPathException - if this node is not an element node

cleanup

public void cleanup()
Description copied from interface: XPathRootNode
Release any resources allocated by the model. The model should not be used after this method is called.

Specified by:
cleanup in interface XPathRootNode

accept

public void accept(NodeVisitor visitor)
Dispatch method for NodeVisitors.

Specified by:
accept in interface XPathNode

getModelName

public String getModelName()
Return the name of the XPath model implementation.

Specified by:
getModelName in interface XPathRootNode

toString

public String toString()
Return a string representation of the node.

Specified by:
toString in interface XPathNode
Specified by:
toString in class Node

isComplexElement

boolean isComplexElement()

getChildCount

public int getChildCount()
Return 0.

Specified by:
getChildCount in interface XPathNode
Overrides:
getChildCount in class AbstractXPathNode

increaseChildCount

void increaseChildCount()

getFirstChild

public final XPathNode getFirstChild()
Return the first child.

Specified by:
getFirstChild in interface XPathNode
Overrides:
getFirstChild in class AbstractXPathNode

getFirstChildImpl

Node getFirstChildImpl()
Return null.

Overrides:
getFirstChildImpl in class Node

setFirstChild

void setFirstChild(TreeNode child)

getTextValue

public String getTextValue()
Return the concatenation of the value of all text node descendants.


copy

Node copy(CompositeNode parent)
Overrides:
copy in class Node

getNextSibling

public final XPathNode getNextSibling()
Return the next XPathNode sibling.

Specified by:
getNextSibling in interface XPathNode
Overrides:
getNextSibling in class Node

getPrevSibling

public final XPathNode getPrevSibling()
Return the previous XPathNode sibling.

Specified by:
getPrevSibling in interface XPathNode
Overrides:
getPrevSibling in class Node

setNextSibling

void setNextSibling(TreeNode node)

getParent

public XPathNode getParent()
Return the parent XPathNode.


getCacheableNode

public XPathNode getCacheableNode()
Return this.


getNamespaceContext

public NamespaceContext getNamespaceContext()
Return the namespace context of the node.


getLocalId

public int getLocalId()
Return a number for the node that is unique within the document.


getGlobalId

public String getGlobalId()
Return an unique identifier for the node.


equalsNode

public boolean equalsNode(XPathNode node)
Test if the node equals the given node.


compareToNode

public int compareToNode(XPathNode node)
Compare to another XPathNode from the same document. Return a negative or a positive integer as this node comes before or after the argument node in document order. Return zero if the node equal this node.


setSerialNumber

void setSerialNumber(int serialNumber)

createCopy

Node createCopy()

getLineNumber

public int getLineNumber()
Return the line number of this node in a source document.

Returns:
the line number or -1 if not known