Package gnu.xml

Class NodeTree

  • All Implemented Interfaces:
    Consumable, Consumer, PositionConsumer, XConsumer, java.lang.Appendable, java.util.function.Consumer<java.lang.Object>, java.util.function.DoubleConsumer, java.util.function.IntConsumer, java.util.function.LongConsumer

    public class NodeTree
    extends TreeList
    Use to represent a Document or Document Fragment, in the XML DOM sense. More compact than traditional DOM, since it uses many fewer objects.
    • Constructor Detail

      • NodeTree

        public NodeTree()
    • Method Detail

      • nextPos

        public int nextPos​(int position)
        Description copied from class: AbstractSequence
        Return the next position following the argument. The new position has the isAfter property. The argument is implicitly released (as in releasePos). Returns 0 if we are already at end of file.
        Overrides:
        nextPos in class TreeList
      • getId

        public int getId()
        Get/create a new unique number.
      • posNamespaceURI

        public java.lang.String posNamespaceURI​(int ipos)
      • posPrefix

        public java.lang.String posPrefix​(int ipos)
      • posLocalName

        public java.lang.String posLocalName​(int ipos)
      • posIsDefaultNamespace

        public boolean posIsDefaultNamespace​(int ipos,
                                             java.lang.String namespaceURI)
      • posLookupNamespaceURI

        public java.lang.String posLookupNamespaceURI​(int ipos,
                                                      java.lang.String prefix)
      • posLookupPrefix

        public java.lang.String posLookupPrefix​(int ipos,
                                                java.lang.String namespaceURI)
      • posFirstChild

        public int posFirstChild​(int ipos)
      • posHasAttributes

        public boolean posHasAttributes​(int ipos)
      • getAttribute

        public int getAttribute​(int parent,
                                java.lang.String namespaceURI,
                                java.lang.String localName)
        Find named attribute.
        Parameters:
        namespaceURI - need not be interned, or null which matches any namespace
        localName - need not be interned, or null which matches any local name
        Returns:
        attribute ipos or 0
      • getAttributeI

        public int getAttributeI​(int parent,
                                 java.lang.String namespaceURI,
                                 java.lang.String localName)
        Find named attribute.
        Parameters:
        namespaceURI - an interned String or null which matches any namespace
        localName - an interned String, or null which matches any local name
        Returns:
        attribute ipos or 0
      • typedValue

        public java.lang.Object typedValue​(int ipos)
        Return the type-value of the node at the specified position.
      • posTarget

        public java.lang.String posTarget​(int ipos)
        Get the target of a process-instruction.
      • ancestorAttribute

        public int ancestorAttribute​(int ipos,
                                     java.lang.String namespace,
                                     java.lang.String name)
        Look for matching attribute in ancestor or self.
        Parameters:
        namespace - namespaceURI (interned) of required attribute
        name - localName(interned) of required attribute
        Returns:
        attribute ipos or 0
      • baseUriOfPos

        public gnu.kawa.io.Path baseUriOfPos​(int pos,
                                             boolean resolveRelative)
        Return of the base-uri property, if known, of the node at pos.
      • makeIDtableIfNeeded

        public void makeIDtableIfNeeded()
      • lookupID

        public int lookupID​(java.lang.String name)
        Look for an element with matching ID. Returns an element ipos, or -1 if not found. Since we don't do any validation, for now only attributes with the name xml:id are recognized has having the is-id property. Assumes makeIDtableIfNeeded has been called at soem point.