| org.apache.xml.dtm.ref.sax2dtm.SAX2DTM org.apache.xml.dtm.ref.sax2dtm.SAX2RTFDTM
SAX2RTFDTM | public class SAX2RTFDTM extends SAX2DTM (Code) | | This is a subclass of SAX2DTM which has been modified to meet the needs of
Result Tree Frameworks (RTFs). The differences are:
1) Multiple XML trees may be appended to the single DTM. This means
that the root node of each document is _not_ node 0. Some code has
had to be deoptimized to support this mode of operation, and an
explicit mechanism for obtaining the Node Handle of the root node
has been provided.
2) A stack of these documents is maintained, allowing us to "tail-prune" the
most recently added trees off the end of the DTM as stylesheet elements
(and thus variable contexts) are exited.
PLEASE NOTE that this class may be _heavily_ dependent upon the
internals of the SAX2DTM superclass, and must be maintained in
parallel with that code. Arguably, they should be conditionals
within a single class... but they have deen separated for
performance reasons. (In fact, one could even argue about which is
the superclass and which is the subclass; the current arrangement
is as much about preserving stability of existing code during
development as anything else.)
%REVIEW% In fact, since the differences are so minor, I think it
may be possible/practical to fold them back into the base
SAX2DTM. Consider that as a future code-size optimization.
|
Method Summary | |
protected int | _documentRoot(int nodeIdentifier) Given a node identifier, find the owning document node. | public void | endDocument() Receive notification of the end of the document.
%REVIEW% Y'know, this isn't all that much of a deoptimization. | public int | getDocument() Given a DTM, find the owning document node. | public int | getDocumentRoot(int nodeHandle) Given a node handle, find the owning document node, using DTM semantics
(Document owns itself) rather than DOM semantics (Document has no owner).
(I'm counting on the fact that getOwnerDocument() is implemented on top
of this call, in the superclass, to avoid having to rewrite that one.
Be careful if that code changes!)
Parameters: nodeHandle - the id of the node. | public boolean | isTreeIncomplete() | public boolean | popRewindMark() "Tail-pruning" support for RTFs.
This function pops the information previously saved by
pushRewindMark (which see) and uses it to discard all nodes added
to the DTM after that time. | public void | pushRewindMark() "Tail-pruning" support for RTFs.
This function pushes information about the current size of the
DTM's data structures onto a stack, for use by popRewindMark()
(which see).
%REVIEW% I have no idea how to rewind m_elemIndexes. | public void | startDocument() Receive notification of the beginning of a new RTF document.
%REVIEW% Y'know, this isn't all that much of a deoptimization. |
m_emptyCharsCount | int m_emptyCharsCount(Code) | | Tail-pruning mark: initial number of characters in use
|
m_emptyDataCount | int m_emptyDataCount(Code) | | Tail-pruning mark: initial number of data items in use
|
m_emptyDataQNCount | int m_emptyDataQNCount(Code) | | Tail-pruning mark: default initial number of dataOrQName slots in use
|
m_emptyNSDeclSetCount | int m_emptyNSDeclSetCount(Code) | | Tail-pruning mark: initial number of namespace declaration sets
|
m_emptyNSDeclSetElemsCount | int m_emptyNSDeclSetElemsCount(Code) | | Tail-pruning mark: initial number of namespace declaration elements
|
m_emptyNodeCount | int m_emptyNodeCount(Code) | | Tail-pruning mark: initial number of nodes in use
|
mark_char_size | IntStack mark_char_size(Code) | | Tail-pruning mark: Number of size-of-data fields in use
|
mark_data_size | IntStack mark_data_size(Code) | | Tail-pruning mark: Number of data items in use
|
mark_doq_size | IntStack mark_doq_size(Code) | | Tail-pruning mark: Number of dataOrQName slots in use
|
mark_nsdeclelem_size | IntStack mark_nsdeclelem_size(Code) | | Tail-pruning mark: Number of naespace declaration elements in use
%REVIEW% I don't think number of NS sets is ever different from number
of NS elements. We can probabably reduce these to a single stack and save
some storage.
|
mark_nsdeclset_size | IntStack mark_nsdeclset_size(Code) | | Tail-pruning mark: Number of namespace declaration sets in use
%REVIEW% I don't think number of NS sets is ever different from number
of NS elements. We can probabably reduce these to a single stack and save
some storage.
|
mark_size | IntStack mark_size(Code) | | Tail-pruning mark: Number of nodes in use
|
_documentRoot | protected int _documentRoot(int nodeIdentifier)(Code) | | Given a node identifier, find the owning document node. Unlike the DOM,
this considers the owningDocument of a Document to be itself. Note that
in shared DTMs this may not be zero.
Parameters: nodeIdentifier - the id of the starting node. int Node identifier of the root of this DTM tree |
endDocument | public void endDocument() throws SAXException(Code) | | Receive notification of the end of the document.
%REVIEW% Y'know, this isn't all that much of a deoptimization. We
might want to consider folding the start/endDocument changes back
into the main SAX2DTM so we don't have to expose so many fields
(even as Protected).
throws: SAXException - Any SAX exception, possiblywrapping another exception. See Also: org.xml.sax.ContentHandler.endDocument |
getDocument | public int getDocument()(Code) | | Given a DTM, find the owning document node. In the case of
SAX2RTFDTM, which may contain multiple documents, this returns
the most recently started document, or null if the DTM is
empty or no document is currently under construction.
%REVIEW% Should we continue to report the most recent after
construction has ended? I think not, given that it may have been
tail-pruned.
int Node handle of Document node, or null if this DTM does notcontain an "active" document. |
getDocumentRoot | public int getDocumentRoot(int nodeHandle)(Code) | | Given a node handle, find the owning document node, using DTM semantics
(Document owns itself) rather than DOM semantics (Document has no owner).
(I'm counting on the fact that getOwnerDocument() is implemented on top
of this call, in the superclass, to avoid having to rewrite that one.
Be careful if that code changes!)
Parameters: nodeHandle - the id of the node. int Node handle of owning document |
isTreeIncomplete | public boolean isTreeIncomplete()(Code) | | true if a DTM tree is currently under construction. |
popRewindMark | public boolean popRewindMark()(Code) | | "Tail-pruning" support for RTFs.
This function pops the information previously saved by
pushRewindMark (which see) and uses it to discard all nodes added
to the DTM after that time. We expect that this will allow us to
reuse storage more effectively.
This is _not_ intended to be called while a document is still being
constructed -- only between endDocument and the next startDocument
%REVIEW% WARNING: This is the first use of some of the truncation
methods. If Xalan blows up after this is called, that's a likely
place to check.
%REVIEW% Our original design for DTMs permitted them to share
string pools. If there any risk that this might be happening, we
can _not_ rewind and recover the string storage. One solution
might to assert that DTMs used for RTFs Must Not take advantage
of that feature, but this seems excessively fragile. Another, much
less attractive, would be to just let them leak... Nah.
true if and only if the pop completely emptied theRTF. That response is used when determining how to unspoolRTF-started-while-RTF-open situations. |
pushRewindMark | public void pushRewindMark()(Code) | | "Tail-pruning" support for RTFs.
This function pushes information about the current size of the
DTM's data structures onto a stack, for use by popRewindMark()
(which see).
%REVIEW% I have no idea how to rewind m_elemIndexes. However,
RTFs will not be indexed, so I can simply panic if that case
arises. Hey, it works...
|
startDocument | public void startDocument() throws SAXException(Code) | | Receive notification of the beginning of a new RTF document.
%REVIEW% Y'know, this isn't all that much of a deoptimization. We
might want to consider folding the start/endDocument changes back
into the main SAX2DTM so we don't have to expose so many fields
(even as Protected) and carry the additional code.
throws: SAXException - Any SAX exception, possiblywrapping another exception. See Also: org.xml.sax.ContentHandler.startDocument |
Methods inherited from org.apache.xml.dtm.ref.sax2dtm.SAX2DTM | protected int _dataOrQName(int identity)(Code)(Java Doc) protected void addNewDTMID(int nodeIndex)(Code)(Java Doc) protected int addNode(int type, int expandedTypeID, int parentIndex, int previousSibling, int dataOrPrefix, boolean canHaveFirstChild)(Code)(Java Doc) public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws SAXException(Code)(Java Doc) public void characters(char ch, int start, int length) throws SAXException(Code)(Java Doc) protected void charactersFlush()(Code)(Java Doc) public void clearCoRoutine()(Code)(Java Doc) public void clearCoRoutine(boolean callDoTerminate)(Code)(Java Doc) public void comment(char ch, int start, int length) throws SAXException(Code)(Java Doc) protected boolean declAlreadyDeclared(String prefix)(Code)(Java Doc) public void dispatchCharactersEvents(int nodeHandle, ContentHandler ch, boolean normalize) throws SAXException(Code)(Java Doc) public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException(Code)(Java Doc) public void elementDecl(String name, String model) throws SAXException(Code)(Java Doc) public void endCDATA() throws SAXException(Code)(Java Doc) public void endDTD() throws SAXException(Code)(Java Doc) public void endDocument() throws SAXException(Code)(Java Doc) public void endElement(String uri, String localName, String qName) throws SAXException(Code)(Java Doc) public void endEntity(String name) throws SAXException(Code)(Java Doc) public void endPrefixMapping(String prefix) throws SAXException(Code)(Java Doc) public void error(SAXParseException e) throws SAXException(Code)(Java Doc) public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException(Code)(Java Doc) public void fatalError(SAXParseException e) throws SAXException(Code)(Java Doc) public int getAttributeNode(int nodeHandle, String namespaceURI, String name)(Code)(Java Doc) public ContentHandler getContentHandler()(Code)(Java Doc) public DTDHandler getDTDHandler()(Code)(Java Doc) public DeclHandler getDeclHandler()(Code)(Java Doc) public String getDocumentTypeDeclarationPublicIdentifier()(Code)(Java Doc) public String getDocumentTypeDeclarationSystemIdentifier()(Code)(Java Doc) public int getElementById(String elementId)(Code)(Java Doc) public EntityResolver getEntityResolver()(Code)(Java Doc) public ErrorHandler getErrorHandler()(Code)(Java Doc) public String getFixedNames(int type)(Code)(Java Doc) public int getIdForNamespace(String uri)(Code)(Java Doc) public LexicalHandler getLexicalHandler()(Code)(Java Doc) public String getLocalName(int nodeHandle)(Code)(Java Doc) public String getNamespaceURI(int nodeHandle)(Code)(Java Doc) public String getNamespaceURI(String prefix)(Code)(Java Doc) protected int getNextNodeIdentity(int identity)(Code)(Java Doc) public String getNodeName(int nodeHandle)(Code)(Java Doc) public String getNodeNameX(int nodeHandle)(Code)(Java Doc) public String getNodeValue(int nodeHandle)(Code)(Java Doc) public int getNumberOfNodes()(Code)(Java Doc) public String getPrefix(int nodeHandle)(Code)(Java Doc) public String getPrefix(String qname, String uri)(Code)(Java Doc) public SourceLocator getSourceLocatorFor(int node)(Code)(Java Doc) public XMLString getStringValue(int nodeHandle)(Code)(Java Doc) public String getUnparsedEntityURI(String name)(Code)(Java Doc) public void ignorableWhitespace(char ch, int start, int length) throws SAXException(Code)(Java Doc) public void internalEntityDecl(String name, String value) throws SAXException(Code)(Java Doc) public boolean isAttributeSpecified(int attributeHandle)(Code)(Java Doc) public boolean isWhitespace(int nodeHandle)(Code)(Java Doc) public void migrateTo(DTMManager manager)(Code)(Java Doc) public boolean needsTwoThreads()(Code)(Java Doc) protected boolean nextNode()(Code)(Java Doc) public void notationDecl(String name, String publicId, String systemId) throws SAXException(Code)(Java Doc) public void processingInstruction(String target, String data) throws SAXException(Code)(Java Doc) public InputSource resolveEntity(String publicId, String systemId) throws SAXException(Code)(Java Doc) public void setDocumentLocator(Locator locator)(Code)(Java Doc) public void setIDAttribute(String id, int elem)(Code)(Java Doc) public void setIncrementalSAXSource(IncrementalSAXSource incrementalSAXSource)(Code)(Java Doc) public void setProperty(String property, Object value)(Code)(Java Doc) protected void setSourceLocation()(Code)(Java Doc) public void setUseSourceLocation(boolean useSourceLocation)(Code)(Java Doc) public void skippedEntity(String name) throws SAXException(Code)(Java Doc) public void startCDATA() throws SAXException(Code)(Java Doc) public void startDTD(String name, String publicId, String systemId) throws SAXException(Code)(Java Doc) public void startDocument() throws SAXException(Code)(Java Doc) public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException(Code)(Java Doc) public void startEntity(String name) throws SAXException(Code)(Java Doc) public void startPrefixMapping(String prefix, String uri) throws SAXException(Code)(Java Doc) public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException(Code)(Java Doc) public void warning(SAXParseException e) throws SAXException(Code)(Java Doc)
|
|
|