gnu.xml

Class NodeTree

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.
Method Summary
intancestorAttribute(int ipos, String namespace, String name)
Look for matching attribute in ancestor or self.
PathbaseUriOfPos(int pos, boolean resolveRelative)
Return of the base-uri property, if known, of the node at pos.
intgetAttribute(int parent, String namespaceURI, String localName)
Find named attribute.
intgetAttributeI(int parent, String namespaceURI, String localName)
Find named attribute.
intgetId()
Get/create a new unique number.
SeqPositiongetIteratorAtPos(int ipos)
intlookupID(String name)
Look for an element with matching ID.
static NodeTreemake()
voidmakeIDtableIfNeeded()
intnextPos(int position)
intposFirstChild(int ipos)
booleanposHasAttributes(int ipos)
booleanposIsDefaultNamespace(int ipos, String namespaceURI)
StringposLocalName(int ipos)
StringposLookupNamespaceURI(int ipos, String prefix)
StringposLookupPrefix(int ipos, String namespaceURI)
StringposNamespaceURI(int ipos)
StringposPrefix(int ipos)
StringposTarget(int ipos)
Get the target of a process-instruction.
intstableCompare(AbstractSequence other)
StringtoString()
ObjecttypedValue(int ipos)
Return the type-value of the node at the specified position.

Method Detail

ancestorAttribute

public int ancestorAttribute(int ipos, String namespace, 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 Path baseUriOfPos(int pos, boolean resolveRelative)
Return of the base-uri property, if known, of the node at pos.

getAttribute

public int getAttribute(int parent, String namespaceURI, 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, String namespaceURI, 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

getId

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

getIteratorAtPos

public SeqPosition getIteratorAtPos(int ipos)

lookupID

public int lookupID(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 {@code xml:id} are recognized has having the {@code is-id} property. Assumes makeIDtableIfNeeded has been called at soem point.

make

public static NodeTree make()

makeIDtableIfNeeded

public void makeIDtableIfNeeded()

nextPos

public int nextPos(int position)

posFirstChild

public int posFirstChild(int ipos)

posHasAttributes

public boolean posHasAttributes(int ipos)

posIsDefaultNamespace

public boolean posIsDefaultNamespace(int ipos, String namespaceURI)

posLocalName

public String posLocalName(int ipos)

posLookupNamespaceURI

public String posLookupNamespaceURI(int ipos, String prefix)

posLookupPrefix

public String posLookupPrefix(int ipos, String namespaceURI)

posNamespaceURI

public String posNamespaceURI(int ipos)

posPrefix

public String posPrefix(int ipos)

posTarget

public String posTarget(int ipos)
Get the target of a process-instruction.

stableCompare

public int stableCompare(AbstractSequence other)

toString

public String toString()

typedValue

public Object typedValue(int ipos)
Return the type-value of the node at the specified position.