gnu.xml

Class NodeTree

Implemented Interfaces:
Consumable, Consumer, PositionConsumer, XConsumer

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.

Field Summary

Fields inherited from class gnu.lists.TreeList

BEGIN_ATTRIBUTE_LONG, BEGIN_DOCUMENT, END_DOCUMENT, END_GROUP_LONG, END_GROUP_SHORT, INT_FOLLOWS, POSITION_PAIR_FOLLOWS, PROCESSING_INSTRUCTION, attrStart, data, docStart, gapEnd, gapStart, objects, oindex

Method Summary

int
getId()
Get/create a new unique number.
SeqPosition
getIteratorAtPos(int ipos)
static NodeTree
make()
int
nextPos(int position)
Return the next position following the argument.
int
posFirstChild(int ipos)
boolean
posHasAttributes(int ipos)
boolean
posIsDefaultNamespace(int ipos, String namespaceURI)
String
posLocalName(int ipos)
String
posLookupNamespaceURI(int ipos, String prefix)
String
posLookupPrefix(int ipos, String namespaceURI)
String
posNamespaceURI(int ipos)
String
posPrefix(int ipos)
String
posTarget(int ipos)
Get the target of a process-instruction.
int
stableCompare(AbstractSequence other)
This is used for the XML concept of "document order".
String
toString()
Object
typedValue(int ipos)
Return the type-value of the node at the specified position.
void
writeObject(Object v)
If v is a node, make a copy of it.
void
writePosition(AbstractSequence seq, int ipos)

Methods inherited from class gnu.lists.TreeList

baseUriOfPos, beginAttribute, beginAttribute, beginDocument, beginGroup, beginGroup, clear, compare, consume, consume, consumeIRange, consumeNext, consumePosRange, createPos, createRelativePos, dump, dump, endAttribute, endDocument, endGroup, ensureSpace, find, find, firstAttributePos, firstChildPos, get, getIndexDifference, getIntN, getLongN, getNextKind, getNextTypeIndex, getNextTypeName, getNextTypeObject, getPosNext, getPosNextInt, getPosPrevious, gotoAttributesStart, gotoAttributesStart, gotoChildrenStart, hasNext, hashCode, ignoring, isEmpty, nextDataIndex, nextMatching, nextNodeIndex, nextPos, parentPos, posToDataIndex, resizeObjects, setIntN, size, statistics, statistics, stringValue, stringValue, toString, write, writeBaseUri, writeBoolean, writeByte, writeCDATA, writeChar, writeChars, writeComment, writeDouble, writeFloat, writeInt, writeLong, writeObject, writePosition, writeProcessingInstruction

Methods inherited from class gnu.lists.AbstractSequence

add, add, addAll, addAll, addPos, append, baseUriOfPos, clear, compare, compare, compare, consume, consumeNext, consumePosRange, contains, containsAll, copyPos, createPos, createRelativePos, elements, endPos, equals, equals, fill, fill, fillPosRange, firstAttributePos, firstChildPos, fromEndIndex, get, get, getAttribute, getAttributeLength, getContainingSequenceSize, getEffectiveIndex, getIndexDifference, getIterator, getIterator, getIteratorAtPos, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getPosNext, getPosPrevious, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hasNext, hasPrevious, hashCode, indexOf, isAfterPos, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextIndex, nextMatching, nextPos, parentPos, previousPos, rank, releasePos, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, setPosNext, setPosPrevious, size, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, toString, unsupported

Method Details

getId

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

getIteratorAtPos

public SeqPosition getIteratorAtPos(int ipos)
Overrides:
getIteratorAtPos in interface AbstractSequence

make

public static NodeTree make()

nextPos

public int nextPos(int position)
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 interface TreeList

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)
This is used for the XML concept of "document order".
Overrides:
stableCompare in interface AbstractSequence

toString

public String toString()
Overrides:
toString in interface AbstractSequence

typedValue

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

writeObject

public void writeObject(Object v)
If v is a node, make a copy of it.
Specified by:
writeObject in interface Consumer
Overrides:
writeObject in interface TreeList

writePosition

public void writePosition(AbstractSequence seq,
                          int ipos)
Specified by:
writePosition in interface PositionConsumer
Overrides:
writePosition in interface TreeList