DOMNode.hpp
Go to the documentation of this file.
/*
* 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: DOMNode.hpp 932889 2010-04-11 13:10:10Z borisk $
*/
#if !defined(XERCESC_INCLUDE_GUARD_DOMNODE_HPP)
#define XERCESC_INCLUDE_GUARD_DOMNODE_HPP
#include <xercesc/util/XercesDefs.hpp>
XERCES_CPP_NAMESPACE_BEGIN
class DOMDocument;
class DOMNamedNodeMap;
class DOMNodeList;
class DOMUserDataHandler;
class CDOM_EXPORT DOMNode {
protected:
// -----------------------------------------------------------------------
// Hidden constructors
// -----------------------------------------------------------------------
DOMNode() {}
DOMNode(const DOMNode &) {}
private:
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
DOMNode & operator = (const DOMNode &);
public:
// -----------------------------------------------------------------------
// All constructors are hidden, just the destructor is available
// -----------------------------------------------------------------------
virtual ~DOMNode() {};
// -----------------------------------------------------------------------
// Class Types
// -----------------------------------------------------------------------
enum NodeType {
ELEMENT_NODE = 1,
ATTRIBUTE_NODE = 2,
TEXT_NODE = 3,
CDATA_SECTION_NODE = 4,
ENTITY_REFERENCE_NODE = 5,
ENTITY_NODE = 6,
PROCESSING_INSTRUCTION_NODE = 7,
COMMENT_NODE = 8,
DOCUMENT_NODE = 9,
DOCUMENT_TYPE_NODE = 10,
DOCUMENT_FRAGMENT_NODE = 11,
NOTATION_NODE = 12
};
enum DocumentPosition {
DOCUMENT_POSITION_DISCONNECTED = 0x01,
DOCUMENT_POSITION_PRECEDING = 0x02,
DOCUMENT_POSITION_FOLLOWING = 0x04,
DOCUMENT_POSITION_CONTAINS = 0x08,
DOCUMENT_POSITION_CONTAINED_BY = 0x10,
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20
};
// -----------------------------------------------------------------------
// Virtual DOMNode interface
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// Getter methods
// -----------------------------------------------------------------------
virtual const XMLCh * getNodeName() const = 0;
virtual const XMLCh * getNodeValue() const = 0;
virtual NodeType getNodeType() const = 0;
virtual DOMNode *getParentNode() const = 0;
virtual DOMNodeList *getChildNodes() const = 0;
virtual DOMNode *getFirstChild() const = 0;
virtual DOMNode *getLastChild() const = 0;
virtual DOMNode *getPreviousSibling() const = 0;
virtual DOMNode *getNextSibling() const = 0;
virtual DOMNamedNodeMap *getAttributes() const = 0;
virtual DOMDocument *getOwnerDocument() const = 0;
// -----------------------------------------------------------------------
// Node methods
// -----------------------------------------------------------------------
virtual DOMNode * cloneNode(bool deep) const = 0;
virtual DOMNode *insertBefore(DOMNode *newChild,
DOMNode *refChild) = 0;
virtual DOMNode *replaceChild(DOMNode *newChild,
DOMNode *oldChild) = 0;
virtual DOMNode *removeChild(DOMNode *oldChild) = 0;
virtual DOMNode *appendChild(DOMNode *newChild) = 0;
// -----------------------------------------------------------------------
// Query methods
// -----------------------------------------------------------------------
virtual bool hasChildNodes() const = 0;
// -----------------------------------------------------------------------
// Setter methods
// -----------------------------------------------------------------------
virtual void setNodeValue(const XMLCh *nodeValue) = 0;
virtual void normalize() = 0;
virtual bool isSupported(const XMLCh *feature,
const XMLCh *version) const = 0;
virtual const XMLCh * getNamespaceURI() const = 0;
virtual const XMLCh * getPrefix() const = 0;
virtual const XMLCh * getLocalName() const = 0;
virtual void setPrefix(const XMLCh * prefix) = 0;
virtual bool hasAttributes() const = 0;
virtual bool isSameNode(const DOMNode* other) const = 0;
virtual bool isEqualNode(const DOMNode* arg) const = 0;
virtual void* setUserData(const XMLCh* key,
void* data,
DOMUserDataHandler* handler) = 0;
virtual void* getUserData(const XMLCh* key) const = 0;
virtual const XMLCh* getBaseURI() const = 0;
virtual short compareDocumentPosition(const DOMNode* other) const = 0;
virtual const XMLCh* getTextContent() const = 0;
virtual void setTextContent(const XMLCh* textContent) = 0;
virtual const XMLCh* lookupPrefix(const XMLCh* namespaceURI) const = 0;
virtual bool isDefaultNamespace(const XMLCh* namespaceURI) const = 0;
virtual const XMLCh* lookupNamespaceURI(const XMLCh* prefix) const = 0;
virtual void* getFeature(const XMLCh* feature, const XMLCh* version) const = 0;
// -----------------------------------------------------------------------
// Non-standard Extension
// -----------------------------------------------------------------------
virtual void release() = 0;
#if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
// -----------------------------------------------------------------------
// Non-standard Extension
// -----------------------------------------------------------------------
virtual void decRefCount() {}
// -----------------------------------------------------------------------
// Non-standard Extension
// -----------------------------------------------------------------------
virtual void incRefCount() {}
#endif
};
/***
* Utilities macros for getting memory manager within DOM
***/
#define GET_OWNER_DOCUMENT(ptr) \
((DOMDocumentImpl*)(ptr->getOwnerDocument()))
#define GET_DIRECT_MM(ptr) \
(ptr ? ((DOMDocumentImpl*)ptr)->getMemoryManager() : XMLPlatformUtils::fgMemoryManager)
#define GET_INDIRECT_MM(ptr) \
(!ptr ? XMLPlatformUtils::fgMemoryManager : \
GET_OWNER_DOCUMENT(ptr) ? GET_OWNER_DOCUMENT(ptr)->getMemoryManager() : \
XMLPlatformUtils::fgMemoryManager)
/***
* For DOMNode and its derivatives
***/
#define GetDOMNodeMemoryManager GET_INDIRECT_MM(this)
XERCES_CPP_NAMESPACE_END
#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