dtmdefaultbase.java

来自「JAVA 所有包」· Java 代码 · 共 2,066 行 · 第 1/5 页

JAVA
2,066
字号
   * @return The character array reference where the chunk occurs.   */  public char[] getStringValueChunk(int nodeHandle, int chunkIndex,                                    int[] startAndLen)  {    // %TBD%    error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"getStringValueChunk not yet supported!");    return null;  }  /**   * Given a node handle, return an ID that represents the node's expanded name.   *   * @param nodeHandle The handle to the node in question.   *   * @return the expanded-name id of the node.   */  public int getExpandedTypeID(int nodeHandle)  {    // %REVIEW% This _should_ only be null if someone asked the wrong DTM about the node...    // which one would hope would never happen...    int id=makeNodeIdentity(nodeHandle);    if(id==NULL)      return NULL;    return _exptype(id);  }  /**   * Given an expanded name, return an ID.  If the expanded-name does not   * exist in the internal tables, the entry will be created, and the ID will   * be returned.  Any additional nodes that are created that have this   * expanded name will use this ID.   *   * @param type The simple type, i.e. one of ELEMENT, ATTRIBUTE, etc.   *   * @param namespace The namespace URI, which may be null, may be an empty   *                  string (which will be the same as null), or may be a   *                  namespace URI.   * @param localName The local name string, which must be a valid   *                  <a href="http://www.w3.org/TR/REC-xml-names/">NCName</a>.   *   * @return the expanded-name id of the node.   */  public int getExpandedTypeID(String namespace, String localName, int type)  {    ExpandedNameTable ent = m_expandedNameTable;    return ent.getExpandedTypeID(namespace, localName, type);  }  /**   * Given an expanded-name ID, return the local name part.   *   * @param expandedNameID an ID that represents an expanded-name.   * @return String Local name of this node.   */  public String getLocalNameFromExpandedNameID(int expandedNameID)  {    return m_expandedNameTable.getLocalName(expandedNameID);  }  /**   * Given an expanded-name ID, return the namespace URI part.   *   * @param expandedNameID an ID that represents an expanded-name.   * @return String URI value of this node's namespace, or null if no   * namespace was resolved.   */  public String getNamespaceFromExpandedNameID(int expandedNameID)  {    return m_expandedNameTable.getNamespace(expandedNameID);  }  /**   * Returns the namespace type of a specific node   * @param nodeHandle the id of the node.   * @return the ID of the namespace.   */  public int getNamespaceType(final int nodeHandle)  {    int identity = makeNodeIdentity(nodeHandle);    int expandedNameID = _exptype(identity);    return m_expandedNameTable.getNamespaceID(expandedNameID);  }  /**   * Given a node handle, return its DOM-style node name. This will   * include names such as #text or #document.   *   * @param nodeHandle the id of the node.   * @return String Name of this node, which may be an empty string.   * %REVIEW% Document when empty string is possible...   * %REVIEW-COMMENT% It should never be empty, should it?   */  public abstract String getNodeName(int nodeHandle);  /**   * Given a node handle, return the XPath node name.  This should be   * the name as described by the XPath data model, NOT the DOM-style   * name.   *   * @param nodeHandle the id of the node.   * @return String Name of this node, which may be an empty string.   */  public String getNodeNameX(int nodeHandle)  {    /** @todo: implement this com.sun.org.apache.xml.internal.dtm.DTMDefaultBase abstract method */    error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"Not yet supported!");    return null;  }  /**   * Given a node handle, return its XPath-style localname.   * (As defined in Namespaces, this is the portion of the name after any   * colon character).   *   * @param nodeHandle the id of the node.   * @return String Local name of this node.   */  public abstract String getLocalName(int nodeHandle);  /**   * Given a namespace handle, return the prefix that the namespace decl is   * mapping.   * Given a node handle, return the prefix used to map to the namespace.   *   * <p> %REVIEW% Are you sure you want "" for no prefix?  </p>   * <p> %REVIEW-COMMENT% I think so... not totally sure. -sb  </p>   *   * @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)  {  	if (nodeHandle == DTM.NULL)  	return DTM.NULL;    return m_expandedNameTable.getType(_exptype(makeNodeIdentity(nodeHandle)));  }  /**   * 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   * @xsl.usage internal   */  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);  }    /**   * Get the identity of this node in the tree    *   * @param nodeHandle The node handle.   * @return the node identity   * @xsl.usage internal   */  public int getNodeIdent(int nodeHandle)  {    /*if (nodeHandle != DTM.NULL)      return nodeHandle & m_mask;    else       return DTM.NULL;*/            return makeNodeIdentity(nodeHandle);   }    /**   * Get the handle of this node in the tree    *   * @param nodeId The node identity.   * @return the node handle   * @xsl.usage internal   */  public int getNodeHandle(int nodeId)  {    /*if (nodeId != DTM.NULL)      return nodeId | m_dtmIdent;    else       return DTM.NULL;*/            return makeNodeHandle(nodeId);  }  // ============== 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 version This 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>.   * @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.   * @xsl.usage internal   */  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.   *   * @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 

⌨️ 快捷键说明

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