|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
**For internal use only**
DTM
is an XML document model expressed as a table rather than
an object tree. It attempts to provide an interface to a parse tree that
has very little object creation.
Nodes in the DTM are identified by integer "handles". A handle must be unique within a document. A processing application must be careful, because a handle is not unique within a process... you can have two handles that belong to different documents. It is up to the calling application to keep track of the association of a document with it's handle.
Namespace URLs, local-names, and expanded-names can all be represented by integer ID values. An expanded name is made of a combination of the URL ID in the high two bytes, and the local-name ID is held in the low two bytes. Thus a comparison of an expanded name can be quickly made in a single operation. Also, the symbol space for URLs and local-names must be limited to 32K each (if you are to only use positive values for index lookup), which means that these should not be part of a general string pool mechanism. Note that the namespace URL id can be 0, which should have the meaning that the namespace is null. Zero should also not be used for a local-name index.
The model of the tree, as well as the general navigation model, is that of XPath 1.0, for the moment. The model will be adapted to match the XPath 2.0 data model, XML Schema, and InfoSet.
DTM does _not_ directly support the W3C's Document Object Model. However, it attempts to come close enough that an implementation of DTM can be created that wraps a DOM.
State: In progress!!
Field Summary | |
static short |
ATTRIBUTE_NODE
The node is an Attr . |
static short |
CDATA_SECTION_NODE
The node is a CDATASection . |
static short |
COMMENT_NODE
The node is a Comment . |
static short |
DOCUMENT_FRAGMENT_NODE
The node is a DocumentFragment . |
static short |
DOCUMENT_NODE
The node is a Document . |
static short |
DOCUMENT_TYPE_NODE
The node is a DocumentType . |
static short |
ELEMENT_NODE
The node is an Element . |
static short |
ENTITY_NODE
The node is an Entity . |
static short |
ENTITY_REFERENCE_NODE
The node is an EntityReference . |
static short |
NAMESPACE_NODE
The node is a namespace node . |
static short |
NOTATION_NODE
The node is a Notation . |
static short |
PROCESSING_INSTRUCTION_NODE
The node is a ProcessingInstruction . |
static short |
TEXT_NODE
The node is a Text node. |
Method Summary | |
void |
dispatchCharactersEvents(int nodeHandle,
ContentHandler ch)
Directly call the characters method on the passed ContentHandler for the string-value of the given node (see http://www.w3.org/TR/xpath#data-model for the definition of a node's string-value). |
void |
dispatchToEvents(int nodeHandle,
ContentHandler ch)
Directly create SAX parser events from a subtree. |
boolean |
getDocumentAllDeclarationsProcessed()
Return an indication of whether the processor has read the complete DTD. |
java.lang.String |
getDocumentBaseURI(int nodeHandle)
Return the base URI of the document entity. |
java.lang.String |
getDocumentEncoding(int nodeHandle)
Return the name of the character encoding scheme in which the document entity is expressed. |
java.lang.String |
getDocumentStandalone(int nodeHandle)
Return an indication of the standalone status of the document, either "yes" or "no". |
int |
getDocumentSystemIdentifier(int nodeHandle)
Return the system identifier of the document entity. |
int |
getDocumentTypeDeclarationPublicIdentifier()
Return the public identifier of the external subset, normalized as described in 4.2.2 External Entities [XML]. |
java.lang.String |
getDocumentTypeDeclarationSystemIdentifier()
A document type declaration information item has the following properties: 1. |
java.lang.String |
getDocumentVersion(int documentHandle)
Return a string representing the XML version of the document. |
int |
getExpandedNameID(int nodeHandle)
Given a node handle, return an ID that represents the node's expanded name. |
int |
getExpandedNameID(java.lang.String namespace,
java.lang.String localName)
Given an expanded name, return an ID. |
int |
getFirstAttribute(int nodeHandle)
Given a node handle, get the index of the node's first attribute. |
int |
getFirstChild(int nodeHandle)
Given a node handle, get the handle of the node's first child. |
int |
getFirstNamespaceNode(int nodeHandle,
boolean inScope)
Given a node handle, get the index of the node's first child. |
int |
getLastChild(int nodeHandle)
Given a node handle, advance to its last child. |
short |
getLevel(int nodeHandle)
**For internal use only** Get the depth level of this node in the tree (equals 1 for a parentless node). |
java.lang.String |
getLocalName(int nodeHandle)
Given a node handle, return its DOM-style localname. |
java.lang.String |
getLocalNameFromExpandedNameID(int ExpandedNameID)
Given an expanded-name ID, return the local name part. |
java.lang.String |
getNamespaceFromExpandedNameID(int ExpandedNameID)
Given an expanded-name ID, return the namespace URI part. |
java.lang.String |
getNamespaceURI(int nodeHandle)
Given a node handle, return its DOM-style namespace URI (As defined in Namespaces, this is the declared URI which this node's prefix -- or default in lieu thereof -- was mapped to.) |
int |
getNextAttribute(int nodeHandle)
Given a node handle, advance to the next attribute. |
int |
getNextDescendant(int subtreeRootHandle,
int nodeHandle)
Given a node handle, advance to its next descendant. |
int |
getNextFollowing(int axisContextHandle,
int nodeHandle)
Given a node handle, advance to the next node on the following axis. |
int |
getNextNamespaceNode(int namespaceHandle,
boolean inScope)
Given a namespace handle, advance to the next namespace. |
int |
getNextPreceding(int axisContextHandle,
int nodeHandle)
Given a node handle, advance to the next node on the preceding axis. |
int |
getNextSibling(int nodeHandle)
Given a node handle, advance to its next sibling. |
java.lang.String |
getNodeName(int nodeHandle)
Given a node handle, return its DOM-style node name. |
int |
getNodeType(int nodeHandle)
Given a node handle, return its DOM-style node type. |
java.lang.String |
getNodeValue(int nodeHandle)
Given a node handle, return its node value. |
int |
getParent(int nodeHandle)
Given a node handle, find its parent node. |
java.lang.String |
getPrefix(int nodeHandle)
Given a node handle, return its DOM-style name prefix. |
int |
getPreviousSibling(int nodeHandle)
Given a node handle, find its preceeding sibling. |
java.lang.String |
getStringValue(int nodeHandle)
Get the string-value of a node as a String object (see http://www.w3.org/TR/xpath#data-model for the definition of a node's string-value). |
char[] |
getStringValueChunk(int nodeHandle,
int chunkIndex,
int[] startAndLen)
Get a character array chunk in the string-value of a node. |
int |
getStringValueChunkCount(int nodeHandle)
Get number of character array chunks in the string-value of a node. |
boolean |
isAttributeSpecified(int attributeHandle)
5. |
boolean |
isCharacterElementContentWhitespace(int nodeHandle)
2. |
boolean |
isDocumentAllDeclarationsProcessed(int documentHandle)
10. |
boolean |
isNodeAfter(int nodeHandle1,
int nodeHandle2)
Figure out whether nodeHandle2 should be considered as being later in the document than nodeHandle1, in Document Order as defined by the XPath model. |
void |
setFeature(java.lang.String featureId,
boolean state)
Set an implementation dependent feature. |
void |
setParseBlockSize(int blockSizeSuggestion)
Set a suggested parse block size for the parser. |
Field Detail |
public static final short ELEMENT_NODE
Element
.public static final short ATTRIBUTE_NODE
Attr
.public static final short TEXT_NODE
Text
node.public static final short CDATA_SECTION_NODE
CDATASection
.public static final short ENTITY_REFERENCE_NODE
EntityReference
.public static final short ENTITY_NODE
Entity
.public static final short PROCESSING_INSTRUCTION_NODE
ProcessingInstruction
.public static final short COMMENT_NODE
Comment
.public static final short DOCUMENT_NODE
Document
.public static final short DOCUMENT_TYPE_NODE
DocumentType
.public static final short DOCUMENT_FRAGMENT_NODE
DocumentFragment
.public static final short NOTATION_NODE
Notation
.public static final short NAMESPACE_NODE
namespace node
.Method Detail |
public void setParseBlockSize(int blockSizeSuggestion)
blockSizeSuggestion
- Suggested size of the parse blocks, in bytes.public void setFeature(java.lang.String featureId, boolean state)
featureId
- A feature URL.state
- true if this feature should be on, false otherwise.public int getFirstChild(int nodeHandle)
nodeHandle
- int Handle of the node..public int getLastChild(int nodeHandle)
nodeHandle
- int Handle of the node..public int getFirstAttribute(int nodeHandle)
nodeHandle
- int Handle of the node..public int getFirstNamespaceNode(int nodeHandle, boolean inScope)
nodeHandle
- handle to node, which should probably be an element
node, but need not be.inScope
- true if all namespaces in scope should be returned,
false if only the namespace declarations should be
returned.public int getNextSibling(int nodeHandle)
nodeHandle
- int Handle of the node..public int getPreviousSibling(int nodeHandle)
postition
- int Handle of the node..nodeHandle
- the id of the node.public int getNextAttribute(int nodeHandle)
nodeHandle
- int Handle of the node..public int getNextNamespaceNode(int namespaceHandle, boolean inScope)
namespaceHandle
- handle to node which must be of type NAMESPACE_NODE.public int getNextDescendant(int subtreeRootHandle, int nodeHandle)
subtreeRootNodeHandle
- nodeHandle
- int Handle of the node..public int getNextFollowing(int axisContextHandle, int nodeHandle)
axisContextHandle
- the start of the axis that is being traversed.nodeHandle
- public int getNextPreceding(int axisContextHandle, int nodeHandle)
axisContextHandle
- the start of the axis that is being traversed.nodeHandle
- the id of the node.public int getParent(int nodeHandle)
postition
- int Handle of the node..nodeHandle
- the id of the node.public java.lang.String getStringValue(int nodeHandle)
nodeHandle
- The node ID.public int getStringValueChunkCount(int nodeHandle)
nodeHandle
- The node ID.public char[] getStringValueChunk(int nodeHandle, int chunkIndex, int[] startAndLen)
nodeHandle
- The node ID.chunkIndex
- Which chunk to get.startAndLen
- An array of 2 where the start position and length of
the chunk will be returned.public int getExpandedNameID(int nodeHandle)
nodeHandle
- The handle to the node in question.public int getExpandedNameID(java.lang.String namespace, java.lang.String localName)
nodeHandle
- The handle to the node in question.public java.lang.String getLocalNameFromExpandedNameID(int ExpandedNameID)
ExpandedNameID
- an ID that represents an expanded-name.public java.lang.String getNamespaceFromExpandedNameID(int ExpandedNameID)
ExpandedNameID
- an ID that represents an expanded-name.public java.lang.String getNodeName(int nodeHandle)
nodeHandle
- the id of the node.public java.lang.String getLocalName(int nodeHandle)
nodeHandle
- the id of the node.public java.lang.String getPrefix(int nodeHandle)
postition
- int Handle of the node..nodeHandle
- the id of the node.public java.lang.String getNamespaceURI(int nodeHandle)
postition
- int Handle of the node..nodeHandle
- the id of the node.public java.lang.String getNodeValue(int nodeHandle)
postition
- int Handle of the node..nodeHandle
- The node id.public int getNodeType(int nodeHandle)
postition
- int Handle of the node..nodeHandle
- The node id.public short getLevel(int nodeHandle)
nodeHandle
- The node id.public java.lang.String getDocumentBaseURI(int nodeHandle)
nodeHandle
- The node id, which can be any valid node handle.public int getDocumentSystemIdentifier(int nodeHandle)
nodeHandle
- The node id, which can be any valid node handle.public java.lang.String getDocumentEncoding(int nodeHandle)
nodeHandle
- The node id, which can be any valid node handle.public java.lang.String getDocumentStandalone(int nodeHandle)
nodeHandle
- The node id, which can be any valid node handle.public java.lang.String getDocumentVersion(int documentHandle)
the
- document handlepublic boolean getDocumentAllDeclarationsProcessed()
true
if all declarations were processed;
false
otherwise.public java.lang.String getDocumentTypeDeclarationSystemIdentifier()
public int getDocumentTypeDeclarationPublicIdentifier()
the
- document type declaration handlepublic boolean isNodeAfter(int nodeHandle1, int nodeHandle2)
There are some cases where ordering isn't defined, and neither are the results of this function -- though we'll generally return true. TODO: Make sure this does the right thing with attribute nodes!!!
node1
- DOM Node to perform position comparison on.node2
- DOM Node to perform position comparison on .(node1.documentOrderPosition <= node2.documentOrderPosition)
.public boolean isCharacterElementContentWhitespace(int nodeHandle)
nodeHandle
- the node ID.true
if the character data is whitespace;
false
otherwise.public boolean isDocumentAllDeclarationsProcessed(int documentHandle)
the
- document handledocumentHandle
- A node handle that must identify a document.true
if all declarations were processed;
false
otherwise.public boolean isAttributeSpecified(int attributeHandle)
the
- attribute handle
NEEDSDOC @param attributeHandletrue
if the attribute was specified;
false
if it was defaulted.public void dispatchCharactersEvents(int nodeHandle, ContentHandler ch) throws SAXException
nodeHandle
- The node ID.ch
- A non-null reference to a ContentHandler.public void dispatchToEvents(int nodeHandle, ContentHandler ch) throws SAXException
nodeHandle
- The node ID.ch
- A non-null reference to a ContentHandler.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |