Class TinyDocumentImpl

All Implemented Interfaces:
Source, SourceLocator, DocumentInfo, ExtendedNodeInfo, FingerprintedNode, Item, NodeInfo, ValueRepresentation

public final class TinyDocumentImpl extends TinyParentNodeImpl implements DocumentInfo
A node in the XML parse tree representing the Document itself (or equivalently, the root node of the Document).

  • Constructor Details

    • TinyDocumentImpl

      public TinyDocumentImpl(TinyTree tree)
  • Method Details

    • getTree

      public TinyTree getTree()
      Get the tree containing this node
    • setConfiguration

      public void setConfiguration(Configuration config)
      Set the Configuration that contains this document
    • getConfiguration

      public Configuration getConfiguration()
      Get the configuration previously set using setConfiguration
      Specified by:
      getConfiguration in interface NodeInfo
      Overrides:
      getConfiguration in class TinyNodeImpl
      Returns:
      the Configuration
    • setSystemId

      public void setSystemId(String uri)
      Set the system id of this node
      Specified by:
      setSystemId in interface Source
      Overrides:
      setSystemId in class TinyNodeImpl
    • getSystemId

      public String getSystemId()
      Get the system id of this root node
      Specified by:
      getSystemId in interface NodeInfo
      Specified by:
      getSystemId in interface Source
      Specified by:
      getSystemId in interface SourceLocator
      Overrides:
      getSystemId in class TinyNodeImpl
      Returns:
      the System Identifier of the entity in the source document containing the node, or null if not known or not applicable.
    • setBaseURI

      public void setBaseURI(String uri)
      Set the base URI of this document node
    • getBaseURI

      public String getBaseURI()
      Get the base URI of this root node.
      Specified by:
      getBaseURI in interface NodeInfo
      Overrides:
      getBaseURI in class TinyNodeImpl
      Returns:
      the base URI of the node. This may be null if the base URI is unknown.
    • getLineNumber

      public int getLineNumber()
      Get the line number of this root node.
      Specified by:
      getLineNumber in interface NodeInfo
      Specified by:
      getLineNumber in interface SourceLocator
      Overrides:
      getLineNumber in class TinyNodeImpl
      Returns:
      0 always
    • getNodeKind

      public final int getNodeKind()
      Return the type of node.
      Specified by:
      getNodeKind in interface NodeInfo
      Returns:
      Type.DOCUMENT (always)
      See Also:
    • getParent

      public NodeInfo getParent()
      Find the parent node of this node.
      Specified by:
      getParent in interface NodeInfo
      Overrides:
      getParent in class TinyNodeImpl
      Returns:
      The Node object describing the containing element or root node.
    • getRoot

      public NodeInfo getRoot()
      Get the root node
      Specified by:
      getRoot in interface NodeInfo
      Overrides:
      getRoot in class TinyNodeImpl
      Returns:
      the NodeInfo that is the root of the tree - not necessarily a document node
    • getDocumentRoot

      public DocumentInfo getDocumentRoot()
      Get the root (document) node
      Specified by:
      getDocumentRoot in interface NodeInfo
      Overrides:
      getDocumentRoot in class TinyNodeImpl
      Returns:
      the DocumentInfo representing the document node, or null if the root of the tree is not a document node
    • generateId

      public void generateId(FastStringBuffer buffer)
      Get a character string that uniquely identifies this node
      Specified by:
      generateId in interface NodeInfo
      Overrides:
      generateId in class TinyNodeImpl
      Parameters:
      buffer - to contain an identifier based on the document number
    • getAllElements

      AxisIterator getAllElements(int fingerprint)
      Get a list of all elements with a given name. This is implemented as a memo function: the first time it is called for a particular element type, it remembers the result for next time.
    • getElementList

      List getElementList(int fingerprint)
      Get a list containing all the elements with a given element name
      Parameters:
      fingerprint - the fingerprint of the element name
      Returns:
      list a List containing the TinyElementImpl objects
    • registerID

      void registerID(NodeInfo e, String id)
      Register a unique element ID. Fails if there is already an element with that ID.
      Parameters:
      e - The NodeInfo (always an element) having a particular unique ID value
      id - The unique ID value. The caller is responsible for checking that this is a valid NCName.
    • selectID

      public NodeInfo selectID(String id)
      Get the element with a given ID.
      Specified by:
      selectID in interface DocumentInfo
      Parameters:
      id - The unique ID of the required element, previously registered using registerID()
      Returns:
      The NodeInfo (always an Element) for the given ID if one has been registered, otherwise null.
    • setUnparsedEntity

      void setUnparsedEntity(String name, String uri, String publicId)
      Set an unparsed entity URI associated with this document. For system use only, while building the document.
    • getUnparsedEntity

      public String[] getUnparsedEntity(String name)
      Get the unparsed entity with a given nameID if there is one, or null if not. If the entity does not exist, return null.
      Specified by:
      getUnparsedEntity in interface DocumentInfo
      Parameters:
      name - the name of the entity
      Returns:
      if the entity exists, return an array of two Strings, the first holding the system ID of the entity, the second holding the public
    • copy

      public void copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId) throws XPathException
      Copy this node to a given outputter
      Specified by:
      copy in interface NodeInfo
      Parameters:
      out - the Receiver to which the node should be copied
      whichNamespaces - in the case of an element, controls which namespace nodes should be copied. Values are NodeInfo.NO_NAMESPACES, NodeInfo.LOCAL_NAMESPACES, NodeInfo.ALL_NAMESPACES
      copyAnnotations - indicates whether the type annotations of element and attribute nodes should be copied
      locationId - If non-zero, identifies the location of the instruction that requested this copy. If zero, indicates that the location information for the original node is to be copied; in this case the Receiver must be a LocationCopier
      Throws:
      XPathException
    • showSize

      public void showSize()