domdocumenttypeimpl.cpp
来自「IBM的解析xml的工具Xerces的源代码」· C++ 代码 · 共 539 行 · 第 1/2 页
CPP
539 行
{ return fEntities;}const XMLCh * DOMDocumentTypeImpl::getName() const{ return fName;}DOMNamedNodeMap *DOMDocumentTypeImpl::getNotations() const{ return fNotations;}DOMNamedNodeMap *DOMDocumentTypeImpl::getElements() const{ return fElements;}void DOMDocumentTypeImpl::setNodeValue(const XMLCh *val){ fNode.setNodeValue(val);}void DOMDocumentTypeImpl::setReadOnly(bool readOnl, bool deep){ fNode.setReadOnly(readOnl,deep); if (fEntities) fEntities->setReadOnly(readOnl,true); if (fNotations) fNotations->setReadOnly(readOnl,true);}//Introduced in DOM Level 2const XMLCh * DOMDocumentTypeImpl::getPublicId() const{ return fPublicId;}const XMLCh * DOMDocumentTypeImpl::getSystemId() const{ return fSystemId;}const XMLCh * DOMDocumentTypeImpl::getInternalSubset() const{ return fInternalSubset;}bool DOMDocumentTypeImpl::isIntSubsetReading() const{ return fIntSubsetReading;}//set functionsvoid DOMDocumentTypeImpl::setPublicId(const XMLCh *value){ // revist. Why shouldn't 0 be assigned like any other value? if (value == 0) return; if ((DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument()) fPublicId = ((DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument())->cloneString(value); else { fPublicId = ((DOMDocumentImpl *)&gDocTypeDocument())->cloneString(value); }}void DOMDocumentTypeImpl::setSystemId(const XMLCh *value){ if ((DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument()) fSystemId = ((DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument())->cloneString(value); else { fSystemId = ((DOMDocumentImpl *)&gDocTypeDocument())->cloneString(value); }}void DOMDocumentTypeImpl::setInternalSubset(const XMLCh *value){ if ((DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument()) fInternalSubset = ((DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument())->cloneString(value); else { fInternalSubset = ((DOMDocumentImpl *)&gDocTypeDocument())->cloneString(value); }}void DOMDocumentTypeImpl::release(){ if (fNode.isOwned()) { if (fNode.isToBeReleased()) { // we are calling from documnet.release() which will notify the user data handler if (fIsCreatedFromHeap) { DOMDocumentType* docType = this; delete docType; } } else throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); } else { if (fIsCreatedFromHeap) { fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); DOMDocumentType* docType = this; delete docType; } else { DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument(); if (doc) { fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); doc->release(this, DOMDocumentImpl::DOCUMENT_TYPE_OBJECT); } else { // shouldn't reach here throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); } } }}//// Delegation for functions inherited from Node// DOMNode* DOMDocumentTypeImpl::appendChild(DOMNode *newChild) {return fParent.appendChild (newChild); } DOMNamedNodeMap* DOMDocumentTypeImpl::getAttributes() const {return fNode.getAttributes (); } DOMNodeList* DOMDocumentTypeImpl::getChildNodes() const {return fParent.getChildNodes (); } DOMNode* DOMDocumentTypeImpl::getFirstChild() const {return fParent.getFirstChild (); } DOMNode* DOMDocumentTypeImpl::getLastChild() const {return fParent.getLastChild (); } const XMLCh* DOMDocumentTypeImpl::getLocalName() const {return fNode.getLocalName (); } const XMLCh* DOMDocumentTypeImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } DOMNode* DOMDocumentTypeImpl::getNextSibling() const {return fChild.getNextSibling (); } const XMLCh* DOMDocumentTypeImpl::getNodeValue() const {return fNode.getNodeValue (); } DOMDocument* DOMDocumentTypeImpl::getOwnerDocument() const {return fParent.fOwnerDocument; } const XMLCh* DOMDocumentTypeImpl::getPrefix() const {return fNode.getPrefix (); } DOMNode* DOMDocumentTypeImpl::getParentNode() const {return fChild.getParentNode (this); } DOMNode* DOMDocumentTypeImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); } bool DOMDocumentTypeImpl::hasChildNodes() const {return fParent.hasChildNodes (); } DOMNode* DOMDocumentTypeImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) {return fParent.insertBefore (newChild, refChild); } void DOMDocumentTypeImpl::normalize() {fParent.normalize (); } DOMNode* DOMDocumentTypeImpl::removeChild(DOMNode *oldChild) {return fParent.removeChild (oldChild); } DOMNode* DOMDocumentTypeImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) {return fParent.replaceChild (newChild, oldChild); } bool DOMDocumentTypeImpl::isSupported(const XMLCh *feature, const XMLCh *version) const {return fNode.isSupported (feature, version); } void DOMDocumentTypeImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } bool DOMDocumentTypeImpl::hasAttributes() const {return fNode.hasAttributes(); } bool DOMDocumentTypeImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); } void* DOMDocumentTypeImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) {return fNode.setUserData(key, data, handler); } void* DOMDocumentTypeImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } const XMLCh* DOMDocumentTypeImpl::getBaseURI() const {return fNode.getBaseURI(); } short DOMDocumentTypeImpl::compareTreePosition(const DOMNode* other) const {return fNode.compareTreePosition(other); } const XMLCh* DOMDocumentTypeImpl::getTextContent() const {return fNode.getTextContent(); } void DOMDocumentTypeImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } const XMLCh* DOMDocumentTypeImpl::lookupNamespacePrefix(const XMLCh* namespaceURI, bool useDefault) const {return fNode.lookupNamespacePrefix(namespaceURI, useDefault); } bool DOMDocumentTypeImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } const XMLCh* DOMDocumentTypeImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } DOMNode* DOMDocumentTypeImpl::getInterface(const XMLCh* feature) {return fNode.getInterface(feature); }bool DOMDocumentTypeImpl::isEqualNode(const DOMNode* arg) const{ if (isSameNode(arg)) { return true; } if (!fNode.isEqualNode(arg)) { return false; } DOMDocumentType* argDT = (DOMDocumentType*) arg; // check the string values if (!getPublicId()) { if (argDT->getPublicId()) { return false; } } else if (!XMLString::equals(getPublicId(), argDT->getPublicId())) { return false; } if (!getSystemId()) { if (argDT->getSystemId()) { return false; } } else if (!XMLString::equals(getSystemId(), argDT->getSystemId())) { return false; } if (!getInternalSubset()) { if (argDT->getInternalSubset()) { return false; } } else if (!XMLString::equals(getInternalSubset(), argDT->getInternalSubset())) { return false; } // check the notations if (getNotations()) { if (!argDT->getNotations()) return false; DOMNamedNodeMap* map1 = getNotations(); DOMNamedNodeMap* map2 = argDT->getNotations(); XMLSize_t len = map1->getLength(); if (len != map2->getLength()) { return false; } for (XMLSize_t i = 0; i < len; i++) { DOMNode* n1 = map1->item(i); DOMNode* n2 = map2->getNamedItem(n1->getNodeName()); if (!n2 || !n1->isEqualNode(n2)) { return false; } } } else { if (argDT->getNotations()) return false; } // check the entities if (getEntities()) { if (!argDT->getEntities()) return false; DOMNamedNodeMap* map1 = getEntities(); DOMNamedNodeMap* map2 = argDT->getEntities(); XMLSize_t len = map1->getLength(); if (len != map2->getLength()) { return false; } for (XMLSize_t i = 0; i < len; i++) { DOMNode* n1 = map1->item(i); DOMNode* n2 = map2->getNamedItem(n1->getNodeName()); if (!n2 || !n1->isEqualNode(n2)) { return false; } } } else { if (argDT->getEntities()) return false; } return fParent.isEqualNode(arg);}XERCES_CPP_NAMESPACE_END
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?