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
9
* http://www.apache.org/licenses/LICENSE-2.0
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.
19
* $Id: DOMNotationImpl.cpp 671894 2008-06-26 13:29:21Z borisk $
22
#include "DOMDocumentImpl.hpp"
23
#include "DOMNotationImpl.hpp"
24
#include <xercesc/dom/DOMException.hpp>
25
#include <xercesc/dom/DOMNode.hpp>
27
XERCES_CPP_NAMESPACE_BEGIN
29
DOMNotationImpl::DOMNotationImpl(DOMDocument *ownerDoc, const XMLCh *nName)
30
: fNode(ownerDoc), fName(0), fPublicId(0), fSystemId(0), fBaseURI(0)
32
fNode.setIsLeafNode(true);
33
fName = ((DOMDocumentImpl *)ownerDoc)->getPooledString(nName);
36
DOMNotationImpl::DOMNotationImpl(const DOMNotationImpl &other, bool /*deep*/)
40
fPublicId(other.fPublicId),
41
fSystemId(other.fSystemId),
42
fBaseURI(other.fBaseURI)
44
fNode.setIsLeafNode(true);
48
DOMNotationImpl::~DOMNotationImpl()
53
DOMNode *DOMNotationImpl::cloneNode(bool deep) const
55
DOMNode* newNode = new (getOwnerDocument(), DOMMemoryManager::NOTATION_OBJECT) DOMNotationImpl(*this, deep);
56
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
61
const XMLCh * DOMNotationImpl::getNodeName() const {
66
DOMNode::NodeType DOMNotationImpl::getNodeType() const {
67
return DOMNode::NOTATION_NODE;
72
const XMLCh * DOMNotationImpl::getPublicId() const
78
const XMLCh * DOMNotationImpl::getSystemId() const
84
void DOMNotationImpl::setNodeValue(const XMLCh *arg)
86
fNode.setNodeValue(arg);
90
void DOMNotationImpl::setPublicId(const XMLCh *arg)
92
if(fNode.isReadOnly())
94
DOMException::NO_MODIFICATION_ALLOWED_ERR,0, GetDOMNodeMemoryManager);
96
fPublicId = ((DOMDocumentImpl *)getOwnerDocument())->cloneString(arg);
100
void DOMNotationImpl::setSystemId(const XMLCh *arg)
102
if(fNode.isReadOnly())
104
DOMException::NO_MODIFICATION_ALLOWED_ERR,0, GetDOMNodeMemoryManager);
106
fSystemId = ((DOMDocumentImpl *)getOwnerDocument())->cloneString(arg);
109
void DOMNotationImpl::release()
111
if (fNode.isOwned() && !fNode.isToBeReleased())
112
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
114
DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
116
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
117
doc->release(this, DOMMemoryManager::NOTATION_OBJECT);
120
// shouldn't reach here
121
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
125
void DOMNotationImpl::setBaseURI(const XMLCh* baseURI) {
126
if (baseURI && *baseURI) {
127
XMLCh* temp = (XMLCh*) ((DOMDocumentImpl *)getOwnerDocument())->allocate((XMLString::stringLen(baseURI) + 9)*sizeof(XMLCh));
128
XMLString::fixURI(baseURI, temp);
135
const XMLCh* DOMNotationImpl::getBaseURI() const
141
DOMNode* DOMNotationImpl::appendChild(DOMNode *newChild) {return fNode.appendChild (newChild); }
142
DOMNamedNodeMap* DOMNotationImpl::getAttributes() const {return fNode.getAttributes (); }
143
DOMNodeList* DOMNotationImpl::getChildNodes() const {return fNode.getChildNodes (); }
144
DOMNode* DOMNotationImpl::getFirstChild() const {return fNode.getFirstChild (); }
145
DOMNode* DOMNotationImpl::getLastChild() const {return fNode.getLastChild (); }
146
const XMLCh* DOMNotationImpl::getLocalName() const {return fNode.getLocalName (); }
147
const XMLCh* DOMNotationImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); }
148
DOMNode* DOMNotationImpl::getNextSibling() const {return fNode.getNextSibling (); }
149
const XMLCh* DOMNotationImpl::getNodeValue() const {return fNode.getNodeValue (); }
150
DOMDocument* DOMNotationImpl::getOwnerDocument() const {return fNode.getOwnerDocument (); }
151
const XMLCh* DOMNotationImpl::getPrefix() const {return fNode.getPrefix (); }
152
DOMNode* DOMNotationImpl::getParentNode() const {return fNode.getParentNode (); }
153
DOMNode* DOMNotationImpl::getPreviousSibling() const {return fNode.getPreviousSibling (); }
154
bool DOMNotationImpl::hasChildNodes() const {return fNode.hasChildNodes (); }
155
DOMNode* DOMNotationImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
156
{return fNode.insertBefore (newChild, refChild); }
157
void DOMNotationImpl::normalize() {fNode.normalize (); }
158
DOMNode* DOMNotationImpl::removeChild(DOMNode *oldChild) {return fNode.removeChild (oldChild); }
159
DOMNode* DOMNotationImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild)
160
{return fNode.replaceChild (newChild, oldChild); }
161
bool DOMNotationImpl::isSupported(const XMLCh *feature, const XMLCh *version) const
162
{return fNode.isSupported (feature, version); }
163
void DOMNotationImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); }
164
bool DOMNotationImpl::hasAttributes() const {return fNode.hasAttributes(); }
165
bool DOMNotationImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); }
166
bool DOMNotationImpl::isEqualNode(const DOMNode* arg) const {return fNode.isEqualNode(arg); }
167
void* DOMNotationImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler)
168
{return fNode.setUserData(key, data, handler); }
169
void* DOMNotationImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); }
170
short DOMNotationImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); }
171
const XMLCh* DOMNotationImpl::getTextContent() const {return fNode.getTextContent(); }
172
void DOMNotationImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); }
173
const XMLCh* DOMNotationImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); }
174
bool DOMNotationImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); }
175
const XMLCh* DOMNotationImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); }
176
void* DOMNotationImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); }
179
XERCES_CPP_NAMESPACE_END