Xerces-C++ 3.2.0

DOMNode.hpp
Go to the documentation of this file.
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 /*
19 * $Id: DOMNode.hpp 932889 2010-04-11 13:10:10Z borisk $
20 */
21
22 #if !defined(XERCESC_INCLUDE_GUARD_DOMNODE_HPP)
23 #define XERCESC_INCLUDE_GUARD_DOMNODE_HPP
24
25 #include <xercesc/util/XercesDefs.hpp>
26
27 XERCES_CPP_NAMESPACE_BEGIN
28
29
30 class DOMDocument;
31 class DOMNamedNodeMap;
32 class DOMNodeList;
33 class DOMUserDataHandler;
34
139 class CDOM_EXPORT DOMNode {
140 protected:
141 // -----------------------------------------------------------------------
142 // Hidden constructors
143 // -----------------------------------------------------------------------
146 DOMNode() {}
147 DOMNode(const DOMNode &) {}
149
150 private:
151 // -----------------------------------------------------------------------
152 // Unimplemented constructors and operators
153 // -----------------------------------------------------------------------
156 DOMNode & operator = (const DOMNode &);
158
159 public:
160 // -----------------------------------------------------------------------
161 // All constructors are hidden, just the destructor is available
162 // -----------------------------------------------------------------------
169 virtual ~DOMNode() {};
171
172 // -----------------------------------------------------------------------
173 // Class Types
174 // -----------------------------------------------------------------------
182 enum NodeType {
183 ELEMENT_NODE = 1,
184 ATTRIBUTE_NODE = 2,
185 TEXT_NODE = 3,
186 CDATA_SECTION_NODE = 4,
187 ENTITY_REFERENCE_NODE = 5,
188 ENTITY_NODE = 6,
189 PROCESSING_INSTRUCTION_NODE = 7,
190 COMMENT_NODE = 8,
191 DOCUMENT_NODE = 9,
192 DOCUMENT_TYPE_NODE = 10,
193 DOCUMENT_FRAGMENT_NODE = 11,
194 NOTATION_NODE = 12
195 };
196
215 enum DocumentPosition {
216 DOCUMENT_POSITION_DISCONNECTED = 0x01,
217 DOCUMENT_POSITION_PRECEDING = 0x02,
218 DOCUMENT_POSITION_FOLLOWING = 0x04,
219 DOCUMENT_POSITION_CONTAINS = 0x08,
220 DOCUMENT_POSITION_CONTAINED_BY = 0x10,
221 DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20
222 };
224
225 // -----------------------------------------------------------------------
226 // Virtual DOMNode interface
227 // -----------------------------------------------------------------------
230 // -----------------------------------------------------------------------
231 // Getter methods
232 // -----------------------------------------------------------------------
237 virtual const XMLCh * getNodeName() const = 0;
238
246 virtual const XMLCh * getNodeValue() const = 0;
247
252 virtual NodeType getNodeType() const = 0;
253
264 virtual DOMNode *getParentNode() const = 0;
265
280 virtual DOMNodeList *getChildNodes() const = 0;
287 virtual DOMNode *getFirstChild() const = 0;
288
295 virtual DOMNode *getLastChild() const = 0;
296
303 virtual DOMNode *getPreviousSibling() const = 0;
304
311 virtual DOMNode *getNextSibling() const = 0;
312
318 virtual DOMNamedNodeMap *getAttributes() const = 0;
319
331 virtual DOMDocument *getOwnerDocument() const = 0;
332
333 // -----------------------------------------------------------------------
334 // Node methods
335 // -----------------------------------------------------------------------
355 virtual DOMNode * cloneNode(bool deep) const = 0;
356
384 virtual DOMNode *insertBefore(DOMNode *newChild,
385 DOMNode *refChild) = 0;
386
387
411 virtual DOMNode *replaceChild(DOMNode *newChild,
412 DOMNode *oldChild) = 0;
425 virtual DOMNode *removeChild(DOMNode *oldChild) = 0;
426
447 virtual DOMNode *appendChild(DOMNode *newChild) = 0;
448
449 // -----------------------------------------------------------------------
450 // Query methods
451 // -----------------------------------------------------------------------
460 virtual bool hasChildNodes() const = 0;
461
462 // -----------------------------------------------------------------------
463 // Setter methods
464 // -----------------------------------------------------------------------
480 virtual void setNodeValue(const XMLCh *nodeValue) = 0;
482
505 virtual void normalize() = 0;
506
522 virtual bool isSupported(const XMLCh *feature,
523 const XMLCh *version) const = 0;
524
540 virtual const XMLCh * getNamespaceURI() const = 0;
541
548 virtual const XMLCh * getPrefix() const = 0;
549
559 virtual const XMLCh * getLocalName() const = 0;
560
594 virtual void setPrefix(const XMLCh * prefix) = 0;
595
602 virtual bool hasAttributes() const = 0;
604
622 virtual bool isSameNode(const DOMNode* other) const = 0;
623
664 virtual bool isEqualNode(const DOMNode* arg) const = 0;
665
666
692 virtual void* setUserData(const XMLCh* key,
693 void* data,
694 DOMUserDataHandler* handler) = 0;
695
707 virtual void* getUserData(const XMLCh* key) const = 0;
708
709
726 virtual const XMLCh* getBaseURI() const = 0;
727
738 virtual short compareDocumentPosition(const DOMNode* other) const = 0;
739
781 virtual const XMLCh* getTextContent() const = 0;
782
794 virtual void setTextContent(const XMLCh* textContent) = 0;
795
807 virtual const XMLCh* lookupPrefix(const XMLCh* namespaceURI) const = 0;
808
818 virtual bool isDefaultNamespace(const XMLCh* namespaceURI) const = 0;
819
831 virtual const XMLCh* lookupNamespaceURI(const XMLCh* prefix) const = 0;
832
848 virtual void* getFeature(const XMLCh* feature, const XMLCh* version) const = 0;
850
851 // -----------------------------------------------------------------------
852 // Non-standard Extension
853 // -----------------------------------------------------------------------
869 virtual void release() = 0;
871 #if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
872 // -----------------------------------------------------------------------
873 // Non-standard Extension
874 // -----------------------------------------------------------------------
884 virtual void decRefCount() {}
886
887 // -----------------------------------------------------------------------
888 // Non-standard Extension
889 // -----------------------------------------------------------------------
896 virtual void incRefCount() {}
898 #endif
899 };
900
901 /***
902 * Utilities macros for getting memory manager within DOM
903 ***/
904 #define GET_OWNER_DOCUMENT(ptr) \
905 ((DOMDocumentImpl*)(ptr->getOwnerDocument()))
906
907 #define GET_DIRECT_MM(ptr) \
908 (ptr ? ((DOMDocumentImpl*)ptr)->getMemoryManager() : XMLPlatformUtils::fgMemoryManager)
909
910 #define GET_INDIRECT_MM(ptr) \
911 (!ptr ? XMLPlatformUtils::fgMemoryManager : \
912 GET_OWNER_DOCUMENT(ptr) ? GET_OWNER_DOCUMENT(ptr)->getMemoryManager() : \
913 XMLPlatformUtils::fgMemoryManager)
914
915 /***
916 * For DOMNode and its derivatives
917 ***/
918 #define GetDOMNodeMemoryManager GET_INDIRECT_MM(this)
919
920 XERCES_CPP_NAMESPACE_END
921
922 #endif
DOMNode::~DOMNode
virtual ~DOMNode()
Destructor.
Definition: DOMNode.hpp:169
DOMUserDataHandler
When associating an object to a key on a node using setUserData the application can provide a handler...
Definition: DOMUserDataHandler.hpp:40
DOMNodeList
The DOMNodeList interface provides the abstraction of an ordered collection of nodes.
Definition: DOMNodeList.hpp:45
DOMNamedNodeMap
DOMNamedNodeMaps are used to represent collections of nodes that can be accessed by name...
Definition: DOMNamedNodeMap.hpp:45
XercesDefs.hpp
DOMDocument
The DOMDocument interface represents the entire XML document.
Definition: DOMDocument.hpp:64
CDOM_EXPORT
#define CDOM_EXPORT
Definition: XercesDefs.hpp:166
XMLCh
uint16_t XMLCh
Definition: Xerces_autoconf_config.hpp:118
DOMNode::DocumentPosition
DocumentPosition
DocumentPosition:
Definition: DOMNode.hpp:215
XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_BEGIN
Definition: XercesDefs.hpp:112
DOMNode::DOMNode
DOMNode(const DOMNode &)
Definition: DOMNode.hpp:147
DOMNode::DOMNode
DOMNode()
Definition: DOMNode.hpp:146
XERCES_CPP_NAMESPACE_END
#define XERCES_CPP_NAMESPACE_END
Definition: XercesDefs.hpp:113
DOMNode
The DOMNode interface is the primary datatype for the entire Document Object Model.
Definition: DOMNode.hpp:139
DOMNode::NodeType
NodeType
NodeType.
Definition: DOMNode.hpp:182