|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weblogic.apache.xerces.framework.XMLParser | +--weblogic.apache.xalan.xpath.dtm.DTM
DTM
is an XML document model expressed as a table rather than
an object tree. It attempts to be very compact, and to support very
specifically limited multitasking: users can start reading the document
while it's still being generated. (A work in progress...)
(***** The SAX handler calls, and the string-based XMLDocumentHandler methods, are known to be bad; they're included as hooks for the future.)
DTM does _not_ directly support the W3C's Document Object Model. However, it attempts to come close enough that a subset of DOM behavior can be implemented as proxy objects referencing the DTM.
This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.
DTMProxy
Field Summary | |
static java.lang.String |
DEFAULT_PREFIX_STR
|
protected int |
fAmpIndex
|
protected int |
fAposIndex
|
protected int |
fGtIndex
|
protected int |
fLtIndex
|
protected int |
fQuotIndex
|
Fields inherited from class weblogic.apache.xerces.framework.XMLParser |
fEntityHandler,
fErrorReporter,
fGrammarResolver,
fParseInProgress,
fScanner,
fStringPool,
fValidator,
SAX2_FEATURES_PREFIX,
SAX2_PROPERTIES_PREFIX,
XERCES_FEATURES_PREFIX,
XERCES_PROPERTIES_PREFIX |
Constructor Summary | |
DTM()
Construct a DTM. |
|
DTM(ProblemListener listener)
Construct a DTM. |
Method Summary | |
void |
attlistDecl(QName elementDecl,
QName attributeDecl,
int attType,
boolean attList,
java.lang.String enumString,
int attDefaultType,
int attDefaultValue)
callback for an attribute list declaration. |
void |
characters(char[] ch,
int start,
int length)
SAX API: Accept a chunk of characters for normalization into a Text node. |
void |
characters(char[] ch,
int start,
int length,
boolean cdataSection)
XMLDocumentHandler API: Accept a chunk of characters for normalization into a Text node. |
void |
characters(int dataIndex)
XMLDocumentHandler API: Accept a chunk of characters for normalization into a Text node. |
void |
comment(int dataIndex)
XMLDocumentHandler API: Create a Comment node. |
void |
display(int position)
DTM development API: Given a node index, write the node's contents in extremely terse form onto Standard Output. |
void |
dump()
DTM development API: display() all the nodes in the DTM. |
void |
dumpDTM()
|
void |
elementDecl(QName elementDecl,
int contentSpecType,
int contentSpecIndex,
XMLContentSpec.Provider contentSpecProvider)
<!ELEMENT Name contentspec> |
void |
endCDATA()
End CDATA section. |
void |
endDocument()
SAX API: End of Document reached. |
void |
endDTD()
This function will be called at the end of the DTD. |
void |
endElement(QName name)
XMLDocumentHandler API: End-tag reached. |
void |
endEntityReference(int entityName,
int entityType,
int entityContext)
End entity reference. |
void |
endNamespaceDeclScope(int prefix)
Report the end of the scope of a namespace declaration. |
void |
externalEntityDecl(int entityName,
int publicId,
int systemId)
<!ENTITY Name ExternalID> (external) |
void |
externalPEDecl(int entityName,
int publicId,
int systemId)
<!ENTITY % Name ExternalID> (external) |
protected void |
finalize()
|
void |
general_characters(int index)
Text-accumulator operation for the integer-index version of characters(). |
boolean |
getCreateEntityReferenceNodes()
|
org.w3c.dom.Document |
getDocument()
Return the document proxy object. |
int |
getFirstAttribute(int position)
DTM read API: Given a node index, get the index of the node's first child. |
int |
getFirstChild(int position)
DTM read API: Given a node index, get the index of the node's first child. |
org.w3c.dom.Element |
getIdentifier(java.lang.String id)
Get the element identified by the ID. |
int |
getLastChild(int position)
DTM read API: Given a node index, advance to its last child. |
java.lang.String |
getLocalName(int position)
DTM read API: Given a node index, return its DOM-style localname. |
java.lang.String |
getNamespaceURI(int position)
DTM read API: Given a node index, 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 position)
DTM read API: Given a node index, advance to the next attribute. |
int |
getNextDescendant(int parentPos,
int position)
DTM read API: Given a node index, advance to its next descendant. |
int |
getNextNode(int parentPos,
int position)
DTM read API: Given a node index, advance to its next sibling. |
int |
getNextPreceding(int startPos,
int position)
DTM read API: Given a node index, advance to the preceding node. |
int |
getNextSibling(int position)
DTM read API: Given a node index, advance to its next sibling. |
DTMProxy |
getNode(int pos)
Return a Node object that represents the index. |
java.lang.String |
getNodeName(int position)
DTM read API: Given a node index, return its DOM-style node name. |
int |
getNodeType(int position)
DTM read API: Given a node index, return its DOM-style node type. |
java.lang.String |
getNodeValue(int position)
DTM read API: Given a node index, return its node value. |
int |
getParent(int position)
DTM read API: Given a node index, find its parent node. |
int |
getPrecedingOrAncestorOrSelf(int position)
DTM read API: Given a node index, advance to the preceding node. |
java.lang.String |
getPrefix(int position)
DTM read API: Given a node index, return its DOM-style name prefix. |
int |
getPreviousSibling(int position)
DTM read API: Given a node index, find its preceeding sibling. |
StringPool |
getStringPool()
Make the string public. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
SAX API: Accept a chunk of characters for normalization into an ignorable-whitespace Text node. |
void |
ignorableWhitespace(char[] ch,
int start,
int length,
boolean cdataSection)
XMLDocumentHandler API: Accept a chunk of characters for normalization into an ignorable-whitespace Text node. |
void |
ignorableWhitespace(int dataIndex)
Ignorable whitespace. |
void |
ignorableWhitespace(int dataIndex,
boolean cdataSection)
XMLDocumentHandler API: Accept a chunk of characters for normalization into an ignorable-whitespace Text node. |
void |
internalEntityDecl(int entityName,
int entityValue)
<!ENTITY Name EntityValue> (internal) |
void |
internalPEDecl(int entityName,
int entityValue)
<!ENTITY % Name EntityValue> (internal) |
void |
internalSubset(int internalSubset)
Report when the internal subset is completely scanned. |
boolean |
isIgnorableText(int position)
DTM read API: Given a node index, indicate whether the parser marked it as an ignorable-whitespace text node. |
void |
notationDecl(int notationName,
int publicId,
int systemId)
<!NOTATION Name ExternalId> |
void |
processingInstruction(int target,
int data)
XMLDocumentHandler API: Create a PI node. |
void |
reset()
Override reset so it doesn't release the string pool. |
void |
run()
Run the parse thread. |
protected void |
setCreateEntityReferenceNodes(boolean create)
This feature determines whether entity references within the document are included in the document tree as EntityReference nodes. |
void |
setFeature(java.lang.String featureId,
boolean state)
Set the state of any feature in a SAX2 parser. |
void |
setInputSource(org.xml.sax.InputSource inputSource)
|
void |
setProblemListener(ProblemListener listener)
Set the current problem listener. |
void |
startCDATA()
Start CDATA section. |
void |
startDocument()
XMLDocumentHandler API: Start-of-document recieved. |
void |
startDocument(int versionIndex,
int encodingIndex,
int standAloneIndex)
XMLDocumentHandler API: Start-of-document recieved. |
void |
startDTD(int rootElementType,
int publicId,
int systemId)
This function will be called when a <!DOCTYPE...> declaration is encountered. |
void |
startDTD(QName rootElement,
int publicId,
int systemId)
callback for the start of the DTD This function will be called when a <!DOCTYPE...> declaration is encountered. |
void |
startElement(QName qname,
XMLAttrList xmlAttrList,
int attrListIndex)
XMLDocumentHandler API: Process element start-tag and its attributes. |
void |
startEntityReference(int entityName,
int entityType,
int entityContext)
Start entity reference. |
void |
startNamespaceDeclScope(int prefix,
int uri)
Report the start of the scope of a namespace declaration. |
void |
textDecl(int version,
int encoding)
Signal the Text declaration of an external entity. |
void |
unparsedEntityDecl(int entityName,
int publicId,
int systemId,
int notationName)
<!ENTITY Name ExternalID NDataDecl> (unparsed) |
void |
xmlDecl(int version,
int encoding,
int standalone)
Signal the XML declaration of a document |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final java.lang.String DEFAULT_PREFIX_STR
protected int fAmpIndex
protected int fLtIndex
protected int fGtIndex
protected int fAposIndex
protected int fQuotIndex
Constructor Detail |
public DTM()
parser
- HookedXMLParser Input event-stream source.public DTM(ProblemListener listener)
parser
- HookedXMLParser Input event-stream source.Method Detail |
public StringPool getStringPool()
public void setInputSource(org.xml.sax.InputSource inputSource)
public void setProblemListener(ProblemListener listener)
public void reset() throws java.lang.Exception
protected void finalize() throws java.lang.Throwable
public void run()
public final DTMProxy getNode(int pos)
public final void startDocument()
public final void startDocument(int versionIndex, int encodingIndex, int standAloneIndex)
public final void endDocument() throws org.xml.sax.SAXException
public final void startElement(QName qname, XMLAttrList xmlAttrList, int attrListIndex)
The mapping from namespace prefixes to namespace URIs is also performed at this time.
elementNameIndex
- int Index of element's qualified name in
symbol table.attrListIndex
- int Starting index of this element's attributes
in the parser's attribute table, or -1 to indicate no attributes.public final void endElement(QName name)
name
- int Index of element name in XML4J's symbol tablepublic final void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
ch
- char[] Input buffer in which string can be found.start
- int Offset to start of string, 0-based.length
- int Length of stringpublic void startDTD(QName rootElement, int publicId, int systemId) throws java.lang.Exception
rootElementType
- element handle for the root element of the documentpublicId
- string pool index of the DTD's public IDsystemId
- string pool index of the DTD's system IDpublic final void characters(char[] ch, int start, int length, boolean cdataSection) throws org.xml.sax.SAXException
Note that since XML4J may reuse its input buffers, we may need to either extract the string now or cache a copy of the buffer. It is unclear which approach is preferable
ch
- char[] Input buffer in which string can be found.start
- int Offset to start of string, 0-based.length
- int Length of stringcdataSection
- boolean True iff text was enclosed in public final void characters(int dataIndex) throws org.xml.sax.SAXException
dataIndex
- int Index of this string in XML4J's symbol tablescdataSection
- boolean True iff text was enclosed in public final void startCDATA() throws java.lang.Exception
public final void endCDATA() throws java.lang.Exception
public final void ignorableWhitespace(int dataIndex) throws java.lang.Exception
public final void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ch
- char[] Input buffer in which string can be found.start
- int Offset to start of string, 0-based.length
- int Length of stringpublic final void ignorableWhitespace(char[] ch, int start, int length, boolean cdataSection) throws org.xml.sax.SAXException
Note that since XML4J may reuse its input buffers, we may need to either extract the string now or cache a copy of the buffer. It is unclear which approach is preferable
ch
- char[] Input buffer in which string can be found.start
- int Offset to start of string, 0-based.length
- int Length of stringcdataSection
- boolean True iff text was enclosed in public final void ignorableWhitespace(int dataIndex, boolean cdataSection) throws org.xml.sax.SAXException
dataIndex
- int Index of this string in XML4J's symbol tablescdataSection
- boolean True iff text was enclosed in public final void general_characters(int index)
index
- int Index of this string in XML4J's symbol tables.
Note: Even though we are using XML4J's internal events rather than SAX, we must be prepared to normalize successive blocks of characters():
Note: Yes, the charChunks array grows monotonically during parsing, and does not shrink back down when the chunks are concatenated later in processing. Tough. I'm assuming that this is cheaper than allocating a separate array for every multichunk string, despite the block-copying that occurs when the array is grown.
KNOWN LIMITATION: DOESN'T PRESERVE CDATA FLAG. Since XSLT doesn't care about that flag, this is not a problem for our target application. It may be an issue if you try to reuse DTM elsewhere.
appendAccumulatedText
public final void comment(int dataIndex)
dataIndex
- int Index of comment's contents in XML4J's symbol tablepublic final void processingInstruction(int target, int data)
target
- int target processor name indexdata
- int Index of PI parameters to be passed to that processorpublic final void startNamespaceDeclScope(int prefix, int uri) throws java.lang.Exception
public final void endNamespaceDeclScope(int prefix) throws java.lang.Exception
public final void internalSubset(int internalSubset)
public final void startEntityReference(int entityName, int entityType, int entityContext) throws java.lang.Exception
public final void endEntityReference(int entityName, int entityType, int entityContext) throws java.lang.Exception
public void setFeature(java.lang.String featureId, boolean state) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
featureId
- The unique identifier (URI) of the feature.state
- The requested state of the feature (true or false).public void xmlDecl(int version, int encoding, int standalone) throws java.lang.Exception
version
- the handle in the string pool for the version numberencoding
- the handle in the string pool for the encodingstandalong
- the handle in the string pool for the standalone valuepublic void textDecl(int version, int encoding) throws java.lang.Exception
public final void startDTD(int rootElementType, int publicId, int systemId) throws java.lang.Exception
public final void endDTD() throws java.lang.Exception
public void elementDecl(QName elementDecl, int contentSpecType, int contentSpecIndex, XMLContentSpec.Provider contentSpecProvider) throws java.lang.Exception
public void attlistDecl(QName elementDecl, QName attributeDecl, int attType, boolean attList, java.lang.String enumString, int attDefaultType, int attDefaultValue) throws java.lang.Exception
elementType
- element handle for the attribute's elementattrName
- string pool index of the attribute nameattType
- type of attributeenumString
- String representing the values of the enumeration,
if the attribute is of enumerated type, or null if it is not.attDefaultType
- an integer value denoting the DefaultDecl valueattDefaultValue
- string pool index of this attribute's default value
or -1 if there is no defaultvaluepublic final org.w3c.dom.Element getIdentifier(java.lang.String id)
public final void internalPEDecl(int entityName, int entityValue) throws java.lang.Exception
public final void externalPEDecl(int entityName, int publicId, int systemId) throws java.lang.Exception
public final void internalEntityDecl(int entityName, int entityValue) throws java.lang.Exception
public final void externalEntityDecl(int entityName, int publicId, int systemId) throws java.lang.Exception
public final void unparsedEntityDecl(int entityName, int publicId, int systemId, int notationName) throws java.lang.Exception
public final void notationDecl(int notationName, int publicId, int systemId) throws java.lang.Exception
public final org.w3c.dom.Document getDocument()
public final int getFirstChild(int position)
postition
- int Index of this node's record.public final int getFirstAttribute(int position)
postition
- int Index of this node's record.public final int getNextAttribute(int position)
postition
- int Index of this node's record.public final int getLastChild(int position)
postition
- int Index of this node's record.public final int getNextSibling(int position)
postition
- int Index of this node's record.public final int getNextDescendant(int parentPos, int position)
postition
- int Index of this node's record.public final int getNextNode(int parentPos, int position)
postition
- int Index of this node's record.public final int getParent(int position)
postition
- int Index of this node's record.public final int getPreviousSibling(int position)
postition
- int Index of this node's record.public final int getNextPreceding(int startPos, int position)
startPos
- The position from where the axes is relative to.postition
- int Index of this node's record.public final int getPrecedingOrAncestorOrSelf(int position)
startPos
- The position from where the axes is relative to.postition
- int Index of this node's record.public final java.lang.String getNodeName(int position)
postition
- int Index of this node's record.public final java.lang.String getLocalName(int position)
postition
- int Index of this node's record.public final java.lang.String getPrefix(int position)
postition
- int Index of this node's record.public final java.lang.String getNamespaceURI(int position)
postition
- int Index of this node's record.public final java.lang.String getNodeValue(int position)
postition
- int Index of this node's record.public final int getNodeType(int position)
postition
- int Index of this node's record.public final boolean isIgnorableText(int position)
postition
- int Index of this node's record.public final void display(int position)
postition
- int Index of this node's record.public final void dump()
display
protected void setCreateEntityReferenceNodes(boolean create)
Note: The children of the entity reference are always added to the document. This feature only affects whether an EntityReference node is also included as the parent of the entity reference children.
create
- True to create entity reference nodes; false
to only insert the entity reference children.getCreateEntityReferenceNodes()
public final boolean getCreateEntityReferenceNodes()
setCreateEntityReferenceNodes(boolean)
public void dumpDTM()
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs60 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |