GME
13
|
00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 /* 00019 * $Id: DOMNotationImpl.cpp 671894 2008-06-26 13:29:21Z borisk $ 00020 */ 00021 00022 #include "DOMDocumentImpl.hpp" 00023 #include "DOMNotationImpl.hpp" 00024 #include <xercesc/dom/DOMException.hpp> 00025 #include <xercesc/dom/DOMNode.hpp> 00026 00027 XERCES_CPP_NAMESPACE_BEGIN 00028 00029 DOMNotationImpl::DOMNotationImpl(DOMDocument *ownerDoc, const XMLCh *nName) 00030 : fNode(ownerDoc), fName(0), fPublicId(0), fSystemId(0), fBaseURI(0) 00031 { 00032 fNode.setIsLeafNode(true); 00033 fName = ((DOMDocumentImpl *)ownerDoc)->getPooledString(nName); 00034 } 00035 00036 DOMNotationImpl::DOMNotationImpl(const DOMNotationImpl &other, bool /*deep*/) 00037 : DOMNotation(other), 00038 fNode(other.fNode), 00039 fName(other.fName), 00040 fPublicId(other.fPublicId), 00041 fSystemId(other.fSystemId), 00042 fBaseURI(other.fBaseURI) 00043 { 00044 fNode.setIsLeafNode(true); 00045 } 00046 00047 00048 DOMNotationImpl::~DOMNotationImpl() 00049 { 00050 } 00051 00052 00053 DOMNode *DOMNotationImpl::cloneNode(bool deep) const 00054 { 00055 DOMNode* newNode = new (getOwnerDocument(), DOMMemoryManager::NOTATION_OBJECT) DOMNotationImpl(*this, deep); 00056 fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); 00057 return newNode; 00058 } 00059 00060 00061 const XMLCh * DOMNotationImpl::getNodeName() const { 00062 return fName; 00063 } 00064 00065 00066 DOMNode::NodeType DOMNotationImpl::getNodeType() const { 00067 return DOMNode::NOTATION_NODE; 00068 } 00069 00070 00071 00072 const XMLCh * DOMNotationImpl::getPublicId() const 00073 { 00074 return fPublicId; 00075 } 00076 00077 00078 const XMLCh * DOMNotationImpl::getSystemId() const 00079 { 00080 return fSystemId; 00081 } 00082 00083 00084 void DOMNotationImpl::setNodeValue(const XMLCh *arg) 00085 { 00086 fNode.setNodeValue(arg); 00087 } 00088 00089 00090 void DOMNotationImpl::setPublicId(const XMLCh *arg) 00091 { 00092 if(fNode.isReadOnly()) 00093 throw DOMException( 00094 DOMException::NO_MODIFICATION_ALLOWED_ERR,0, GetDOMNodeMemoryManager); 00095 00096 fPublicId = ((DOMDocumentImpl *)getOwnerDocument())->cloneString(arg); 00097 } 00098 00099 00100 void DOMNotationImpl::setSystemId(const XMLCh *arg) 00101 { 00102 if(fNode.isReadOnly()) 00103 throw DOMException( 00104 DOMException::NO_MODIFICATION_ALLOWED_ERR,0, GetDOMNodeMemoryManager); 00105 00106 fSystemId = ((DOMDocumentImpl *)getOwnerDocument())->cloneString(arg); 00107 } 00108 00109 void DOMNotationImpl::release() 00110 { 00111 if (fNode.isOwned() && !fNode.isToBeReleased()) 00112 throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); 00113 00114 DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument(); 00115 if (doc) { 00116 fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); 00117 doc->release(this, DOMMemoryManager::NOTATION_OBJECT); 00118 } 00119 else { 00120 // shouldn't reach here 00121 throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); 00122 } 00123 } 00124 00125 void DOMNotationImpl::setBaseURI(const XMLCh* baseURI) { 00126 if (baseURI && *baseURI) { 00127 XMLCh* temp = (XMLCh*) ((DOMDocumentImpl *)getOwnerDocument())->allocate((XMLString::stringLen(baseURI) + 9)*sizeof(XMLCh)); 00128 XMLString::fixURI(baseURI, temp); 00129 fBaseURI = temp; 00130 } 00131 else 00132 fBaseURI = 0; 00133 } 00134 00135 const XMLCh* DOMNotationImpl::getBaseURI() const 00136 { 00137 return fBaseURI; 00138 } 00139 00140 00141 DOMNode* DOMNotationImpl::appendChild(DOMNode *newChild) {return fNode.appendChild (newChild); } 00142 DOMNamedNodeMap* DOMNotationImpl::getAttributes() const {return fNode.getAttributes (); } 00143 DOMNodeList* DOMNotationImpl::getChildNodes() const {return fNode.getChildNodes (); } 00144 DOMNode* DOMNotationImpl::getFirstChild() const {return fNode.getFirstChild (); } 00145 DOMNode* DOMNotationImpl::getLastChild() const {return fNode.getLastChild (); } 00146 const XMLCh* DOMNotationImpl::getLocalName() const {return fNode.getLocalName (); } 00147 const XMLCh* DOMNotationImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } 00148 DOMNode* DOMNotationImpl::getNextSibling() const {return fNode.getNextSibling (); } 00149 const XMLCh* DOMNotationImpl::getNodeValue() const {return fNode.getNodeValue (); } 00150 DOMDocument* DOMNotationImpl::getOwnerDocument() const {return fNode.getOwnerDocument (); } 00151 const XMLCh* DOMNotationImpl::getPrefix() const {return fNode.getPrefix (); } 00152 DOMNode* DOMNotationImpl::getParentNode() const {return fNode.getParentNode (); } 00153 DOMNode* DOMNotationImpl::getPreviousSibling() const {return fNode.getPreviousSibling (); } 00154 bool DOMNotationImpl::hasChildNodes() const {return fNode.hasChildNodes (); } 00155 DOMNode* DOMNotationImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) 00156 {return fNode.insertBefore (newChild, refChild); } 00157 void DOMNotationImpl::normalize() {fNode.normalize (); } 00158 DOMNode* DOMNotationImpl::removeChild(DOMNode *oldChild) {return fNode.removeChild (oldChild); } 00159 DOMNode* DOMNotationImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) 00160 {return fNode.replaceChild (newChild, oldChild); } 00161 bool DOMNotationImpl::isSupported(const XMLCh *feature, const XMLCh *version) const 00162 {return fNode.isSupported (feature, version); } 00163 void DOMNotationImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } 00164 bool DOMNotationImpl::hasAttributes() const {return fNode.hasAttributes(); } 00165 bool DOMNotationImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); } 00166 bool DOMNotationImpl::isEqualNode(const DOMNode* arg) const {return fNode.isEqualNode(arg); } 00167 void* DOMNotationImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) 00168 {return fNode.setUserData(key, data, handler); } 00169 void* DOMNotationImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } 00170 short DOMNotationImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); } 00171 const XMLCh* DOMNotationImpl::getTextContent() const {return fNode.getTextContent(); } 00172 void DOMNotationImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } 00173 const XMLCh* DOMNotationImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); } 00174 bool DOMNotationImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } 00175 const XMLCh* DOMNotationImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } 00176 void* DOMNotationImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); } 00177 00178 00179 XERCES_CPP_NAMESPACE_END