Package gnu.xml
Class NodeTree
- All Implemented Interfaces:
Consumable,Consumer,PositionConsumer,XConsumer,Appendable,Consumer<Object>,DoubleConsumer,IntConsumer,LongConsumer
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
attrStart, BEGIN_ATTRIBUTE_LONG, BEGIN_ATTRIBUTE_LONG_SIZE, BEGIN_DOCUMENT, BEGIN_ELEMENT_LONG, BEGIN_ELEMENT_SHORT, BEGIN_ELEMENT_SHORT_INDEX_MAX, BEGIN_ENTITY, BEGIN_ENTITY_SIZE, data, docStart, DOCUMENT_URI, END_ATTRIBUTE_SIZE, END_DOCUMENT, END_ELEMENT_LONG, END_ELEMENT_SHORT, END_ENTITY, gapEnd, gapStart, INT_FOLLOWS, MAX_CHAR_SHORT, objects, oindex, POSITION_PAIR_FOLLOWS, PROCESSING_INSTRUCTIONFields inherited from class gnu.lists.AbstractSequence
noInts -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintancestorAttribute(int ipos, String namespace, String name) Look for matching attribute in ancestor or self.gnu.kawa.io.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.getIteratorAtPos(int ipos) intLook for an element with matching ID.static NodeTreemake()voidintnextPos(int position) Return the next position following the argument.intposFirstChild(int ipos) booleanposHasAttributes(int ipos) booleanposIsDefaultNamespace(int ipos, String namespaceURI) posLocalName(int ipos) posLookupNamespaceURI(int ipos, String prefix) posLookupPrefix(int ipos, String namespaceURI) posNamespaceURI(int ipos) posPrefix(int ipos) posTarget(int ipos) Get the target of a process-instruction.intstableCompare(AbstractSequence other) This is used for the XML concept of "document order".toString()typedValue(int ipos) Return the type-value of the node at the specified position.Methods inherited from class gnu.lists.TreeList
append, append, append, beginEntity, clear, compare, consume, consumeIRange, consumeNext, consumePosRange, createPos, createRelativePos, documentUriOfPos, dump, dump, dump, endAttribute, endDocument, endElement, endEntity, ensureSpace, find, firstAttributePos, firstChildPos, get, getAttributeCount, getIndexDifference, getIntN, getLongN, getNextKind, getNextKindI, getNextTypeObject, getPosNext, getPosNextInt, getPosPrevious, gotoAttributesStart, gotoAttributesStart, gotoChildrenStart, hashCode, hasNext, ignoring, isEmpty, nextDataIndex, nextIndex, nextMatching, nextNodeIndex, parentOrEntityI, parentOrEntityPos, parentPos, posToDataIndex, reserveObjects, setAttributeName, setElementName, setIntN, size, startAttribute, startAttribute, startDocument, startElement, startElement, statistics, statistics, stringValue, stringValue, stringValue, toString, write, write, write, write, writeBoolean, writeByte, writeCDATA, writeComment, writeComment, writeDocumentUri, writeDouble, writeFloat, writeInt, writeIntForce32, writeJoiner, writeLong, writeObject, writePosition, writePosition, writeProcessingInstruction, writeProcessingInstructionMethods inherited from class gnu.lists.AbstractSequence
add, add, addAll, addAll, addPos, asImmutable, badRank, boundedHash, checkCanWrite, checkRank, compare, compare, consume, contains, containsAll, copyPos, effectiveIndex, effectiveIndex, effectiveIndex, effectiveIndex, effectiveIndex, elements, endPos, equals, equals, fill, fill, fillPosRange, firstChildPos, fromEndIndex, get, get, get, get, getAttribute, getAttributeLength, getBooleanRaw, getByteRaw, getCharRaw, getContainingSequenceSize, getDoubleRaw, getElementKind, getFloatRaw, getInt, getInt, getInt, getInt, getInt, getIntRaw, getIterator, getIterator, getLongRaw, getLowBound, getNextTypeName, getRaw, getRowMajor, getShortRaw, getSize, getSize, gotoChildrenStart, gotoParent, hasPrevious, indexOf, isAfterPos, iterator, lastIndexOf, listIterator, listIterator, nextIndex, previousPos, rank, releasePos, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, setAt, setBuffer, setPosNext, setPosPrevious, setRaw, startPos, subList, subSequence, subSequencePos, toArray, toArray, unsupported, unsupportedExceptionMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.function.DoubleConsumer
andThenMethods inherited from interface java.util.function.IntConsumer
andThenMethods inherited from interface java.util.function.LongConsumer
andThen
-
Constructor Details
-
NodeTree
public NodeTree()
-
-
Method Details
-
nextPos
public int nextPos(int position) Description copied from class:AbstractSequenceReturn 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. -
make
-
getId
public int getId()Get/create a new unique number. -
stableCompare
Description copied from class:AbstractSequenceThis is used for the XML concept of "document order".- Overrides:
stableComparein classAbstractSequence<Object>
-
getIteratorAtPos
- Overrides:
getIteratorAtPosin classAbstractSequence<Object>
-
posNamespaceURI
-
posPrefix
-
posLocalName
-
posIsDefaultNamespace
-
posLookupNamespaceURI
-
posLookupPrefix
-
posFirstChild
public int posFirstChild(int ipos) -
posHasAttributes
public boolean posHasAttributes(int ipos) -
getAttribute
Find named attribute.- Parameters:
namespaceURI- need not be interned, or null which matches any namespacelocalName- need not be interned, or null which matches any local name- Returns:
- attribute ipos or 0
-
getAttributeI
Find named attribute.- Parameters:
namespaceURI- an interned String or null which matches any namespacelocalName- an interned String, or null which matches any local name- Returns:
- attribute ipos or 0
-
typedValue
Return the type-value of the node at the specified position. -
posTarget
Get the target of a process-instruction. -
ancestorAttribute
Look for matching attribute in ancestor or self.- Parameters:
namespace- namespaceURI (interned) of required attributename- 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. -
toString
- Overrides:
toStringin classAbstractSequence<Object>
-
makeIDtableIfNeeded
public void makeIDtableIfNeeded() -
lookupID
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 namexml:idare recognized has having theis-idproperty. Assumes makeIDtableIfNeeded has been called at soem point.
-