dtmdefaultbase.java

来自「java jdk 1.4的源码」· Java 代码 · 共 2,022 行 · 第 1/5 页

JAVA
2,022
字号
   * @param nodeHandle the id of the node.   * @return String prefix of this node's name, or "" if no explicit   * namespace prefix was given.   */  public abstract String getPrefix(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.)   *   * <p>%REVIEW% Null or ""? -sb</p>   *   * @param nodeHandle the id of the node.   * @return String URI value of this node's namespace, or null if no   * namespace was resolved.   */  public abstract String getNamespaceURI(int nodeHandle);  /**   * Given a node handle, return its node value. This is mostly   * as defined by the DOM, but may ignore some conveniences.   * <p>   *   * @param nodeHandle The node id.   * @return String Value of this node, or null if not   * meaningful for this node type.   */  public abstract String getNodeValue(int nodeHandle);  /**   * Given a node handle, return its DOM-style node type.   * <p>   * %REVIEW% Generally, returning short is false economy. Return int?   * %REVIEW% Make assumption that node has already arrived.  Is OK?   *   * @param nodeHandle The node id.   * @return int Node type, as per the DOM's Node._NODE constants.   */  public short getNodeType(int nodeHandle)  {    return m_expandedNameTable.getType(_exptype(makeNodeIdentity(nodeHandle)));   }  /**   * <meta name="usage" content="internal"/>   * Get the depth level of this node in the tree (equals 1 for   * a parentless node).   *   * @param nodeHandle The node id.   * @return the number of ancestors, plus one   */  public short getLevel(int nodeHandle)  {    // Apparently, the axis walker stuff requires levels to count from 1.    int identity = makeNodeIdentity(nodeHandle);    return (short) (_level(identity) + 1);  }  // ============== Document query functions ==============  /**   * Tests whether DTM DOM implementation implements a specific feature and   * that feature is supported by this node.   *   * @param feature The name of the feature to test.   * @param versionThis is the version number of the feature to test.   *   If the version is not   *   specified, supporting any version of the feature will cause the   *   method to return <code>true</code>.   * @param version The version string of the feature requested, may be null.   * @return Returns <code>true</code> if the specified feature is   *   supported on this node, <code>false</code> otherwise.   */  public boolean isSupported(String feature, String version)  {    // %TBD%    return false;  }  /**   * Return the base URI of the document entity. If it is not known   * (because the document was parsed from a socket connection or from   * standard input, for example), the value of this property is unknown.   *   * @return the document base URI String object or null if unknown.   */  public String getDocumentBaseURI()  {    return m_documentBaseURI;  }  /**   * Set the base URI of the document entity.   *   * @param baseURI the document base URI String object or null if unknown.   */  public void setDocumentBaseURI(String baseURI)  {    m_documentBaseURI = baseURI;  }  /**   * Return the system identifier of the document entity. If   * it is not known, the value of this property is unknown.   *   * @param nodeHandle The node id, which can be any valid node handle.   * @return the system identifier String object or null if unknown.   */  public String getDocumentSystemIdentifier(int nodeHandle)  {    // %REVIEW%  OK? -sb    return m_documentBaseURI;  }  /**   * Return the name of the character encoding scheme   *        in which the document entity is expressed.   *   * @param nodeHandle The node id, which can be any valid node handle.   * @return the document encoding String object.   */  public String getDocumentEncoding(int nodeHandle)  {    // %REVIEW%  OK??  -sb    return "UTF-8";  }  /**   * Return an indication of the standalone status of the document,   *        either "yes" or "no". This property is derived from the optional   *        standalone document declaration in the XML declaration at the   *        beginning of the document entity, and has no value if there is no   *        standalone document declaration.   *   * @param nodeHandle The node id, which can be any valid node handle.   * @return the document standalone String object, either "yes", "no", or null.   */  public String getDocumentStandalone(int nodeHandle)  {    return null;  }  /**   * Return a string representing the XML version of the document. This   * property is derived from the XML declaration optionally present at the   * beginning of the document entity, and has no value if there is no XML   * declaration.   *   * @param documentHandle The document handle   *   * @return the document version String object.   */  public String getDocumentVersion(int documentHandle)  {    return null;  }  /**   * Return 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.   *   * @return <code>true</code> if all declarations were processed;   *         <code>false</code> otherwise.   */  public boolean getDocumentAllDeclarationsProcessed()  {    // %REVIEW% OK?    return true;  }  /**   *   A document type declaration information item has the following properties:   *   *     1. [system identifier] The system identifier of the external subset, if   *        it exists. Otherwise this property has no value.   *   * @return the system identifier String object, or null if there is none.   */  public abstract String getDocumentTypeDeclarationSystemIdentifier();  /**   * 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.   *   * @param the document type declaration handle   *   * @return the public identifier String object, or null if there is none.   */  public abstract 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 abstract 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.   * TODO: 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.)   * TODO: 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 abstract String getUnparsedEntityURI(String name);  // ============== Boolean methods ================  /**   * Return true if the xsl:strip-space or xsl:preserve-space was processed   * during construction of the DTM document.   *   * @return true if this DTM supports prestripping.   */  public boolean supportsPreStripping()  {    return true;  }  /**   * 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 false.   *   * @param nodeHandle1 Node handle to perform position comparison on.   * @param nodeHandle2 Second Node handle to perform position comparison on .   *   * @return true if node1 comes before node2, otherwise return false.   * You can think of this as   * <code>(node1.documentOrderPosition &lt;= node2.documentOrderPosition)</code>.   */  public boolean isNodeAfter(int nodeHandle1, int nodeHandle2)  {		// These return NULL if the node doesn't belong to this document.    int index1 = makeNodeIdentity(nodeHandle1);    int index2 = makeNodeIdentity(nodeHandle2);    return index1!=NULL & index2!=NULL & index1 <= index2;  }  /**   *     2. [element content whitespace] A boolean indicating whether the   *        character is 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. If there is no   *        declaration for the containing element, this property has no value for   *        white space characters. 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 unknown for white space characters. It is always false for   *        characters that are not white space.   *   * @param nodeHandle the node ID.   * @return <code>true</code> if the character data is whitespace;   *         <code>false</code> otherwise.   */  public boolean isCharacterElementContentWhitespace(int nodeHandle)  {    // %TBD%    return false;  }  /**   *    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 the document handle   *   * @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)  {    return true;  }  /**   *     5. [specified] A flag indicating whether this attribute was actually   *        specified in the start-tag of its element, or was defaulted from the   *        DTD.   *   * @param attributeHandle The attribute handle in question.   *   * @return <code>true</code> if the attribute was specified;   *         <code>false</code> if it was defaulted.   */  public abstract 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 abstract void dispatchCharactersEvents(    int nodeHandle, org.xml.sax.ContentHandler ch, boolean normalize)      throws org.xml.sax.SAXException;  /**   * Directly create SAX parser events from a subtree.   *   * @param nodeHandle The node ID.   * @param ch A non-null reference to a ContentHandler.   *   * @throws org.xml.sax.SAXException   */  public abstract 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)  {    return new DTMNodeProxy(this, nodeHandle);  }  // ==== Construction methods (may not be supported by some implementations!) =====  /**   * Append a child to the end of the document. Please note that the node   * is always cloned if it is owned by another document.   *   * <p>%REVIEW% "End of the document" needs to be defined more clearly.   * Does it become the last ch

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?