📄 dom_document.hpp
字号:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//* * $Id: DOM_Document.hpp 568078 2007-08-21 11:43:25Z amassari $*/#ifndef DOM_Document_HEADER_GUARD_#define DOM_Document_HEADER_GUARD_#include <xercesc/util/XercesDefs.hpp>#include "DOM_DocumentType.hpp"#include "DOM_DOMImplementation.hpp"#include "DOM_Element.hpp"#include "DOM_DocumentFragment.hpp"#include "DOM_Comment.hpp"#include "DOM_CDATASection.hpp"#include "DOM_ProcessingInstruction.hpp"#include "DOM_Attr.hpp"#include "DOM_Entity.hpp"#include "DOM_EntityReference.hpp"#include "DOM_NodeList.hpp"#include "DOM_Notation.hpp"#include "DOM_Text.hpp"#include "DOM_Node.hpp"#include "DOM_NodeIterator.hpp"#include "DOM_TreeWalker.hpp"#include "DOM_XMLDecl.hpp"#include "DOM_Range.hpp"XERCES_CPP_NAMESPACE_BEGINclass DocumentImpl;class NodeIteratorImpl;/*** Class to refer to XML Document nodes in the DOM.** Conceptually, a DOM document node 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>Document</code>, the* <code>Document</code> interface also contains the factory methods needed* to create these objects. The <code>Node</code> objects created have a* <code>ownerDocument</code> attribute which associates them with the* <code>Document</code> within whose context they were created.*/class DEPRECATED_DOM_EXPORT DOM_Document: public DOM_Node {public: /** @name Constructors and assignment operators */ //@{ /** * The default constructor for DOM_Document creates a null * DOM_Document object that refers to no document. It may subsequently be * assigned to refer to an actual Document node. * * To create a new document, use the static method * <code> DOM_Document::createDocument(). </code> * */ DOM_Document(); /** * Copy constructor. Creates a new <code>DOM_Document</code> that refers to the * same underlying actual document as the original. * * @param other The object to be copied */ DOM_Document(const DOM_Document &other); /** * Assignment operator * * @param other The object to be copied */ DOM_Document & operator = (const DOM_Document &other); /** * Assignment operator. This overloaded variant is provided for * the sole purpose of setting a DOM_Node reference variable to * zero. Nulling out a reference variable in this way will decrement * the reference count on the underlying Node object that the variable * formerly referenced. This effect is normally obtained when reference * variable goes out of scope, but zeroing them can be useful for * global instances, or for local instances that will remain in scope * for an extended time, when the storage belonging to the underlying * node needs to be reclaimed. * * @param val Only a value of 0, or null, is allowed. */ DOM_Document & operator = (const DOM_NullPtr *val); //@} /** @name Destructor */ //@{ /** * Destructor. The object being destroyed is the reference * object, not the underlying Document itself. * * <p>The reference counting memory management will * delete the underlying document itself if this * DOM_Document is the last remaining to refer to the Document, * and if there are no remaining references to any of the nodes * within the document tree. If other live references do remain, * the underlying document itself remains also. * */ ~DOM_Document(); //@} /** @name Factory methods to create new nodes for the Document */ //@{ /** * Create a new empty document. * * This differs from the <code> DOM_Document </code> default * constructor, which creates * a null reference only, not an actual document. * * <p>This function is an extension to the DOM API, which * lacks any mechanism for the creation of new documents. * @return A new <code>DOM_Document</code>, which may then * be populated using the DOM API calls. */ static DOM_Document createDocument(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); /** * Create a new entity. * * Non-standard extension. * @param name The name of the entity to instantiate * */ DOM_Entity createEntity(const DOMString &name); /** * Creates an element of the type specified. * * Note that the instance returned * implements the Element interface, so attributes can be specified * directly on the returned object. * @param tagName The name of the element type to instantiate. * @return A <code>DOM_Element</code> that reference the new element. * @exception DOMException * INVALID_CHARACTER_ERR: Raised if the specified name contains an * illegal character. */ DOM_Element createElement(const DOMString &tagName); /** * Creates an element of the type specified. * This non-standard overload of createElement, with the name specified as * raw Unicode string, is intended for use from XML parsers, * and is the best performing way to create elements. The name * string is not checked for conformance to the XML rules for valid * element names. * * * @param tagName The name of the element type to instantiate, as * a null-terminated unicode string. * @return A new <CODE>DOM_Element</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>. */ DOM_Element createElement(const XMLCh *tagName); /** * Creates an empty DocumentFragment object. * * @return A <code>DOM_DocumentFragment</code> that references the newly * created document fragment. */ DOM_DocumentFragment createDocumentFragment(); /** * Creates a Text node given the specified string. * * @param data The data for the node. * @return A <code>DOM_Text</code> object that references the newly * created text node. */ DOM_Text createTextNode(const DOMString &data); /** * Creates a Comment node given the specified string. * * @param data The data for the comment. * @return A <code>DOM_Comment</code> that references the newly * created comment node. */ DOM_Comment createComment(const DOMString &data); /** * Creates a CDATASection node whose value is the specified * string. * * @param data The data for the <code>DOM_CDATASection</code> contents. * @return A <code>DOM_CDATASection</code> object. * @exception DOMException * NOT_SUPPORTED_ERR: Raised if this document is an HTML document. */ DOM_CDATASection createCDATASection(const DOMString &data); /** * Create a DocumentType node. Non-standard extension. * * @return A <code>DOM_DocumentType</code> that references the newly * created DocumentType node. * */ DOM_DocumentType createDocumentType(const DOMString &name); /** * Create a Notation. * * Non-standard extension. * * @param name The name of the notation to instantiate * @return A <code>DOM_Notation</code> that references the newly * created Notation node. */ DOM_Notation createNotation(const DOMString &name); /** * Creates a ProcessingInstruction 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 A <code>DOM_ProcessingInstruction</code> that references the newly * created PI node. * @exception DOMException * INVALID_CHARACTER_ERR: Raised if an illegal character is specified. */ DOM_ProcessingInstruction createProcessingInstruction(const DOMString &target, const DOMString &data); /** * Creates an Attr of the given name. * * Note that the * <code>Attr</code> instance can then be attached to an Element * using the <code>DOMElement::setAttribute()</code> method. * @param name The name of the attribute. * @return A new <CODE>DOM_Attr</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>. * @exception DOMException * INVALID_CHARACTER_ERR: Raised if the specified name contains an * illegal character. */ DOM_Attr createAttribute(const DOMString &name); /** * Creates an EntityReference object. * * @param name The name of the entity to reference. * @return A <code>DOM_EntityReference</code> that references the newly * created EntityReference node. * @exception DOMException * INVALID_CHARACTER_ERR: Raised if the specified name contains an
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -