📄 dtm.java
字号:
/** * Return the public identifier of the external subset, * normalized as described in 4.2.2 External Entities [XML]. If there is * no external subset or if it has no public identifier, this property * has no value. * * @return the public identifier String object, or null if there is none. */ public String getDocumentTypeDeclarationPublicIdentifier(); /** * Returns the <code>Element</code> whose <code>ID</code> is given by * <code>elementId</code>. If no such element exists, returns * <code>DTM.NULL</code>. Behavior is not defined if more than one element * has this <code>ID</code>. Attributes (including those * with the name "ID") are not of type ID unless so defined by DTD/Schema * information available to the DTM implementation. * Implementations that do not know whether attributes are of type ID or * not are expected to return <code>DTM.NULL</code>. * * <p>%REVIEW% Presumably IDs are still scoped to a single document, * and this operation searches only within a single document, right? * Wouldn't want collisions between DTMs in the same process.</p> * * @param elementId The unique <code>id</code> value for an element. * @return The handle of the matching element. */ public int getElementById(String elementId); /** * The getUnparsedEntityURI function returns the URI of the unparsed * entity with the specified name in the same document as the context * node (see [3.3 Unparsed Entities]). It returns the empty string if * there is no such entity. * <p> * XML processors may choose to use the System Identifier (if one * is provided) to resolve the entity, rather than the URI in the * Public Identifier. The details are dependent on the processor, and * we would have to support some form of plug-in resolver to handle * this properly. Currently, we simply return the System Identifier if * present, and hope that it a usable URI or that our caller can * map it to one. * %REVIEW% Resolve Public Identifiers... or consider changing function name. * <p> * If we find a relative URI * reference, XML expects it to be resolved in terms of the base URI * of the document. The DOM doesn't do that for us, and it isn't * entirely clear whether that should be done here; currently that's * pushed up to a higher level of our application. (Note that DOM Level * 1 didn't store the document's base URI.) * %REVIEW% Consider resolving Relative URIs. * <p> * (The DOM's statement that "An XML processor may choose to * completely expand entities before the structure model is passed * to the DOM" refers only to parsed entities, not unparsed, and hence * doesn't affect this function.) * * @param name A string containing the Entity Name of the unparsed * entity. * * @return String containing the URI of the Unparsed Entity, or an * empty string if no such entity exists. */ public String getUnparsedEntityURI(String name); // ============== Boolean methods ================ /** * Return true if the xsl:strip-space or xsl:preserve-space was processed * during construction of the document contained in this DTM. * * NEEDSDOC ($objectName$) @return */ public boolean supportsPreStripping(); /** * Figure out whether nodeHandle2 should be considered as being later * in the document than nodeHandle1, in Document Order as defined * by the XPath model. This may not agree with the ordering defined * by other XML applications. * <p> * There are some cases where ordering isn't defined, and neither are * the results of this function -- though we'll generally return true. * <p> * %REVIEW% Make sure this does the right thing with attribute nodes!!! * <p> * %REVIEW% Consider renaming for clarity. Perhaps isDocumentOrder(a,b)? * * @param firstNodeHandle DOM Node to perform position comparison on. * @param secondNodeHandle DOM Node to perform position comparison on. * * @return false if secondNode comes before firstNode, otherwise return true. * You can think of this as * <code>(firstNode.documentOrderPosition <= secondNode.documentOrderPosition)</code>. */ public boolean isNodeAfter(int firstNodeHandle, int secondNodeHandle); /** * 2. [element content whitespace] A boolean indicating whether a * text node represents white space appearing within element content * (see [XML], 2.10 "White Space Handling"). Note that validating * XML processors are required by XML 1.0 to provide this * information... but that DOM Level 2 did not support it, since it * depends on knowledge of the DTD which DOM2 could not guarantee * would be available. * <p> * If there is no declaration for the containing element, an XML * processor must assume that the whitespace could be meaningful and * return false. If no declaration has been read, but the [all * declarations processed] property of the document information item * is false (so there may be an unread declaration), then the value * of this property is indeterminate for white space characters and * should probably be reported as false. It is always false for text * nodes that contain anything other than (or in addition to) white * space. * <p> * Note too that it always returns false for non-Text nodes. * <p> * %REVIEW% Joe wants to rename this isWhitespaceInElementContent() for clarity * * @param nodeHandle the node ID. * @return <code>true</code> if the node definitely represents whitespace in * element content; <code>false</code> otherwise. */ public boolean isCharacterElementContentWhitespace(int nodeHandle); /** * 10. [all declarations processed] This property is not strictly speaking * part of the infoset of the document. Rather it is an indication of * whether the processor has read the complete DTD. Its value is a * boolean. If it is false, then certain properties (indicated in their * descriptions below) may be unknown. If it is true, those properties * are never unknown. * * @param documentHandle A node handle that must identify a document. * @return <code>true</code> if all declarations were processed; * <code>false</code> otherwise. */ public boolean isDocumentAllDeclarationsProcessed(int documentHandle); /** * 5. [specified] A flag indicating whether this attribute was actually * specified in the start-tag of its element, or was defaulted from the * DTD (or schema). * * @param attributeHandle The attribute handle * @return <code>true</code> if the attribute was specified; * <code>false</code> if it was defaulted or the handle doesn't * refer to an attribute node. */ public boolean isAttributeSpecified(int attributeHandle); // ========== Direct SAX Dispatch, for optimization purposes ======== /** * 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). Multiple calls to the * ContentHandler's characters methods may well occur for a single call to * this method. * * @param nodeHandle The node ID. * @param ch A non-null reference to a ContentHandler. * @param normalize true if the content should be normalized according to * the rules for the XPath * <a href="http://www.w3.org/TR/xpath#function-normalize-space">normalize-space</a> * function. * * @throws org.xml.sax.SAXException */ public void dispatchCharactersEvents( int nodeHandle, org.xml.sax.ContentHandler ch, boolean normalize) throws org.xml.sax.SAXException; /** * Directly create SAX parser events representing the XML content of * a DTM subtree. This is a "serialize" operation. * * @param nodeHandle The node ID. * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException; /** * Return an DOM node for the given node. * * @param nodeHandle The node ID. * * @return A node representation of the DTM node. */ public org.w3c.dom.Node getNode(int nodeHandle); // ==== Construction methods (may not be supported by some implementations!) ===== // %REVIEW% What response occurs if not supported? /** * @return true iff we're building this model incrementally (eg * we're partnered with a CoroutineParser) and thus require that the * transformation and the parse run simultaneously. Guidance to the * DTMManager. */ public boolean needsTwoThreads(); // %REVIEW% Do these appends make any sense, should we support a // wider set of methods (like the "append" methods in the // current DTMDocumentImpl draft), or should we just support SAX // listener interfaces? Should it be a separate interface to // make that distinction explicit? /** * Return this DTM's content handler, if it has one. * * @return null if this model doesn't respond to SAX events. */ public org.xml.sax.ContentHandler getContentHandler(); /** * Return this DTM's lexical handler, if it has one. * * %REVIEW% Should this return null if constrution already done/begun? * * @return null if this model doesn't respond to lexical SAX events. */ public org.xml.sax.ext.LexicalHandler getLexicalHandler(); /** * Return this DTM's EntityResolver, if it has one. * * @return null if this model doesn't respond to SAX entity ref events. */ public org.xml.sax.EntityResolver getEntityResolver(); /** * Return this DTM's DTDHandler, if it has one. * * @return null if this model doesn't respond to SAX dtd events. */ public org.xml.sax.DTDHandler getDTDHandler(); /** * Return this DTM's ErrorHandler, if it has one. * * @return null if this model doesn't respond to SAX error events. */ public org.xml.sax.ErrorHandler getErrorHandler(); /** * Return this DTM's DeclHandler, if it has one. * * @return null if this model doesn't respond to SAX Decl events. */ public org.xml.sax.ext.DeclHandler getDeclHandler(); /** * Append a child to "the end of the document". Please note that * the node is always cloned in a base DTM, since our basic behavior * is immutable so nodes can't be removed from their previous * location. * * <p> %REVIEW% DTM maintains an insertion cursor which * performs a depth-first tree walk as nodes come in, and this operation * is really equivalent to: * insertionCursor.appendChild(document.importNode(newChild))) * where the insert point is the last element that was appended (or * the last one popped back to by an end-element operation).</p> * * @param newChild Must be a valid new node handle. * @param clone true if the child should be cloned into the document. * @param cloneDepth if the clone argument is true, specifies that the * clone should include all it's children. */ public void appendChild(int newChild, boolean clone, boolean cloneDepth); /** * Append a text node child that will be constructed from a string, * to the end of the document. Behavior is otherwise like appendChild(). * * @param str Non-null reference to a string. */ public void appendTextChild(String str); /** * Get the location of a node in the source document. * * @param node an <code>int</code> value * @return a <code>SourceLocator</code> value or null if no location * is available */ public SourceLocator getSourceLocatorFor(int node); /** * As the DTM is registered with the DTMManager, this method * will be called. This will give the DTM implementation a * chance to initialize any subsystems that are required to * build the DTM */ public void documentRegistration(); /** * As documents are released from the DTMManager, the DTM implementation * will be notified of the event. This will allow the DTM implementation * to shutdown any subsystem activity that may of been assoiated with * the active DTM Implementation. */ public void documentRelease(); /** * Migrate a DTM built with an old DTMManager to a new DTMManager. * After the migration, the new DTMManager will treat the DTM as * one that is built by itself. * This is used to support DTM sharing between multiple transformations. * @param manager the DTMManager */ public void migrateTo(DTMManager manager);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -