dtmnodeproxy.java

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

JAVA
1,381
字号
   *   * @param offset   * @param count   *   * @throws DOMException   * @see org.w3c.dom.CharacterData   */  public final void deleteData(int offset, int count) throws DOMException  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   *   * @param offset   * @param count   * @param arg   *   * @throws DOMException   * @see org.w3c.dom.CharacterData   */  public final void replaceData(int offset, int count, String arg)    throws DOMException  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   *   * @return   * @see org.w3c.dom.Element   */  public final String getTagName()  {    return dtm.getNodeName(node);  }  /**   *   * @param name   *   * @return   * @see org.w3c.dom.Element   */  public final String getAttribute(String name)  {    DTMNamedNodeMap  map = new DTMNamedNodeMap(dtm, node);    Node node = map.getNamedItem(name);    return (null == node) ? null : node.getNodeValue();  }  /**   *   * @param name   * @param value   *   * @throws DOMException   * @see org.w3c.dom.Element   */  public final void setAttribute(String name, String value)    throws DOMException  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   *   * @param name   *   * @throws DOMException   * @see org.w3c.dom.Element   */  public final void removeAttribute(String name) throws DOMException  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   *   * @param name   *   * @return   * @see org.w3c.dom.Element   */  public final Attr getAttributeNode(String name)  {    DTMNamedNodeMap  map = new DTMNamedNodeMap(dtm, node);    return (Attr)map.getNamedItem(name);  }  /**   *   * @param newAttr   *   * @return   *   * @throws DOMException   * @see org.w3c.dom.Element   */  public final Attr setAttributeNode(Attr newAttr) throws DOMException  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   *   * @param oldAttr   *   * @return   *   * @throws DOMException   * @see org.w3c.dom.Element   */  public final Attr removeAttributeNode(Attr oldAttr) throws DOMException  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   * Introduced in DOM Level 2.   *   * @return   */  public boolean hasAttributes()  {    return DTM.NULL != dtm.getFirstAttribute(node);  }  /** @see org.w3c.dom.Element */  public final void normalize()  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   *   * @param namespaceURI   * @param localName   *   * @return   * @see org.w3c.dom.Element   */  public final String getAttributeNS(String namespaceURI, String localName)  {    DTMNamedNodeMap  map = new DTMNamedNodeMap(dtm, node);    Node node = map.getNamedItemNS(namespaceURI,localName);    return (null == node) ? null : node.getNodeValue();  }  /**   *   * @param namespaceURI   * @param qualifiedName   * @param value   *   * @throws DOMException   * @see org.w3c.dom.Element   */  public final void setAttributeNS(                                   String namespaceURI, String qualifiedName, String value)    throws DOMException  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   *   * @param namespaceURI   * @param localName   *   * @throws DOMException   * @see org.w3c.dom.Element   */  public final void removeAttributeNS(String namespaceURI, String localName)    throws DOMException  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   *   * @param namespaceURI   * @param localName   *   * @return   * @see org.w3c.dom.Element   */  public final Attr getAttributeNodeNS(String namespaceURI, String localName)  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   *   * @param newAttr   *   * @return   *   * @throws DOMException   * @see org.w3c.dom.Element   */  public final Attr setAttributeNodeNS(Attr newAttr) throws DOMException  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   *   * @return   * @see org.w3c.dom.Attr   */  public final String getName()  {    return dtm.getNodeName(node);  }  /**   *   * @return   * @see org.w3c.dom.Attr   */  public final boolean getSpecified()  {    // We really don't know which attributes might have come from the    // source document versus from the DTD. Treat them all as having    // been provided by the user.    // %REVIEW% if/when we become aware of DTDs/schemae.    return true;  }  /**   *   * @return   * @see org.w3c.dom.Attr   */  public final String getValue()  {    return dtm.getNodeValue(node);  }  /**   *   * @param value   * @see org.w3c.dom.Attr   */  public final void setValue(String value)  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   * Get the owner element of an attribute.   *   * @return   * @see org.w3c.dom.Attr as of DOM Level 2   */  public final Element getOwnerElement()  {    if (getNodeType() != Node.ATTRIBUTE_NODE)      return null;    // In XPath and DTM data models, unlike DOM, an Attr's parent is its    // owner element.    int newnode = dtm.getParent(node);    return (newnode == DTM.NULL) ? null : (Element)(dtm.getNode(newnode));  }  /**   * NEEDSDOC Method adoptNode    *   *   * NEEDSDOC @param source   *   * NEEDSDOC (adoptNode) @return   *   * @throws DOMException   */  public Node adoptNode(Node source) throws DOMException  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   * <p>EXPERIMENTAL! Based on the <a   * href='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.   * <p>   * An attribute specifying, as part of the XML declaration, the encoding   * of this document. This is <code>null</code> when unspecified.   * @since DOM Level 3   *   * NEEDSDOC ($objectName$) @return   */  public String getEncoding()  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   * <p>EXPERIMENTAL! Based on the <a   * href='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.   * <p>   * An attribute specifying, as part of the XML declaration, the encoding   * of this document. This is <code>null</code> when unspecified.   * @since DOM Level 3   *   * NEEDSDOC @param encoding   */  public void setEncoding(String encoding)  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   * <p>EXPERIMENTAL! Based on the <a   * href='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.   * <p>   * An attribute specifying, as part of the XML declaration, whether this   * document is standalone.   * @since DOM Level 3   *   * NEEDSDOC ($objectName$) @return   */  public boolean getStandalone()  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   * <p>EXPERIMENTAL! Based on the <a   * href='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.   * <p>   * An attribute specifying, as part of the XML declaration, whether this   * document is standalone.   * @since DOM Level 3   *   * NEEDSDOC @param standalone   */  public void setStandalone(boolean standalone)  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   * <p>EXPERIMENTAL! Based on the <a   * href='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.   * <p>   * An attribute specifying whether errors checking is enforced or not.   * When set to <code>false</code>, the implementation is free to not   * test every possible error case normally defined on DOM operations,   * and not raise any <code>DOMException</code>. In case of error, the   * behavior is undefined. This attribute is <code>true</code> by   * defaults.   * @since DOM Level 3   *   * NEEDSDOC ($objectName$) @return   */  public boolean getStrictErrorChecking()  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   * <p>EXPERIMENTAL! Based on the <a   * href='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.   * <p>   * An attribute specifying whether errors checking is enforced or not.   * When set to <code>false</code>, the implementation is free to not   * test every possible error case normally defined on DOM operations,   * and not raise any <code>DOMException</code>. In case of error, the   * behavior is undefined. This attribute is <code>true</code> by   * defaults.   * @since DOM Level 3   *   * NEEDSDOC @param strictErrorChecking   */  public void setStrictErrorChecking(boolean strictErrorChecking)  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   * <p>EXPERIMENTAL! Based on the <a   * href='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.   * <p>   * An attribute specifying, as part of the XML declaration, the version   * number of this document. This is <code>null</code> when unspecified.   * @since DOM Level 3   *   * NEEDSDOC ($objectName$) @return   */  public String getVersion()  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }  /**   * <p>EXPERIMENTAL! Based on the <a   * href='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.   * <p>   * An attribute specifying, as part of the XML declaration, the version   * number of this document. This is <code>null</code> when unspecified.   * @since DOM Level 3   *   * NEEDSDOC @param version   */  public void setVersion(String version)  {    throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);  }                  /** Inner class to support getDOMImplementation.   */  static class DTMNodeProxyImplementation implements DOMImplementation  {    public DocumentType createDocumentType(String qualifiedName,String publicId, String systemId)    {      throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);    }    public Document createDocument(String namespaceURI,String qualfiedName,DocumentType doctype)                            {      // Could create a DTM... but why, when it'd have to be permanantly empty?      throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);            }    /** Ask whether we support a given DOM feature.     *      * In fact, we do not _fully_ support any DOM feature -- we're a     * read-only subset -- so arguably we should always return false.     * On the other hand, it may be more practically useful to return     * true and simply treat the whole DOM as read-only, failing on the     * methods we can't support. I'm not sure which would be more useful     * to the caller.     */    public boolean hasFeature(String feature,String version)    {      if( ("CORE".equals(feature.toUpperCase()) || "XML".equals(feature.toUpperCase())) 					&&           ("1.0".equals(version) || "2.0".equals(version))          )        return true;      return false;    }  }}

⌨️ 快捷键说明

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