⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gnomedocument.java

📁 gcc的组建
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* GnomeDocument.java -    Copyright (C) 2004 Free Software Foundation, Inc.This file is part of GNU Classpath.GNU Classpath is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU Classpath is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Classpath; see the file COPYING.  If not, write to theFree Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA02110-1301 USA.Linking this library statically or dynamically with other modules ismaking a combined work based on this library.  Thus, the terms andconditions of the GNU General Public License cover the wholecombination.As a special exception, the copyright holders of this library give youpermission to link this library with independent modules to produce anexecutable, regardless of the license terms of these independentmodules, and to copy and distribute the resulting executable underterms of your choice, provided that you also meet, for each linkedindependent module, the terms and conditions of the license of thatmodule.  An independent module is a module which is not derived fromor based on this library.  If you modify this library, you may extendthis exception to your version of the library, but you are notobligated to do so.  If you do not wish to do so, delete thisexception statement from your version. */package gnu.xml.libxmlj.dom;import java.util.Iterator;import org.w3c.dom.Attr;import org.w3c.dom.CDATASection;import org.w3c.dom.Comment;import org.w3c.dom.Document;import org.w3c.dom.DocumentFragment;import org.w3c.dom.DocumentType;import org.w3c.dom.DOMConfiguration;import org.w3c.dom.DOMErrorHandler;import org.w3c.dom.DOMException;import org.w3c.dom.DOMImplementation;import org.w3c.dom.DOMStringList;import org.w3c.dom.Element;import org.w3c.dom.EntityReference;import org.w3c.dom.Node;import org.w3c.dom.NodeList;import org.w3c.dom.ProcessingInstruction;import org.w3c.dom.Text;import org.w3c.dom.UserDataHandler;import org.w3c.dom.traversal.DocumentTraversal;import org.w3c.dom.traversal.NodeFilter;import org.w3c.dom.traversal.NodeIterator;import org.w3c.dom.traversal.TreeWalker;import org.w3c.dom.xpath.XPathEvaluator;import org.w3c.dom.xpath.XPathException;import org.w3c.dom.xpath.XPathExpression;import org.w3c.dom.xpath.XPathNSResolver;import gnu.xml.dom.DomNodeIterator;/** * A DOM document node implemented in libxml2. * * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> */public class GnomeDocument  extends GnomeNode  implements Document, DOMConfiguration, XPathEvaluator, DocumentTraversal{  DOMImplementation dom;  /**   * Not currently used.   */  boolean strictErrorChecking;  /* DOMConfiguration */  boolean canonicalForm = false;  boolean cdataSections = true;  boolean checkCharacterNormalization = false;  boolean comments = true;  boolean datatypeNormalization = false;  boolean elementContentWhitespace = true;  boolean entities = true;  DOMErrorHandler errorHandler;  boolean namespaces = true;  boolean namespaceDeclarations = true;  boolean normalizeCharacters = false;  boolean splitCdataSections = true;  boolean validate = false;  boolean validateIfSchema = false;  boolean wellFormed = true;    GnomeDocument(Object id)  {    super(id);    strictErrorChecking = true;  }    protected void finalize()  {    free(id);  }    private native void free(Object id);  public native DocumentType getDoctype();  public DOMImplementation getImplementation()  {    return dom;  }  public native Element getDocumentElement();  public Element createElement(String tagName)    throws DOMException  {    return createElementNS(null, tagName);  }  public native DocumentType createDocumentType(String name, String publicId,                                                String systemId);  public native DocumentFragment createDocumentFragment();  public native Text createTextNode(String data);  public native Comment createComment(String data);  public native CDATASection createCDATASection(String data)    throws DOMException;  public native ProcessingInstruction createProcessingInstruction(String target,                                                                  String data)    throws DOMException;  public Attr createAttribute(String name)    throws DOMException  {    return createAttributeNS(null, name);  }  public native EntityReference createEntityReference(String name)    throws DOMException;  public native NodeList getElementsByTagName(String tagName);  public Node importNode(Node importedNode, boolean deep)    throws DOMException  {    Node ret = xmljImportNode(importedNode, deep);    if (importedNode instanceof GnomeNode)      {        ((GnomeNode) importedNode)          .notifyUserDataHandlers(UserDataHandler.NODE_IMPORTED,                                  importedNode, ret);      }    return ret;  }  private native Node xmljImportNode(Node importedNode, boolean deep)    throws DOMException;  public native Element createElementNS(String namespaceURI, String                                        qualifiedName)    throws DOMException;    public native Attr createAttributeNS(String namespaceURI, String                                       qualifiedName)    throws DOMException;  public native NodeList getElementsByTagNameNS(String namespaceURI,      String localName);  public Element getElementById(String elementId)  {    Element element = xmljGetElementById(elementId);    if (element == null)      {        TreeWalker walker = createTreeWalker(this, NodeFilter.SHOW_ELEMENT,                                             null, false);        for (Node node = walker.nextNode(); node != null;             node = walker.nextNode())          {            GnomeElement e = (GnomeElement) node;            if (e.userIdAttrs != null)              {                for (Iterator i = e.userIdAttrs.iterator(); i.hasNext(); )                  {                    Attr attr = (Attr) i.next();                    if (attr.getNodeValue().equals(elementId))                      {                        return e;                      }                  }              }          }      }    return element;  }    private native Element xmljGetElementById(String elementId);  // DOM Level 3 methods  public native String getInputEncoding();  public native String getXmlEncoding();  public native boolean getXmlStandalone();  public native void setXmlStandalone(boolean xmlStandalone);  public native String getXmlVersion();  public native void setXmlVersion(String xmlVersion);  public boolean getStrictErrorChecking()  {    return strictErrorChecking;  }  public void setStrictErrorChecking(boolean strictErrorChecking)  {    this.strictErrorChecking = strictErrorChecking;  }    public native String getDocumentURI();  public native void setDocumentURI(String documentURI);  public Node adoptNode(Node source)    throws DOMException  {    if (source == null || !(source instanceof GnomeNode))      {        return null;      }    Node ret = xmljAdoptNode(source);    if (source instanceof GnomeNode)      {        ((GnomeNode) source).          notifyUserDataHandlers(UserDataHandler.NODE_ADOPTED,                                 source, ret);      }    return ret;  }  private native Node xmljAdoptNode(Node source)    throws DOMException;  public DOMConfiguration getDomConfig()  {    return this;  }  public void normalizeDocument()  {    normalize();  }  public native Node renameNode(Node n, String namespaceURI,                                String qualifiedName);  // -- DOMConfiguration methods --  public void setParameter(String name, Object value)    throws DOMException  {

⌨️ 快捷键说明

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