📄 domdocument.hpp
字号:
#ifndef DOMDocument_HEADER_GUARD_#define DOMDocument_HEADER_GUARD_/* * The Apache Software License, Version 1.1 * * Copyright (c) 2001-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Xerces" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache\@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation, and was * originally based on software copyright (c) 2001, International * Business Machines, Inc., http://www.ibm.com . For more information * on the Apache Software Foundation, please see * <http://www.apache.org/>. *//* * $Id: DOMDocument.hpp,v 1.15 2003/08/20 11:31:22 gareth Exp $*/#include <xercesc/util/XercesDefs.hpp>#include "DOMNode.hpp"#include "DOMDocumentRange.hpp"#include "DOMDocumentTraversal.hpp"#include "DOMXPathEvaluator.hpp"XERCES_CPP_NAMESPACE_BEGINclass DOMConfiguration;class DOMDocumentType;class DOMElement;class DOMDocumentFragment;class DOMComment;class DOMCDATASection;class DOMProcessingInstruction;class DOMAttr;class DOMEntity;class DOMEntityReference;class DOMImplementation;class DOMNodeFilter;class DOMNodeList;class DOMNotation;class DOMText;class DOMNode;/** * The <code>DOMDocument</code> interface represents the entire XML * document. Conceptually, it is the root of the document tree, and provides * the primary access to the document's data. * <p>Since elements, text nodes, comments, processing instructions, etc. * cannot exist outside the context of a <code>DOMDocument</code>, the * <code>DOMDocument</code> interface also contains the factory methods needed * to create these objects. The <code>DOMNode</code> objects created have a * <code>ownerDocument</code> attribute which associates them with the * <code>DOMDocument</code> within whose context they were created. * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>. */class CDOM_EXPORT DOMDocument: public DOMDocumentRange, public DOMXPathEvaluator, public DOMDocumentTraversal, public DOMNode {protected: // ----------------------------------------------------------------------- // Hidden constructors // ----------------------------------------------------------------------- /** @name Hidden constructors */ //@{ DOMDocument() {}; //@}private: // ----------------------------------------------------------------------- // Unimplemented constructors and operators // ----------------------------------------------------------------------- /** @name Unimplemented constructors and operators */ //@{ DOMDocument(const DOMDocument &); DOMDocument & operator = (const DOMDocument &); //@}public: // ----------------------------------------------------------------------- // All constructors are hidden, just the destructor is available // ----------------------------------------------------------------------- /** @name Destructor */ //@{ /** * Destructor * */ virtual ~DOMDocument() {}; //@} // ----------------------------------------------------------------------- // Virtual DOMDocument interface // ----------------------------------------------------------------------- /** @name Functions introduced in DOM Level 1 */ //@{ /** * Creates an element of the type specified. Note that the instance * returned implements the <code>DOMElement</code> interface, so attributes * can be specified directly on the returned object. * <br>In addition, if there are known attributes with default values, * <code>DOMAttr</code> nodes representing them are automatically created * and attached to the element. * <br>To create an element with a qualified name and namespace URI, use * the <code>createElementNS</code> method. * @param tagName The name of the element type to instantiate. For XML, * this is case-sensitive. * @return A new <code>DOMElement</code> object with the * <code>nodeName</code> attribute set to <code>tagName</code>, and * <code>localName</code>, <code>prefix</code>, and * <code>namespaceURI</code> set to <code>null</code>. * @exception DOMException * INVALID_CHARACTER_ERR: Raised if the specified name contains an * illegal character. * @since DOM Level 1 */ virtual DOMElement *createElement(const XMLCh *tagName) = 0; /** * Creates an empty <code>DOMDocumentFragment</code> object. * @return A new <code>DOMDocumentFragment</code>. * @since DOM Level 1 */ virtual DOMDocumentFragment *createDocumentFragment() = 0; /** * Creates a <code>DOMText</code> node given the specified string. * @param data The data for the node. * @return The new <code>DOMText</code> object. * @since DOM Level 1 */ virtual DOMText *createTextNode(const XMLCh *data) = 0; /** * Creates a <code>DOMComment</code> node given the specified string. * @param data The data for the node. * @return The new <code>DOMComment</code> object. * @since DOM Level 1 */ virtual DOMComment *createComment(const XMLCh *data) = 0; /** * Creates a <code>DOMCDATASection</code> node whose value is the specified * string. * @param data The data for the <code>DOMCDATASection</code> contents. * @return The new <code>DOMCDATASection</code> object. * @since DOM Level 1 */ virtual DOMCDATASection *createCDATASection(const XMLCh *data) = 0; /** * Creates a <code>DOMProcessingInstruction</code> node given the specified * name and data strings. * @param target The target part of the processing instruction. * @param data The data for the node. * @return The new <code>DOMProcessingInstruction</code> object. * @exception DOMException * INVALID_CHARACTER_ERR: Raised if the specified target contains an * illegal character. * @since DOM Level 1 */ virtual DOMProcessingInstruction *createProcessingInstruction(const XMLCh *target, const XMLCh *data) = 0; /** * Creates an <code>DOMAttr</code> of the given name. Note that the * <code>DOMAttr</code> instance can then be set on an <code>DOMElement</code> * using the <code>setAttributeNode</code> method. * <br>To create an attribute with a qualified name and namespace URI, use * the <code>createAttributeNS</code> method. * @param name The name of the attribute. * @return A new <code>DOMAttr</code> object with the <code>nodeName</code> * attribute set to <code>name</code>, and <code>localName</code>, * <code>prefix</code>, and <code>namespaceURI</code> set to * <code>null</code>. The value of the attribute is the empty string. * @exception DOMException * INVALID_CHARACTER_ERR: Raised if the specified name contains an * illegal character. * @since DOM Level 1 */ virtual DOMAttr *createAttribute(const XMLCh *name) = 0; /** * Creates an <code>DOMEntityReference</code> object. In addition, if the * referenced entity is known, the child list of the * <code>DOMEntityReference</code> node is made the same as that of the * corresponding <code>DOMEntity</code> node.If any descendant of the * <code>DOMEntity</code> node has an unbound namespace prefix, the * corresponding descendant of the created <code>DOMEntityReference</code> * node is also unbound; (its <code>namespaceURI</code> is * <code>null</code>). The DOM Level 2 does not support any mechanism to * resolve namespace prefixes. * @param name The name of the entity to reference. * @return The new <code>DOMEntityReference</code> object. * @exception DOMException * INVALID_CHARACTER_ERR: Raised if the specified name contains an * illegal character. * @since DOM Level 1 */ virtual DOMEntityReference *createEntityReference(const XMLCh *name) = 0; /** * The Document Type Declaration (see <code>DOMDocumentType</code>) * associated with this document. For XML * documents without a document type declaration this returns * <code>null</code>. The DOM Level 2 does not support editing the * Document Type Declaration. <code>docType</code> cannot be altered in * any way, including through the use of methods inherited from the * <code>DOMNode</code> interface, such as <code>insertNode</code> or * <code>removeNode</code>. * @since DOM Level 1 */ virtual DOMDocumentType *getDoctype() const = 0; /** * The <code>DOMImplementation</code> object that handles this document. A * DOM application may use objects from multiple implementations. * @since DOM Level 1 */ virtual DOMImplementation *getImplementation() const = 0; /** * This is a convenience attribute that allows direct access to the child * node that is the root element of the document. * @since DOM Level 1 */ virtual DOMElement *getDocumentElement() const = 0; /** * Returns a <code>DOMNodeList</code> of all the <code>DOMElement(s)</code> with a * given tag name in the order in which they are encountered in a * preorder traversal of the <code>DOMDocument</code> tree. * * The returned node list is "live", in that changes * to the document tree made after a nodelist was initially * returned will be immediately reflected in the node list. * @param tagname The name of the tag to match on. The special value "*" * matches all tags. * @return A new <code>DOMNodeList</code> object containing all the matched * <code>DOMElement(s)</code>. * @since DOM Level 1 */ virtual DOMNodeList *getElementsByTagName(const XMLCh *tagname) const = 0; //@} /** @name Functions introduced in DOM Level 2. */ //@{ /** * Imports a node from another document to this document. The returned * node has no parent; (<code>parentNode</code> is <code>null</code>).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -