diff --git a/src/xercesc/dom/deprecated/AttrImpl.cpp b/src/xercesc/dom/deprecated/AttrImpl.cpp deleted file mode 100644 index 156e984605090b062217cb06e0b1b4ddb4b90f0b..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/AttrImpl.cpp +++ /dev/null @@ -1,691 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - * - * <p><b>WARNING</b>: Some of the code here is partially duplicated in - * ParentNode, be careful to keep these two classes in sync! - */ - -#include "AttrImpl.hpp" -#include "DOM_DOMException.hpp" -#include "DocumentImpl.hpp" -#include "TextImpl.hpp" -#include "ElementImpl.hpp" -#include "DStringPool.hpp" -#include "NodeIDMap.hpp" -#include "RangeImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -/* - * The handling of the value field being either the first child node (a - * ChildNode*) or directly the value (a DOMString) is rather tricky. In the - * DOMString case we need to get the field in the right type so that the - * compiler is happy and the appropriate operator gets called. This is - * essential for the reference counts of the DOMStrings involved to be updated - * as due. - * This is consistently achieved by taking the address of the value field and - * changing it into a DOMString*, and then dereferencing it to get a DOMString. - * The typical piece of code is: - * DOMString *x = (DomString *)&value; - * ... use of *x which is the DOMString ... - * This was amended by neilg after memory management was - * introduced. Now a union exists which is either a - * DOMString * or a ChildNode *. This will be less efficient - * (one more dereference per access) but actually works on all the - * compilers we support. - */ - -AttrImpl::AttrImpl(DocumentImpl *ownerDoc, const DOMString &aName) - : NodeImpl (ownerDoc) -{ - name = aName.clone(); - isSpecified(true); - hasStringValue(true); - value.child = null; -}; - -AttrImpl::AttrImpl(const AttrImpl &other, bool /*deep*/) - : NodeImpl(other) -{ - name = other.name.clone(); - - isSpecified(other.isSpecified()); - - /* We must initialize the void* value to null in *all* cases. Failing to do - * so would cause, in case of assignment to a DOMString later, its content - * to be derefenced as a DOMString, which would lead the ref count code to - * be called on something that is not actually a DOMString... Really bad - * things would then happen!!! - */ - value.child = null; - hasStringValue(other.hasStringValue()); - - if (other.isIdAttr()) - { - isIdAttr(true); - this->getOwnerDocument()->getNodeIDMap()->add(this); - } - - // take care of case where there are kids - if (!hasStringValue()) { - cloneChildren(other); - } - else { - if(other.value.str == null) - { - if(value.str != null) - { - *(value.str) = null; - delete value.str; - value.str = null; - } - } - else - { - // get the address of the value field of this as a DOMString* - DOMString *x = (value.str == null - ?(value.str = new (getOwnerDocument()->getMemoryManager()) DOMString()) - :value.str - ); - // and the address of the value field of other as a DOMString* - DOMString *y = other.value.str; - // We can now safely do the cloning and assignement, both operands - // being a DOMString their ref counts will be updated appropriately - *x = y->clone(); - } - } -}; - - -AttrImpl::~AttrImpl() { - if (hasStringValue()) { - // if value is a DOMString we must make sure its ref count is updated. - // this is achieved by changing the address of the value field into a - // DOMString* and setting the value field to null - if(value.str != null) - { - *(value.str) = null; - delete value.str; - value.str = null; - } - } -} - - -// create a real Text node as child if we don't have one yet -void AttrImpl::makeChildNode() { - if (hasStringValue()) { - if (value.child != null) { - // change the address of the value field into a DOMString* - DOMString *x = (value.str == null - ?(value.str = new (getOwnerDocument()->getMemoryManager()) DOMString()) - :value.str - ); - // create a Text node passing the DOMString it points to - TextImpl *text = - (TextImpl *) getOwnerDocument()->createTextNode(*x); - // get the DOMString ref count to be updated by setting the value - // field to null - *x = null; - delete x; - // finally reassign the value to the node address - value.child = text; - text->isFirstChild(true); - text->previousSibling = text; - text->ownerNode = this; - text->isOwned(true); - } - hasStringValue(false); - } -} - -NodeImpl * AttrImpl::cloneNode(bool deep) -{ - return new (getOwnerDocument()->getMemoryManager()) AttrImpl(*this, deep); -}; - - -DOMString AttrImpl::getNodeName() { - return name; -}; - - -short AttrImpl::getNodeType() { - return DOM_Node::ATTRIBUTE_NODE; -}; - - -DOMString AttrImpl::getName() -{ - return name; -}; - - -DOMString AttrImpl::getNodeValue() -{ - return getValue(); -}; - - -bool AttrImpl::getSpecified() -{ - return isSpecified(); -}; - - - - -DOMString AttrImpl::getValue() -{ - if (value.child == null) { - return 0; // return ""; - } - if (hasStringValue()) { - // change value into a DOMString* - DOMString *x = (value.str == null - ?(value.str = new (getOwnerDocument()->getMemoryManager()) DOMString()) - :value.str - ); - // return the DOMString it points to - return *x; - } - ChildNode *firstChild = value.child; - ChildNode *node = firstChild->nextSibling; - if (node == null) { - return firstChild->getNodeValue().clone(); - } - int length = 0; - for (node = firstChild; node != null; node = node->nextSibling) - length += node->getNodeValue().length(); - - DOMString retString; - retString.reserve(length); - for (node = firstChild; node != null; node = node->nextSibling) - { - retString.appendData(node->getNodeValue()); - }; - - return retString; -}; - - -bool AttrImpl::isAttrImpl() -{ - return true; -}; - - -void AttrImpl::setNodeValue(const DOMString &val) -{ - setValue(val); -}; - - - -void AttrImpl::setSpecified(bool arg) -{ - isSpecified(arg); -}; - - - -void AttrImpl::setValue(const DOMString &newvalue) -{ - if (isReadOnly()) - { - throw DOM_DOMException - ( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null - ); - } - - // If this attribute was of type ID and in the map, take it out, - // then put it back in with the new name. For now, we don't worry - // about what happens if the new name conflicts - // - if (isIdAttr()) - this->getOwnerDocument()->getNodeIDMap()->remove(this); - - if (!hasStringValue() && value.str != null) { - NodeImpl *kid; - while ((kid = value.child) != null) { // Remove existing kids - removeChild(kid); - if (kid->nodeRefCount == 0) - NodeImpl::deleteIf(kid); - } - } - - // directly store the string as the value by changing the value field - // into a DOMString - DOMString *x = (value.str == null - ?(value.str = new (getOwnerDocument()->getMemoryManager()) DOMString()) - :value.str - ); - if (newvalue != null) { - *x = newvalue.clone(); - } - else { - *x = null; - delete x; - value.str = null; - } - hasStringValue(true); - isSpecified(true); - changed(); - - if (isIdAttr()) - this->getOwnerDocument()->getNodeIDMap()->add(this); - -}; - - - -DOMString AttrImpl::toString() -{ - DOMString retString; - - retString.appendData(name); - retString.appendData(DOMString("=\"")); - retString.appendData(getValue()); - retString.appendData(DOMString("\"")); - return retString; -} - - -//Introduced in DOM Level 2 - -ElementImpl *AttrImpl::getOwnerElement() -{ - // if we have an owner, ownerNode is our ownerElement, otherwise it's - // our ownerDocument and we don't have an ownerElement - return (ElementImpl *) (isOwned() ? ownerNode : null); -} - - -//internal use by parser only -void AttrImpl::setOwnerElement(ElementImpl *ownerElem) -{ - ownerNode = ownerElem; - isOwned(false); -} - - -// ParentNode stuff - -void AttrImpl::cloneChildren(const NodeImpl &other) { - // for (NodeImpl *mykid = other.getFirstChild(); - for (NodeImpl *mykid = ((NodeImpl&)other).getFirstChild(); - mykid != null; - mykid = mykid->getNextSibling()) { - this->appendChild(mykid->cloneNode(true)); - } -} - -NodeListImpl *AttrImpl::getChildNodes() { - return this; -} - - -NodeImpl * AttrImpl::getFirstChild() { - makeChildNode(); - return value.child; -} - - -NodeImpl * AttrImpl::getLastChild() { - return lastChild(); -} - -ChildNode * AttrImpl::lastChild() { - // last child is stored as the previous sibling of first child - makeChildNode(); - return value.child != null ? (value.child)->previousSibling : null; -} - -void AttrImpl::lastChild(ChildNode *node) { - // store lastChild as previous sibling of first child - if (value.child != null) { - (value.child)->previousSibling = node; - } -} - -unsigned int AttrImpl::getLength() { - if (hasStringValue()) { - return 1; - } - ChildNode *node = value.child; - int length = 0; - while (node != null) { - length++; - node = node->nextSibling; - } - return length; -} - -bool AttrImpl::hasChildNodes() -{ - return value.child != null; -}; - - - -NodeImpl *AttrImpl::insertBefore(NodeImpl *newChild, NodeImpl *refChild) { - - DocumentImpl *ownerDocument = getOwnerDocument(); - bool errorChecking = ownerDocument->getErrorChecking(); - - if (newChild->isDocumentFragmentImpl()) { - // SLOW BUT SAFE: We could insert the whole subtree without - // juggling so many next/previous pointers. (Wipe out the - // parent's child-list, patch the parent pointers, set the - // ends of the list.) But we know some subclasses have special- - // case behavior they add to insertBefore(), so we don't risk it. - // This approch also takes fewer bytecodes. - - // NOTE: If one of the children is not a legal child of this - // node, throw HIERARCHY_REQUEST_ERR before _any_ of the children - // have been transferred. (Alternative behaviors would be to - // reparent up to the first failure point or reparent all those - // which are acceptable to the target node, neither of which is - // as robust. PR-DOM-0818 isn't entirely clear on which it - // recommends????? - - // No need to check kids for right-document; if they weren't, - // they wouldn't be kids of that DocFrag. - if (errorChecking) { - for (NodeImpl *kid = newChild->getFirstChild(); // Prescan - kid != null; kid = kid->getNextSibling()) { - - if (!DocumentImpl::isKidOK(this, kid)) { - throw DOM_DOMException( - DOM_DOMException::HIERARCHY_REQUEST_ERR, - null); - } - } - } - - while (newChild->hasChildNodes()) { // Move - insertBefore(newChild->getFirstChild(), refChild); - } - return newChild; - } - - // it's a no-op if refChild is the same as newChild - if (refChild == newChild) { - return newChild; - } - - if (errorChecking) { - if (isReadOnly()) { - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - } - if (newChild->getOwnerDocument() != ownerDocument) { - throw DOM_DOMException(DOM_DOMException::WRONG_DOCUMENT_ERR, null); - } - if (!DocumentImpl::isKidOK(this, newChild)) { - throw DOM_DOMException(DOM_DOMException::HIERARCHY_REQUEST_ERR, - null); - } - // refChild must be a child of this node (or null) - if (refChild != null && refChild->getParentNode() != this) { - throw DOM_DOMException(DOM_DOMException::NOT_FOUND_ERR, null); - } - - // Prevent cycles in the tree - // newChild cannot be ancestor of this Node, - // and actually cannot be this - bool treeSafe = true; - for (NodeImpl *a = this; treeSafe && a != null; a = a->getParentNode()) - { - treeSafe = (newChild != a); - } - if (!treeSafe) { - throw DOM_DOMException(DOM_DOMException::HIERARCHY_REQUEST_ERR, - null); - } - } - - makeChildNode(); // make sure we have a node and not a string - - // Convert to internal type, to avoid repeated casting - ChildNode * newInternal = (ChildNode *)newChild; - - NodeImpl *oldparent = newInternal->getParentNode(); - if (oldparent != null) { - oldparent->removeChild(newInternal); - } - - // Convert to internal type, to avoid repeated casting - ChildNode *refInternal = (ChildNode *)refChild; - - // Attach up - newInternal->ownerNode = this; - newInternal->isOwned(true); - - // Attach before and after - // Note: firstChild.previousSibling == lastChild!! - ChildNode *firstChild = value.child; - if (firstChild == null) { - // this our first and only child - value.child = newInternal; // firstChild = newInternal - newInternal->isFirstChild(true); - newInternal->previousSibling = newInternal; - } - else { - if (refInternal == null) { - // this is an append - ChildNode *lastChild = firstChild->previousSibling; - lastChild->nextSibling = newInternal; - newInternal->previousSibling = lastChild; - firstChild->previousSibling = newInternal; - } - else { - // this is an insert - if (refChild == firstChild) { - // at the head of the list - firstChild->isFirstChild(false); - newInternal->nextSibling = firstChild; - newInternal->previousSibling = firstChild->previousSibling; - firstChild->previousSibling = newInternal; - value.child = newInternal; // firstChild = newInternal; - newInternal->isFirstChild(true); - } - else { - // somewhere in the middle - ChildNode *prev = refInternal->previousSibling; - newInternal->nextSibling = refInternal; - prev->nextSibling = newInternal; - refInternal->previousSibling = newInternal; - newInternal->previousSibling = prev; - } - } - } - - changed(); - - if (this->getOwnerDocument() != null) { - typedef RefVectorOf<RangeImpl> RangeImpls; - RangeImpls* ranges = this->getOwnerDocument()->getRanges(); - if ( ranges != null) { - unsigned int sz = ranges->size(); - for (unsigned int i =0; i<sz; i++) { - ranges->elementAt(i)->updateRangeForInsertedNode(newInternal); - } - } - } - - return newInternal; -} - - -NodeImpl *AttrImpl::item(unsigned int index) { - - if (hasStringValue()) { - if (index != 0 || value.child == null) { - return null; - } - else { - makeChildNode(); - return (NodeImpl *) (value.child); - } - } - ChildNode *nodeListNode = value.child; - for (unsigned int nodeListIndex = 0; - nodeListIndex < index && nodeListNode != null; - nodeListIndex++) { - nodeListNode = nodeListNode->nextSibling; - } - return nodeListNode; -} - - -NodeImpl *AttrImpl::removeChild(NodeImpl *oldChild) { - - DocumentImpl *ownerDocument = getOwnerDocument(); - if (ownerDocument->getErrorChecking()) { - if (isReadOnly()) { - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - } - if (oldChild == null || oldChild->getParentNode() != this) { - throw DOM_DOMException(DOM_DOMException::NOT_FOUND_ERR, null); - } - } - // fix other ranges for change before deleting the node - if (getOwnerDocument() != null) { - typedef RefVectorOf<RangeImpl> RangeImpls; - RangeImpls* ranges = this->getOwnerDocument()->getRanges(); - if (ranges != null) { - unsigned int sz = ranges->size(); - if (sz != 0) { - for (unsigned int i =0; i<sz; i++) { - if (ranges->elementAt(i) != null) - ranges->elementAt(i)->updateRangeForDeletedNode(oldChild); - } - } - } - } - - ChildNode * oldInternal = (ChildNode *) oldChild; - - // Patch linked list around oldChild - // Note: lastChild == firstChild->previousSibling - if (oldInternal == value.child) { - // removing first child - oldInternal->isFirstChild(false); - value.child = oldInternal->nextSibling; // firstChild = oldInternal->nextSibling - ChildNode *firstChild = value.child; - if (firstChild != null) { - firstChild->isFirstChild(true); - firstChild->previousSibling = oldInternal->previousSibling; - } - } else { - ChildNode *prev = oldInternal->previousSibling; - ChildNode *next = oldInternal->nextSibling; - prev->nextSibling = next; - if (next == null) { - // removing last child - ChildNode *firstChild = value.child; - firstChild->previousSibling = prev; - } else { - // removing some other child in the middle - next->previousSibling = prev; - } - } - - // Remove oldInternal's references to tree - oldInternal->ownerNode = getOwnerDocument(); - oldInternal->isOwned(false); - oldInternal->nextSibling = null; - oldInternal->previousSibling = null; - - changed(); - - return oldInternal; -}; - - -NodeImpl *AttrImpl::replaceChild(NodeImpl *newChild, NodeImpl *oldChild) { - insertBefore(newChild, oldChild); - if (newChild != oldChild) { - removeChild(oldChild); - } - // changed() already done. - return oldChild; -} - - -void AttrImpl::setReadOnly(bool readOnl, bool deep) { - NodeImpl::setReadOnly(readOnl, deep); - - if (deep) { - if (hasStringValue()) { - return; - } - // Recursively set kids - for (ChildNode *mykid = value.child; - mykid != null; - mykid = mykid->nextSibling) - if(! (mykid->isEntityReference())) - mykid->setReadOnly(readOnl,true); - } -} - - -//Introduced in DOM Level 2 - -void AttrImpl::normalize() -{ - if (hasStringValue()) { - return; - } - ChildNode *kid, *next; - for (kid = value.child; kid != null; kid = next) - { - next = kid->nextSibling; - - // If kid and next are both Text nodes (but _not_ CDATASection, - // which is a subclass of Text), they can be merged. - if (next != null && - kid->isTextImpl() && !(kid->isCDATASectionImpl()) && - next->isTextImpl() && !(next->isCDATASectionImpl()) ) - { - ((TextImpl *) kid)->appendData(((TextImpl *) next)->getData()); - removeChild(next); - if (next->nodeRefCount == 0) - deleteIf(next); - next = kid; // Don't advance; there might be another. - } - - // Otherwise it might be an Element, which is handled recursively - else - if (kid->isElementImpl()) - kid->normalize(); - }; - - // changed() will have occurred when the removeChild() was done, - // so does not have to be reissued. -}; - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/AttrImpl.hpp b/src/xercesc/dom/deprecated/AttrImpl.hpp deleted file mode 100644 index fd65275d5b96b531b323f413713519be64fb22fb..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/AttrImpl.hpp +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef AttrImpl_HEADER_GUARD_ -#define AttrImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - -/** - * Attribute represents an XML-style attribute of an - * Element. Typically, the allowable values are controlled by its - * declaration in the Document Type Definition (DTD) governing this - * kind of document. - * <P> - * If the attribute has not been explicitly assigned a value, but has - * been declared in the DTD, it will exist and have that default. Only - * if neither the document nor the DTD specifies a value will the - * Attribute really be considered absent and have no value; in that - * case, querying the attribute will return null. - * <P> - * Attributes may have multiple children that contain their data. (XML - * allows attributes to contain entity references, and tokenized - * attribute types such as NMTOKENS may have a child for each token.) - * For convenience, the Attribute object's getValue() method returns - * the string version of the attribute's value. - * <P> - * Attributes are not children of the Elements they belong to, in the - * usual sense, and have no valid Parent reference. However, the spec - * says they _do_ belong to a specific Element, and an INUSE exception - * is to be thrown if the user attempts to explicitly share them - * between elements. - * <P> - * Note that Elements do not permit attributes to appear to be shared - * (see the INUSE exception), so this object's mutability is - * officially not an issue. - * <p> - * Note: The ownerNode attribute is used to store the Element the Attr - * node is associated with. Attr nodes do not have parent nodes. - * Besides, the getOwnerElement() method can be used to get the element node - * this attribute is associated with. - * <P> - * AttrImpl does not support Namespaces. AttrNSImpl, which inherits from - * it, does. - * - * <p>AttrImpl used to inherit from ParentNode. It now directly inherits from - * NodeImpl and provide its own implementation of the ParentNode's behavior. - * The reason is that we now try and avoid to always creating a Text node to - * hold the value of an attribute. The DOM spec requires it, so we still have - * to do it in case getFirstChild() is called for instance. The reason - * attribute values are stored as a list of nodes is so that they can carry - * more than a simple string. They can also contain EntityReference nodes. - * However, most of the times people only have a single string that they only - * set and get through Element.set/getAttribute or Attr.set/getValue. In this - * new version, the Attr node has a value pointer which can either be the - * String directly or a pointer to the first ChildNode. A flag tells which one - * it currently is. Note that while we try to stick with the direct String as - * much as possible once we've switched to a node there is no going back. This - * is because we have no way to know whether the application keeps referring to - * the node we once returned. - * <p> The gain in memory varies on the density of attributes in the document. - * But in the tests I've run I've seen up to 12% of memory gain. And the good - * thing is that it also leads to a slight gain in speed because we allocate - * fewer objects! I mean, that's until we have to actually create the node... - * <p> - * To avoid too much duplicated code, I got rid of ParentNode and renamed - * ChildAndParentNode, which I never really liked, to ParentNode for - * simplicity, this doesn't make much of a difference in memory usage because - * there are only very objects that are only a Parent. This is only true now - * because AttrImpl now inherits directly from NodeImpl and has its own - * implementation of the ParentNode's node behavior. So there is still some - * duplicated code there. - * - * <p><b>WARNING</b>: Some of the code here is partially duplicated in - * ParentNode, be careful to keep these two classes in sync! - * - * $Id$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - - -#include <xercesc/util/XercesDefs.hpp> -#include "ChildNode.hpp" -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class ElementImpl; - -class DEPRECATED_DOM_EXPORT AttrImpl: public NodeImpl { - -public: - DOMString name; - - /** This can either be a DOMString or the first child node (ChildNode*). */ - union { - ChildNode *child; - DOMString *str; - } value; - -public: - AttrImpl(DocumentImpl *ownerDocument, const DOMString &aName); - AttrImpl(const AttrImpl &other, bool deep=false); - virtual ~AttrImpl(); - virtual NodeImpl *cloneNode(bool deep=false); - virtual DOMString getNodeName(); - virtual short getNodeType(); - virtual DOMString getName(); - virtual DOMString getNodeValue(); - virtual bool getSpecified(); - virtual DOMString getValue(); - virtual bool isAttrImpl(); - virtual void setNodeValue(const DOMString &value); - virtual void setSpecified(bool arg); - virtual void setValue(const DOMString &value); - virtual DOMString toString(); - - //Introduced in DOM Level 2 - ElementImpl *getOwnerElement(); - void setOwnerElement(ElementImpl *ownerElem); //internal use only - - - // ParentNode stuff - virtual NodeListImpl *getChildNodes(); - virtual NodeImpl * getFirstChild(); - virtual NodeImpl * getLastChild(); - virtual unsigned int getLength(); - virtual bool hasChildNodes(); - virtual NodeImpl *insertBefore(NodeImpl *newChild, NodeImpl *refChild); - virtual NodeImpl *item(unsigned int index); - virtual NodeImpl *removeChild(NodeImpl *oldChild); - virtual NodeImpl *replaceChild(NodeImpl *newChild, NodeImpl *oldChild); - virtual void setReadOnly(bool isReadOnly, bool deep); - - //Introduced in DOM Level 2 - virtual void normalize(); - -protected: - void makeChildNode(); - void cloneChildren(const NodeImpl &other); - ChildNode * lastChild(); - void lastChild(ChildNode *); - inline DOMString* valueToDOMString(); - -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/AttrMapImpl.cpp b/src/xercesc/dom/deprecated/AttrMapImpl.cpp deleted file mode 100644 index 472630912028c8a29457be631cee7a82bf406485..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/AttrMapImpl.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "AttrMapImpl.hpp" -#include "NamedNodeMapImpl.hpp" -#include "NodeImpl.hpp" -#include "ElementImpl.hpp" -#include "DocumentImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -AttrMapImpl::AttrMapImpl(NodeImpl *ownerNod) - : NamedNodeMapImpl(ownerNod) -{ - hasDefaults(false); -} - -AttrMapImpl::AttrMapImpl(NodeImpl *ownerNod, NamedNodeMapImpl *defaults) - : NamedNodeMapImpl(ownerNod) -{ - hasDefaults(false); - if (defaults != null) - { - if (defaults->getLength() > 0) - { - hasDefaults(true); - cloneContent(defaults); - } - } -} - -AttrMapImpl::~AttrMapImpl() -{ -} - -AttrMapImpl *AttrMapImpl::cloneAttrMap(NodeImpl *ownerNode_p) -{ - AttrMapImpl *newmap = new (ownerNode_p->getDocument()->getMemoryManager()) AttrMapImpl(ownerNode_p); - newmap->cloneContent(this); - newmap->attrDefaults = this->attrDefaults; - return newmap; -} - -NodeImpl *AttrMapImpl::removeNamedItem(const DOMString &name) -{ - NodeImpl* removed = NamedNodeMapImpl::removeNamedItem(name); - - // Replace it if it had a default value - // (DOM spec level 1 - Element Interface) - if (hasDefaults() && (removed != null)) - { - AttrMapImpl* defAttrs = ((ElementImpl*)ownerNode)->getDefaultAttributes(); - AttrImpl* attr = (AttrImpl*)(defAttrs->getNamedItem(name)); - if (attr != null) - { - AttrImpl* newAttr = (AttrImpl*)attr->cloneNode(true); - setNamedItem(newAttr); - } - } - - return removed; -} - -NodeImpl *AttrMapImpl::removeNamedItemNS(const DOMString &namespaceURI, const DOMString &localName) -{ - NodeImpl* removed = NamedNodeMapImpl::removeNamedItemNS(namespaceURI, localName); - - // Replace it if it had a default value - // (DOM spec level 2 - Element Interface) - if (hasDefaults() && (removed != null)) - { - AttrMapImpl* defAttrs = ((ElementImpl*)ownerNode)->getDefaultAttributes(); - AttrImpl* attr = (AttrImpl*)(defAttrs->getNamedItemNS(namespaceURI, localName)); - if (attr != null) - { - AttrImpl* newAttr = (AttrImpl*)attr->cloneNode(true); - setNamedItem(newAttr); - } - } - - return removed; -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/AttrMapImpl.hpp b/src/xercesc/dom/deprecated/AttrMapImpl.hpp deleted file mode 100644 index 0c3e134a8903436d1a4219cb4ca847ad56c83a38..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/AttrMapImpl.hpp +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef AttrMapImpl_HEADER_GUARD_ -#define AttrMapImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -/* - * $Id$ - */ - -#include <xercesc/util/XercesDefs.hpp> -#include "AttrImpl.hpp" -#include "NodeImpl.hpp" -#include "NamedNodeMapImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class NamedNodeMapImpl; - -class DEPRECATED_DOM_EXPORT AttrMapImpl : public NamedNodeMapImpl -{ -private: - bool attrDefaults; - -public: - AttrMapImpl(NodeImpl *ownerNod); - AttrMapImpl(NodeImpl *ownerNod, NamedNodeMapImpl *defaults); - virtual ~AttrMapImpl(); - virtual AttrMapImpl *cloneAttrMap(NodeImpl *ownerNode); - virtual bool hasDefaults(); - virtual void hasDefaults(bool value); - - virtual NodeImpl *removeNamedItem(const DOMString &name); - virtual NodeImpl *removeNamedItemNS(const DOMString &namespaceURI, const DOMString &localName); -}; - -// --------------------------------------------------------------------------- -// AttrMapImpl: Getters & Setters -// --------------------------------------------------------------------------- - -inline bool AttrMapImpl::hasDefaults() -{ - return attrDefaults; -} - -inline void AttrMapImpl::hasDefaults(bool value) -{ - attrDefaults = value; -} - - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/AttrNSImpl.cpp b/src/xercesc/dom/deprecated/AttrNSImpl.cpp deleted file mode 100644 index 1949457f8f25e3f507992db8e824a9f0d781d1f2..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/AttrNSImpl.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include <xercesc/util/XMLUniDefs.hpp> -#include "AttrNSImpl.hpp" -#include "DocumentImpl.hpp" -#include "DOM_DOMException.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - - -AttrNSImpl::AttrNSImpl(DocumentImpl *ownerDoc, const DOMString &nam) : - AttrImpl(ownerDoc, nam) -{ - this->namespaceURI=null; //DOM Level 2 - this->localName=null; //DOM Level 2 -} - -//Introduced in DOM Level 2 -AttrNSImpl::AttrNSImpl(DocumentImpl *ownerDoc, - const DOMString &fNamespaceURI, - const DOMString &qualifiedName) : - AttrImpl(ownerDoc, qualifiedName) -{ - DOMString xmlns = NodeImpl::getXmlnsString(); - DOMString xmlnsURI = NodeImpl::getXmlnsURIString(); - this->name = qualifiedName.clone(); - - int index = DocumentImpl::indexofQualifiedName(qualifiedName); - DOMString prefix; - if (index < 0) - throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - bool xmlnsAlone = false; //true if attribute name is "xmlns" - if (index == 0) { //qualifiedName contains no ':' - if (this->name.equals(xmlns)) { - if (!fNamespaceURI.equals(xmlnsURI)) - throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - xmlnsAlone = true; - } - prefix = null; - this -> localName = this -> name; - } else { //0 < index < this->name.length()-1 - prefix = this->name.substringData(0, index); - this -> localName = - this->name.substringData(index+1, this->name.length()-index-1); - } - - const DOMString& URI = xmlnsAlone ? - xmlnsURI : mapPrefix(prefix, fNamespaceURI, DOM_Node::ATTRIBUTE_NODE); - this -> namespaceURI = URI == null ? DOMString(null) : URI.clone(); -}; - -AttrNSImpl::AttrNSImpl(const AttrNSImpl &other, bool deep) : - AttrImpl(other, deep) -{ - this->namespaceURI = other.namespaceURI.clone(); //DOM Level 2 - this->localName = other.localName.clone(); //DOM Level 2 -}; - -NodeImpl * AttrNSImpl::cloneNode(bool deep) -{ - return new (getOwnerDocument()->getMemoryManager()) AttrNSImpl(*this, deep); -}; - -DOMString AttrNSImpl::getNamespaceURI() -{ - return namespaceURI; -} - -DOMString AttrNSImpl::getPrefix() -{ - int index = DocumentImpl::indexofQualifiedName(name); - if (index == 0) - return null; - else - return name.substringData(0, index); -} - -DOMString AttrNSImpl::getLocalName() -{ - return localName; -} - -void AttrNSImpl::setPrefix(const DOMString &prefix) -{ - DOMString xml = NodeImpl::getXmlString(); - DOMString xmlURI = NodeImpl::getXmlURIString(); - DOMString xmlns = NodeImpl::getXmlnsString(); - DOMString xmlnsURI = NodeImpl::getXmlnsURIString(); - - if (getOwnerDocument()->getErrorChecking()) { - if (isReadOnly()) { - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - } - if (namespaceURI == null || localName.equals(xmlns)) { - throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - } - if (prefix != null && !((DocumentImpl *)this->getOwnerDocument())->isXMLName(prefix)) { - throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR, - null); - } - } - if (prefix == null || prefix.length() == 0) { - name = localName; - return; - } - if (getOwnerDocument()->getErrorChecking() && - (prefix.equals(xml) && !namespaceURI.equals(xmlURI) || - prefix.equals(xmlns) && !namespaceURI.equals(xmlnsURI))) { - throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - } - const XMLCh *p = prefix.rawBuffer(); - for (int i = prefix.length(); --i >= 0;) - if (*p++ == chColon) //prefix is malformed - throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - - name = prefix + chColon + localName; //nodeName is changed too -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/AttrNSImpl.hpp b/src/xercesc/dom/deprecated/AttrNSImpl.hpp deleted file mode 100644 index f1fe68cbb7a169e75dc6febcdfbf5deac43614f6..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/AttrNSImpl.hpp +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef AttrNSImpl_HEADER_GUARD_ -#define AttrNSImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - -#include "AttrImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - - -class DEPRECATED_DOM_EXPORT AttrNSImpl: public AttrImpl { -protected: - //Introduced in DOM Level 2 - DOMString namespaceURI; //namespace URI of this node - DOMString localName; //local part of qualified name - - -public: - AttrNSImpl(DocumentImpl *ownerDoc, const DOMString &name); - AttrNSImpl(DocumentImpl *ownerDoc, //DOM Level 2 - const DOMString &namespaceURI, const DOMString &qualifiedName); - AttrNSImpl(const AttrNSImpl &other, bool deep=false); - - virtual NodeImpl * cloneNode(bool deep); - //Introduced in DOM Level 2 - virtual DOMString getNamespaceURI(); - virtual DOMString getPrefix(); - virtual DOMString getLocalName(); - virtual void setPrefix(const DOMString &prefix); -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/CDATASectionImpl.cpp b/src/xercesc/dom/deprecated/CDATASectionImpl.cpp deleted file mode 100644 index b4359f6b32c8bf0a721f1b1cd8f1d6df307d3b7c..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/CDATASectionImpl.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "CDATASectionImpl.hpp" -#include "DOM_Node.hpp" -#include "DocumentImpl.hpp" -#include "DStringPool.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -static DOMString *gcdata_section = 0; // will be lazily initialized -static XMLRegisterCleanup gcdata_sectionCleanup; - -CDATASectionImpl::CDATASectionImpl(DocumentImpl *ownerDoc, - const DOMString &dat) - : TextImpl(ownerDoc, dat) -{ -}; - - -CDATASectionImpl::CDATASectionImpl(const CDATASectionImpl &other, bool deep) - : TextImpl(other, deep) -{ -}; - - -CDATASectionImpl::~CDATASectionImpl() -{ -}; - - -NodeImpl *CDATASectionImpl::cloneNode(bool deep) -{ - return new (getOwnerDocument()->getMemoryManager()) CDATASectionImpl(*this, deep); -}; - - -DOMString CDATASectionImpl::getNodeName() { - - return DStringPool::getStaticString("#cdata-section" - , &gcdata_section - , reinitCDATASectionImpl - , gcdata_sectionCleanup); -}; - - -short CDATASectionImpl::getNodeType() { - return DOM_Node::CDATA_SECTION_NODE; -}; - - -bool CDATASectionImpl::isCDATASectionImpl() -{ - return true; -}; - -// ----------------------------------------------------------------------- -// Notification that lazy data has been deleted -// ----------------------------------------------------------------------- -void CDATASectionImpl::reinitCDATASectionImpl() { - delete gcdata_section; - gcdata_section = 0; -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/CDATASectionImpl.hpp b/src/xercesc/dom/deprecated/CDATASectionImpl.hpp deleted file mode 100644 index 9791b672ef85692287c9ce8766af8f338695cfc4..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/CDATASectionImpl.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef CDATASectionImpl_HEADER_GUARD_ -#define CDATASectionImpl_HEADER_GUARD_ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - -#include <xercesc/util/XercesDefs.hpp> -#include "TextImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DEPRECATED_DOM_EXPORT CDATASectionImpl: public TextImpl { -public: - CDATASectionImpl(DocumentImpl *ownerDoc, const DOMString & data); - CDATASectionImpl(const CDATASectionImpl &other, bool deep = false); - - virtual ~CDATASectionImpl(); - virtual NodeImpl *cloneNode(bool deep); - virtual DOMString getNodeName(); - virtual short getNodeType(); - virtual bool isCDATASectionImpl(); - - // ----------------------------------------------------------------------- - // Notification that lazy data has been deleted - // ----------------------------------------------------------------------- - static void reinitCDATASectionImpl(); -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/CharacterDataImpl.cpp b/src/xercesc/dom/deprecated/CharacterDataImpl.cpp deleted file mode 100644 index 920ec1ecb663088a67c6628afffd974e1b27aad1..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/CharacterDataImpl.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "CharacterDataImpl.hpp" -#include "DOM_DOMException.hpp" -#include "RangeImpl.hpp" -#include "DocumentImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -CharacterDataImpl::CharacterDataImpl(DocumentImpl *ownerDoc, - const DOMString &dat) - : ChildNode(ownerDoc) -{ - this->data = dat.clone(); -}; - -CharacterDataImpl::CharacterDataImpl(const CharacterDataImpl &other, bool /*deep*/) - : ChildNode(other) -{ - data = other.data.clone(); -}; - - -CharacterDataImpl::~CharacterDataImpl() { -}; - - -DOMString CharacterDataImpl::getNodeValue() -{ - return data; -}; - - -void CharacterDataImpl::setNodeValue(const DOMString &value) -{ - if (isReadOnly()) - throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - data = value.clone(); - - if (this->getOwnerDocument() != null) { - typedef RefVectorOf<RangeImpl> RangeImpls; - RangeImpls* ranges = this->getOwnerDocument()->getRanges(); - if (ranges != null) { - unsigned int sz = ranges->size(); - if (sz != 0) { - for (unsigned int i =0; i<sz; i++) { - ranges->elementAt(i)->receiveReplacedText( this); - } - } - } - } -}; - - -void CharacterDataImpl::appendData(const DOMString &dat) -{ - if(isReadOnly()) - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - - this->data.appendData(dat); -}; - - -void CharacterDataImpl::deleteData(unsigned int offset, unsigned int count) -{ - if (isReadOnly()) - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - - // Note: the C++ DOMString operation throws the correct DOMExceptions - // when parameter values are bad. - // - data.deleteData(offset, count); - - if (this->getOwnerDocument() != null) { - typedef RefVectorOf<RangeImpl> RangeImpls; - RangeImpls* ranges = this->getOwnerDocument()->getRanges(); - if (ranges != null) { - unsigned int sz = ranges->size(); - if (sz != 0) { - for (unsigned int i =0; i<sz; i++) { - DOM_Node dn = DOM_Node(this); - ranges->elementAt(i)->updateRangeForDeletedText( dn, offset, count); - } - } - } - } -}; - - - -DOMString &CharacterDataImpl::getData() -{ - return data; -}; - - -// -// getCharDataLength - return the length of the character data string. -// Note: in the public DOM API, the name of this method -// is getLength(), but has been renamed here to avoid a -// conflict with NodeListImpl::getLength(). The conflict -// occurs because NodeListImpl is a base class of us. -// DOM_CharData::getLength() delegates to this method, so -// all of the names are correct from an external API -// point of view. -// -unsigned int CharacterDataImpl::getCharDataLength() -{ - return data.length(); -}; - - - -void CharacterDataImpl::insertData(unsigned int offset, const DOMString &dat) -{ - - if (isReadOnly()) - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - - // Note: the C++ DOMString operation throws the correct DOMExceptions - // when parameter values are bad. - // - this->data.insertData(offset, dat); -} - - - -void CharacterDataImpl::replaceData(unsigned int offset, unsigned int count, - const DOMString &dat) -{ - if (isReadOnly()) - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - deleteData(offset, count); - insertData(offset, dat); -}; - - - - -void CharacterDataImpl::setData(const DOMString &arg) -{ - if (isReadOnly()) - throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - data = arg.clone(); -}; - - - - - -DOMString CharacterDataImpl::substringData(unsigned int offset, - unsigned int count) -{ - - // Note: the C++ DOMString operation throws the correct DOMExceptions - // when parameter values are bad. - // - return data.substringData(offset, count); -}; - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/CharacterDataImpl.hpp b/src/xercesc/dom/deprecated/CharacterDataImpl.hpp deleted file mode 100644 index cd0db26fac96661e861989109a2b11ea8adf0b10..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/CharacterDataImpl.hpp +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef CharacterDataImpl_HEADER_GUARD_ -#define CharacterDataImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - - -#include "ChildNode.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DEPRECATED_DOM_EXPORT CharacterDataImpl: public ChildNode -{ -protected: - DOMString data; - -public: - CharacterDataImpl(DocumentImpl *ownerDocument, const DOMString &data); - CharacterDataImpl(const CharacterDataImpl &other, bool deep = false); - virtual ~CharacterDataImpl(); - virtual DOMString getNodeValue(); - virtual void setNodeValue(const DOMString &value); - virtual void appendData(const DOMString &data); - virtual void deleteData(unsigned int offset, unsigned int count); - virtual DOMString &getData(); - virtual unsigned int getCharDataLength(); - virtual void insertData(unsigned int offset, const DOMString &data); - virtual void replaceData(unsigned int offset, unsigned int count, const DOMString &data); - virtual void setData(const DOMString &arg); - virtual DOMString substringData(unsigned int offset, unsigned int count); - -}; - - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/ChildNode.cpp b/src/xercesc/dom/deprecated/ChildNode.cpp deleted file mode 100644 index bca0c62f38b801e04acbd2ce0aee8ddfa9678344..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/ChildNode.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// This class only adds the ability to have siblings - -#include "ChildNode.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -ChildNode::ChildNode(DocumentImpl *ownerDoc) - : NodeImpl(ownerDoc) -{ - this->previousSibling = null; - this->nextSibling = null; -} - -// This only makes a shallow copy, cloneChildren must also be called for a -// deep clone -ChildNode::ChildNode(const ChildNode &other) - : NodeImpl(other) -{ - // Need to break the association w/ original siblings and parent - this->previousSibling = null; - this->nextSibling = null; - isFirstChild(false); -} - -ChildNode::~ChildNode() { -} - -NodeImpl * ChildNode::getNextSibling() { - return nextSibling; -} - -NodeImpl * ChildNode::getParentNode() -{ - // if we have an owner, ownerNode is our parent, otherwise it's - // our ownerDocument and we don't have a parent - return isOwned() ? ownerNode : null; -} - -NodeImpl * ChildNode::getPreviousSibling() { - // if we are the firstChild, previousSibling actually refers to our - // parent's lastChild, but we hide that - return isFirstChild() ? null : previousSibling; -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/ChildNode.hpp b/src/xercesc/dom/deprecated/ChildNode.hpp deleted file mode 100644 index cad17924f0aff2f497da22050da625f41fffc38f..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/ChildNode.hpp +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef ChildNode_HEADER_GUARD_ -#define ChildNode_HEADER_GUARD_ - -/* - * Copyright 2000,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -/** - * ChildNode adds to NodeImpl the capability of being a child, this is having - * siblings. - **/ - -#include "NodeImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DEPRECATED_DOM_EXPORT ChildNode: public NodeImpl { -public: - ChildNode *previousSibling; - ChildNode *nextSibling; - -public: - ChildNode(DocumentImpl *ownerDocument); - ChildNode(const ChildNode &other); - virtual ~ChildNode(); - - virtual NodeImpl * getNextSibling(); - virtual NodeImpl * getParentNode(); - virtual NodeImpl* getPreviousSibling(); -}; - - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/CommentImpl.cpp b/src/xercesc/dom/deprecated/CommentImpl.cpp deleted file mode 100644 index 9328a64cca3f4c8ab578917aef43f2b652519c9d..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/CommentImpl.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -/** - * Represents an XML (or HTML) comment. - * - * @author Rania Y. Khalaf - * @author Joseph Kesselman - * @since PR-DOM-Level-1-19980818. - */ - -#include "CommentImpl.hpp" -#include "CharacterDataImpl.hpp" -#include "DOM_Node.hpp" -#include "DocumentImpl.hpp" -#include "DStringPool.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -static DOMString *gComment = 0; // will be lazily initialized to "#comment" -static XMLRegisterCleanup gCommentCleanup; - -CommentImpl::CommentImpl(DocumentImpl *ownerDoc, const DOMString &dat) - : CharacterDataImpl(ownerDoc, dat) -{ -}; - - -CommentImpl::CommentImpl(const CommentImpl &other, bool deep) - : CharacterDataImpl(other, deep) -{ -}; - - -CommentImpl::~CommentImpl() { -}; - - - -NodeImpl * CommentImpl::cloneNode(bool deep) -{ - return new (getOwnerDocument()->getMemoryManager()) CommentImpl(*this, deep); -}; - - -DOMString CommentImpl::getNodeName() { - return DStringPool::getStaticString("#comment" - , &gComment - , reinitCommentImpl - , gCommentCleanup); -} - -short CommentImpl::getNodeType() { - return DOM_Node::COMMENT_NODE; -}; - -// ----------------------------------------------------------------------- -// Notification that lazy data has been deleted -// ----------------------------------------------------------------------- -void CommentImpl::reinitCommentImpl() { - delete gComment; - gComment = 0; -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/CommentImpl.hpp b/src/xercesc/dom/deprecated/CommentImpl.hpp deleted file mode 100644 index 72a81a056913eea9b85cc6a8b87746efdc7f2d31..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/CommentImpl.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef CommentImpl_HEADER_GUARD_ -#define CommentImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - -#include <xercesc/util/XercesDefs.hpp> -#include "CharacterDataImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DEPRECATED_DOM_EXPORT CommentImpl: public CharacterDataImpl { -public: - CommentImpl(DocumentImpl *, const DOMString &); - CommentImpl(const CommentImpl &other, bool deep); - virtual ~CommentImpl(); - virtual NodeImpl * cloneNode(bool deep); - virtual DOMString getNodeName(); - virtual short getNodeType(); - - // ----------------------------------------------------------------------- - // Notification that lazy data has been deleted - // ----------------------------------------------------------------------- - static void reinitCommentImpl(); -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/DOM.hpp b/src/xercesc/dom/deprecated/DOM.hpp deleted file mode 100644 index 3c74b3a08ca9802bd07973ce862f1dcf675488d9..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef DOM_DEPRECATED_HEADER_GUARD_ -#define DOM_DEPRECATED_HEADER_GUARD_ - - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This is the primary header file for inclusion in application -// programs using the C++ XML Document Object Model API. -// - -#include "DOM_Attr.hpp" -#include "DOM_CDATASection.hpp" -#include "DOM_CharacterData.hpp" -#include "DOM_Comment.hpp" -#include "DOM_Document.hpp" -#include "DOM_DocumentFragment.hpp" -#include "DOM_DocumentType.hpp" -#include "DOM_DOMException.hpp" -#include "DOM_DOMImplementation.hpp" -#include "DOM_Element.hpp" -#include "DOM_Entity.hpp" -#include "DOM_EntityReference.hpp" -#include "DOM_NamedNodeMap.hpp" -#include "DOM_Node.hpp" -#include "DOM_NodeList.hpp" -#include "DOM_Notation.hpp" -#include "DOM_ProcessingInstruction.hpp" -#include "DOM_Text.hpp" -#include "DOMString.hpp" -#include "DOM_XMLDecl.hpp" - - -#endif diff --git a/src/xercesc/dom/deprecated/DOMParser.cpp b/src/xercesc/dom/deprecated/DOMParser.cpp deleted file mode 100644 index 26a98ae87b4af3ff1386ef9a5c620622ac7995c8..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOMParser.cpp +++ /dev/null @@ -1,1454 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - -/** -* This file contains code to build the DOM tree. It registers a document -* handler with the scanner. In these handler methods, appropriate DOM nodes -* are created and added to the DOM tree. -* -* $Id$ -* -*/ - - - -// --------------------------------------------------------------------------- -// Includes -// --------------------------------------------------------------------------- -#include <xercesc/internal/XMLScannerResolver.hpp> -#include <xercesc/sax/EntityResolver.hpp> -#include <xercesc/util/XMLUniDefs.hpp> -#include <xercesc/sax/ErrorHandler.hpp> -#include <xercesc/sax/SAXParseException.hpp> -#include <xercesc/framework/XMLNotationDecl.hpp> -#include <xercesc/util/IOException.hpp> -#include <xercesc/framework/XMLValidator.hpp> -#include <xercesc/validators/common/GrammarResolver.hpp> -#include <xercesc/framework/XMLGrammarPool.hpp> -#include <xercesc/framework/XMLSchemaDescription.hpp> -#include <xercesc/util/Janitor.hpp> - -#include "DOMParser.hpp" -#include "ElementImpl.hpp" -#include "AttrImpl.hpp" -#include "AttrNSImpl.hpp" -#include "TextImpl.hpp" -#include "DocumentImpl.hpp" -#include "DocumentTypeImpl.hpp" -#include "EntityImpl.hpp" -#include "NotationImpl.hpp" -#include "NamedNodeMapImpl.hpp" -#include "NodeIDMap.hpp" - - -#include <xercesc/validators/common/ContentSpecNode.hpp> -#include <xercesc/validators/DTD/DTDAttDefList.hpp> -#include <xercesc/util/OutOfMemoryException.hpp> -#include <xercesc/util/XMLEntityResolver.hpp> - -XERCES_CPP_NAMESPACE_BEGIN - - -// --------------------------------------------------------------------------- -// DOMParser: Constructors and Destructor -// --------------------------------------------------------------------------- -DOMParser::DOMParser( XMLValidator* const valToAdopt - , MemoryManager* const manager - , XMLGrammarPool* const gramPool) : - - fToCreateXMLDeclTypeNode(false) - , fCreateEntityReferenceNodes(true) - , fIncludeIgnorableWhitespace(true) - , fParseInProgress(false) - , fWithinElement(false) - , fEntityResolver(0) - , fXMLEntityResolver(0) - , fErrorHandler(0) - , fPSVIHandler(0) - , fNodeStack(0) - , fScanner(0) - , fDocumentType(0) - , fGrammarResolver(0) - , fURIStringPool(0) - , fValidator(valToAdopt) - , fMemoryManager(manager) - , fGrammarPool(gramPool) -{ - try - { - initialize(); - } - catch(const OutOfMemoryException&) - { - throw; - } - catch(...) - { - cleanUp(); - throw; - } -} - - -DOMParser::~DOMParser() -{ - cleanUp(); -} - -// --------------------------------------------------------------------------- -// DOMParser: Initialize/CleanUp methods -// --------------------------------------------------------------------------- -void DOMParser::initialize() -{ - // Create grammar resolver and URI string pool to pass to the scanner - fGrammarResolver = new (fMemoryManager) GrammarResolver(fGrammarPool, fMemoryManager); - fURIStringPool = fGrammarResolver->getStringPool(); - - // Create a scanner and tell it what validator to use. Then set us - // as the document event handler so we can fill the DOM document. - fScanner = XMLScannerResolver::getDefaultScanner(fValidator, fGrammarResolver, fMemoryManager); - fScanner->setDocHandler(this); - fScanner->setDocTypeHandler(this); - fScanner->setURIStringPool(fURIStringPool); - - fNodeStack = new (fMemoryManager) ValueStackOf<DOM_Node>(64, fMemoryManager, true); - this->reset(); -} - -void DOMParser::cleanUp() -{ - delete fNodeStack; - delete fScanner; - delete fGrammarResolver; - // grammar pool must do this - //delete fURIStringPool; - - if (fValidator) - delete fValidator; -} - -void DOMParser::reset() -{ - // - // Note: DOM Documents are reference counted. Doing this assignment - // will cause the old one to go away unless application code is also - // holding a reference to it. - // - fDocument = DOM_Document::createDocument(fMemoryManager); - resetDocType(); - - fCurrentParent = 0; - fCurrentNode = 0; - fParseInProgress = false; - fWithinElement = false; - fNodeStack->removeAllElements(); -}; - - - -// --------------------------------------------------------------------------- -// DOMParser: Getter methods -// --------------------------------------------------------------------------- -const XMLValidator& DOMParser::getValidator() const -{ - return *fScanner->getValidator(); -} - -bool DOMParser::getDoNamespaces() const -{ - return fScanner->getDoNamespaces(); -} - -bool DOMParser::getExitOnFirstFatalError() const -{ - return fScanner->getExitOnFirstFatal(); -} - -bool DOMParser::getValidationConstraintFatal() const -{ - return fScanner->getValidationConstraintFatal(); -} - -DOMParser::ValSchemes DOMParser::getValidationScheme() const -{ - const XMLScanner::ValSchemes scheme = fScanner->getValidationScheme(); - - if (scheme == XMLScanner::Val_Always) - return Val_Always; - else if (scheme == XMLScanner::Val_Never) - return Val_Never; - - return Val_Auto; -} - -bool DOMParser::getDoSchema() const -{ - return fScanner->getDoSchema(); -} - -bool DOMParser::getValidationSchemaFullChecking() const -{ - return fScanner->getValidationSchemaFullChecking(); -} - -bool DOMParser::getIdentityConstraintChecking() const -{ - return fScanner->getIdentityConstraintChecking(); -} - -int DOMParser::getErrorCount() const -{ - return fScanner->getErrorCount(); -} - -XMLCh* DOMParser::getExternalSchemaLocation() const -{ - return fScanner->getExternalSchemaLocation(); -} - -XMLCh* DOMParser::getExternalNoNamespaceSchemaLocation() const -{ - return fScanner->getExternalNoNamespaceSchemaLocation(); -} - -bool DOMParser::isCachingGrammarFromParse() const -{ - return fScanner->isCachingGrammarFromParse(); -} - -bool DOMParser::isUsingCachedGrammarInParse() const -{ - return fScanner->isUsingCachedGrammarInParse(); -} - -Grammar* DOMParser::getGrammar(const XMLCh* const nameSpaceKey) -{ - return fGrammarResolver->getGrammar(nameSpaceKey); -} - -Grammar* DOMParser::getRootGrammar() -{ - return fScanner->getRootGrammar(); -} - -const XMLCh* DOMParser::getURIText(unsigned int uriId) const -{ - return fScanner->getURIText(uriId); -} - -bool DOMParser::getCalculateSrcOfs() const -{ - return fScanner->getCalculateSrcOfs(); -} - -bool DOMParser::getStandardUriConformant() const -{ - return fScanner->getStandardUriConformant(); -} - -unsigned int DOMParser::getSrcOffset() const -{ - return fScanner->getSrcOffset(); -} - -// --------------------------------------------------------------------------- -// DOMParser: Setter methods -// --------------------------------------------------------------------------- -void DOMParser::setDoNamespaces(const bool newState) -{ - fScanner->setDoNamespaces(newState); -} - -void DOMParser::setErrorHandler(ErrorHandler* const handler) -{ - fErrorHandler = handler; - if (fErrorHandler) { - fScanner->setErrorReporter(this); - fScanner->setErrorHandler(fErrorHandler); - } - else { - fScanner->setErrorReporter(0); - fScanner->setErrorHandler(0); - } -} - -void DOMParser::setPSVIHandler(PSVIHandler* const handler) -{ - fPSVIHandler = handler; - if (fPSVIHandler) { - fScanner->setPSVIHandler(fPSVIHandler); - } - else { - fScanner->setPSVIHandler(0); - } -} - -void DOMParser::setEntityResolver(EntityResolver* const handler) -{ - fEntityResolver = handler; - if (fEntityResolver) { - fScanner->setEntityHandler(this); - fXMLEntityResolver = 0; - } - else { - fScanner->setEntityHandler(0); - } -} - -void DOMParser::setXMLEntityResolver(XMLEntityResolver* const handler) -{ - fXMLEntityResolver = handler; - if (fXMLEntityResolver) { - fEntityResolver = 0; - fScanner->setEntityHandler(this); - } - else { - fScanner->setEntityHandler(0); - } -} - -void DOMParser::setExitOnFirstFatalError(const bool newState) -{ - fScanner->setExitOnFirstFatal(newState); -} - -void DOMParser::setValidationConstraintFatal(const bool newState) -{ - fScanner->setValidationConstraintFatal(newState); -} - -void DOMParser::setValidationScheme(const ValSchemes newScheme) -{ - if (newScheme == Val_Never) - fScanner->setValidationScheme(XMLScanner::Val_Never); - else if (newScheme == Val_Always) - fScanner->setValidationScheme(XMLScanner::Val_Always); - else - fScanner->setValidationScheme(XMLScanner::Val_Auto); -} - -void DOMParser::setDoSchema(const bool newState) -{ - fScanner->setDoSchema(newState); -} - -void DOMParser::setValidationSchemaFullChecking(const bool schemaFullChecking) -{ - fScanner->setValidationSchemaFullChecking(schemaFullChecking); -} - -void DOMParser::setIdentityConstraintChecking(const bool identityConstraintChecking) -{ - fScanner->setIdentityConstraintChecking(identityConstraintChecking); -} - -void DOMParser::setExternalSchemaLocation(const XMLCh* const schemaLocation) -{ - fScanner->setExternalSchemaLocation(schemaLocation); -} -void DOMParser::setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation) -{ - fScanner->setExternalNoNamespaceSchemaLocation(noNamespaceSchemaLocation); -} - -void DOMParser::setExternalSchemaLocation(const char* const schemaLocation) -{ - fScanner->setExternalSchemaLocation(schemaLocation); -} -void DOMParser::setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation) -{ - fScanner->setExternalNoNamespaceSchemaLocation(noNamespaceSchemaLocation); -} - -void DOMParser::cacheGrammarFromParse(const bool newState) -{ - fScanner->cacheGrammarFromParse(newState); - - if (newState) - fScanner->useCachedGrammarInParse(newState); -} - -void DOMParser::useCachedGrammarInParse(const bool newState) -{ - if (newState || !fScanner->isCachingGrammarFromParse()) - fScanner->useCachedGrammarInParse(newState); -} - -void DOMParser::setCalculateSrcOfs(const bool newState) -{ - fScanner->setCalculateSrcOfs(newState); -} - -void DOMParser::setStandardUriConformant(const bool newState) -{ - fScanner->setStandardUriConformant(newState); -} - -void DOMParser::useScanner(const XMLCh* const scannerName) -{ - XMLScanner* tempScanner = XMLScannerResolver::resolveScanner - ( - scannerName - , fValidator - , fGrammarResolver - , fMemoryManager - ); - - if (tempScanner) { - - tempScanner->setParseSettings(fScanner); - tempScanner->setURIStringPool(fURIStringPool); - delete fScanner; - fScanner = tempScanner; - } -} - -// --------------------------------------------------------------------------- -// DOMParser: Parsing methods -// --------------------------------------------------------------------------- -void DOMParser::parse(const InputSource& source) -{ - // Avoid multiple entrance - if (fParseInProgress) - ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); - - try - { - fParseInProgress = true; - fScanner->scanDocument(source); - fParseInProgress = false; - } - catch(const OutOfMemoryException&) - { - throw; - } - catch(...) - { - fParseInProgress = false; - throw; - } -} - -void DOMParser::parse(const XMLCh* const systemId) -{ - // Avoid multiple entrance - if (fParseInProgress) - ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); - - try - { - fParseInProgress = true; - fScanner->scanDocument(systemId); - fParseInProgress = false; - } - catch(const OutOfMemoryException&) - { - throw; - } - catch(...) - { - fParseInProgress = false; - throw; - } -} - -void DOMParser::parse(const char* const systemId) -{ - // Avoid multiple entrance - if (fParseInProgress) - ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); - - try - { - fParseInProgress = true; - fScanner->scanDocument(systemId); - fParseInProgress = false; - } - catch(const OutOfMemoryException&) - { - throw; - } - catch(...) - { - fParseInProgress = false; - throw; - } -} - - - -// --------------------------------------------------------------------------- -// DOMParser: Progressive parse methods -// --------------------------------------------------------------------------- -bool DOMParser::parseFirst( const XMLCh* const systemId - , XMLPScanToken& toFill) -{ - // - // Avoid multiple entrance. We cannot enter here while a regular parse - // is in progress. - // - if (fParseInProgress) - ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); - - return fScanner->scanFirst(systemId, toFill); -} - -bool DOMParser::parseFirst( const char* const systemId - , XMLPScanToken& toFill) -{ - // - // Avoid multiple entrance. We cannot enter here while a regular parse - // is in progress. - // - if (fParseInProgress) - ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); - - return fScanner->scanFirst(systemId, toFill); -} - -bool DOMParser::parseFirst( const InputSource& source - , XMLPScanToken& toFill) -{ - // - // Avoid multiple entrance. We cannot enter here while a regular parse - // is in progress. - // - if (fParseInProgress) - ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); - - return fScanner->scanFirst(source, toFill); -} - -bool DOMParser::parseNext(XMLPScanToken& token) -{ - return fScanner->scanNext(token); -} - -void DOMParser::parseReset(XMLPScanToken& token) -{ - // Reset the scanner, and then reset the parser - fScanner->scanReset(token); - reset(); -} - - -// --------------------------------------------------------------------------- -// DOMParser: Implementation of the XMLErrorReporter interface -// --------------------------------------------------------------------------- -void DOMParser::error( const unsigned int /*code*/ - , const XMLCh* const /*msgDomain*/ - , const XMLErrorReporter::ErrTypes errType - , const XMLCh* const errorText - , const XMLCh* const systemId - , const XMLCh* const publicId - , const XMLSSize_t lineNum - , const XMLSSize_t colNum) -{ - SAXParseException toThrow = SAXParseException - ( - errorText - , publicId - , systemId - , lineNum - , colNum - , fMemoryManager - ); - - // - // If there is an error handler registered, call it, otherwise ignore - // all but the fatal errors. - // - if (!fErrorHandler) - { - if (errType == XMLErrorReporter::ErrType_Fatal) - throw toThrow; - return; - } - - if (errType == XMLErrorReporter::ErrType_Warning) - fErrorHandler->warning(toThrow); - else if (errType >= XMLErrorReporter::ErrType_Fatal) - fErrorHandler->fatalError(toThrow); - else - fErrorHandler->error(toThrow); -} - -void DOMParser::resetErrors() -{ -} - - -// --------------------------------------------------------------------------- -// DOMParser: Implementation of XMLEntityHandler interface -// --------------------------------------------------------------------------- -InputSource* DOMParser::resolveEntity(XMLResourceIdentifier* resourceIdentifier) -{ - // - // Just map it to the SAX entity resolver. If there is not one installed, - // return a null pointer to cause the default resolution. - // - if (fEntityResolver) - return fEntityResolver->resolveEntity(resourceIdentifier->getPublicId(), - resourceIdentifier->getSystemId()); - if (fXMLEntityResolver) - return fXMLEntityResolver->resolveEntity(resourceIdentifier); - return 0; -} - -// --------------------------------------------------------------------------- -// DOMParser: Implementation of XMLDocumentHandler interface -// --------------------------------------------------------------------------- -void DOMParser::docCharacters( const XMLCh* const chars - , const unsigned int length - , const bool cdataSection) -{ - // Ignore chars outside of content - if (!fWithinElement) - return; - - if (cdataSection == true) - { - DOM_CDATASection node = fDocument.createCDATASection - ( - DOMString(chars, length) - ); - fCurrentParent.appendChild(node); - fCurrentNode = node; - } - else - { - if (fCurrentNode.getNodeType() == DOM_Node::TEXT_NODE) - { - DOM_Text node = (DOM_Text&)fCurrentNode; - node.appendData(DOMString(chars, length)); - } - else - { - DOM_Text node = fDocument.createTextNode(DOMString(chars, length)); - fCurrentParent.appendChild(node); - - fCurrentNode = node; - - } - } -} - - -void DOMParser::docComment(const XMLCh* const comment) -{ - DOM_Comment dcom = fDocument.createComment(comment); - fCurrentParent.appendChild(dcom); - fCurrentNode = dcom; -} - - -void DOMParser::docPI( const XMLCh* const target - , const XMLCh* const data) -{ - DOM_ProcessingInstruction pi = fDocument.createProcessingInstruction - ( - target - , data - ); - fCurrentParent.appendChild(pi); - fCurrentNode = pi; -} - - -void DOMParser::endEntityReference(const XMLEntityDecl& entDecl) -{ - if (fCreateEntityReferenceNodes == true) - { - if (fCurrentParent.getNodeType() == DOM_Node::ENTITY_REFERENCE_NODE) { - // stick the parsed content of this entity reference into the entity definition node - EntityImpl* entity = (EntityImpl*)fDocumentType->entities->getNamedItem(entDecl.getName()); - entity->setEntityRef((EntityReferenceImpl*)fCurrentParent.fImpl); - - ((DOM_EntityReference&)fCurrentParent).fImpl->setReadOnly(true, true); - } - fCurrentParent = fNodeStack->pop(); - fCurrentNode = fCurrentParent; - } -} - - -void DOMParser::endElement( const XMLElementDecl& /*elemDecl*/ - , const unsigned int /*urlId*/ - , const bool /*isRoot*/ - , const XMLCh* const /*elemPrefix*/) -{ - fCurrentNode = fCurrentParent; - fCurrentParent = fNodeStack->pop(); - - // If we've hit the end of content, clear the flag - if (fNodeStack->empty()) - fWithinElement = false; -} - - -void DOMParser::ignorableWhitespace(const XMLCh* const chars - , const unsigned int length - , const bool /*cdataSection*/) -{ - // Ignore chars before the root element - if (!fWithinElement || !fIncludeIgnorableWhitespace) - return; - - if (fCurrentNode.getNodeType() == DOM_Node::TEXT_NODE) - { - DOM_Text node = (DOM_Text&)fCurrentNode; - node.appendData(DOMString(chars, length)); - } - else - { - DOM_Text node = fDocument.createTextNode(DOMString(chars, length)); - TextImpl *text = (TextImpl *) node.fImpl; - text -> setIgnorableWhitespace(true); - fCurrentParent.appendChild(node); - - fCurrentNode = node; - } -} - - -void DOMParser::resetDocument() -{ - // - // The reset methods are called before a new parse event occurs. - // Reset this parsers state to clear out anything that may be left - // from a previous use, in particular the DOM document itself. - // - this->reset(); -} - - -void DOMParser::startDocument() -{ - // Just set the document as the current parent and current node - fCurrentParent = fDocument; - fCurrentNode = fDocument; - // set DOM error checking off - fDocument.setErrorChecking(false); -} - - -void DOMParser::endDocument() -{ - // set DOM error checking back on - fDocument.setErrorChecking(true); -} - - -void DOMParser::startElement(const XMLElementDecl& elemDecl - , const unsigned int urlId - , const XMLCh* const elemPrefix - , const RefVectorOf<XMLAttr>& attrList - , const unsigned int attrCount - , const bool isEmpty - , const bool isRoot) -{ - DOM_Element elem; - DocumentImpl *docImpl = (DocumentImpl *)fDocument.fImpl; - - if (fScanner -> getDoNamespaces()) { //DOM Level 2, doNamespaces on - XMLBuffer buf(1023, fMemoryManager); - DOMString namespaceURI = 0; - DOMString elemQName = 0; - if (urlId != fScanner->getEmptyNamespaceId()) { //TagName has a prefix - fScanner->getURIText(urlId, buf); //get namespaceURI - namespaceURI = DOMString(buf.getRawBuffer()); - - if (elemPrefix && *elemPrefix) { - elemQName.appendData(elemPrefix); - elemQName.appendData(chColon); - } - } - elemQName.appendData(elemDecl.getBaseName()); - - elem = fDocument.createElementNS(namespaceURI, elemQName); - ElementImpl *elemImpl = (ElementImpl *) elem.fImpl; - for (unsigned int index = 0; index < attrCount; ++index) { - static const XMLCh XMLNS[] = { - chLatin_x, chLatin_m, chLatin_l, chLatin_n, chLatin_s, chNull - }; - const XMLAttr* oneAttrib = attrList.elementAt(index); - unsigned int attrURIId = oneAttrib -> getURIId(); - namespaceURI = 0; - if (!XMLString::compareString(oneAttrib -> getName(), XMLNS)) //for xmlns=... - attrURIId = fScanner->getXMLNSNamespaceId(); - if (attrURIId != fScanner->getEmptyNamespaceId()) { //TagName has a prefix - fScanner->getURIText(attrURIId, buf); //get namespaceURI - namespaceURI = DOMString(buf.getRawBuffer()); - } - AttrImpl *attr = elemImpl->setAttributeNS(namespaceURI, oneAttrib -> getQName(), - oneAttrib -> getValue()); - - // Attributes of type ID. If this is one, add it to the hashtable of IDs - // that is constructed for use by GetElementByID(). - // - if (oneAttrib->getType()==XMLAttDef::ID) - { - if (docImpl->fNodeIDMap == 0) - docImpl->fNodeIDMap = new (fMemoryManager) NodeIDMap(500, fMemoryManager); - docImpl->fNodeIDMap->add(attr); - attr->isIdAttr(true); - } - - attr->setSpecified(oneAttrib->getSpecified()); - } - } - else { //DOM Level 1 - elem = fDocument.createElement(elemDecl.getFullName()); - ElementImpl *elemImpl = (ElementImpl *) elem.fImpl; - for (unsigned int index = 0; index < attrCount; ++index) { - const XMLAttr* oneAttrib = attrList.elementAt(index); - AttrImpl *attr = elemImpl->setAttribute(oneAttrib->getName(), oneAttrib->getValue()); - attr->setSpecified(oneAttrib->getSpecified()); - - // Attributes of type ID. If this is one, add it to the hashtable of IDs - // that is constructed for use by GetElementByID(). - // - if (oneAttrib->getType()==XMLAttDef::ID) - { - if (docImpl->fNodeIDMap == 0) - docImpl->fNodeIDMap = new (fMemoryManager) NodeIDMap(500, fMemoryManager); - docImpl->fNodeIDMap->add(attr); - attr->isIdAttr(true); - } - } - } - - fCurrentParent.appendChild(elem); - - fNodeStack->push(fCurrentParent); - fCurrentParent = elem; - fCurrentNode = elem; - fWithinElement = true; - - // If an empty element, do end right now (no endElement() will be called) - if (isEmpty) - endElement(elemDecl, urlId, isRoot, elemPrefix); -} - - -void DOMParser::startEntityReference(const XMLEntityDecl& entDecl) -{ - if (fCreateEntityReferenceNodes == true) - { - DOMString entName(entDecl.getName()); - DOM_EntityReference er = fDocument.createEntityReference(entName); - - //set the readOnly flag to false before appending node, will be reset in endEntityReference - er.fImpl->setReadOnly(false, true); - - fCurrentParent.appendChild(er); - fNodeStack->push(fCurrentParent); - fCurrentParent = er; - fCurrentNode = er; - - } -} - - -void DOMParser::XMLDecl(const XMLCh* const version - , const XMLCh* const encoding - , const XMLCh* const standalone - , const XMLCh* const /*actualEncStr*/) -{ - //This is a non-standard extension to creating XMLDecl type nodes and attching to DOM Tree - // currently this flag it set to false unless user explicitly asks for it - // Needs to be revisited after W3C specs are laid out on this issue. - - if (fToCreateXMLDeclTypeNode) { - - DOMString ver(version); - DOMString enc(encoding); - DOMString isStd(standalone); - DOM_XMLDecl xmlDecl = fDocument.createXMLDecl(ver, enc, isStd); - - fCurrentParent.appendChild(xmlDecl); - } -} - - - -// --------------------------------------------------------------------------- -// DOMParser: Deprecated methods -// --------------------------------------------------------------------------- -bool DOMParser::getDoValidation() const -{ - // - // We don't want to tie the public parser classes to the enum used - // by the scanner, so we use a separate one and map. - // - // DON'T mix the new and old methods!! - // - const XMLScanner::ValSchemes scheme = fScanner->getValidationScheme(); - if (scheme == XMLScanner::Val_Always) - return true; - return false; -} - -void DOMParser::setDoValidation(const bool newState) -{ - fScanner->setDoValidation - ( - newState ? XMLScanner::Val_Always : XMLScanner::Val_Never - ); -} - -//doctypehandler interfaces -void DOMParser::attDef -( - const DTDElementDecl& elemDecl - , const DTDAttDef& attDef - , const bool /*ignoring*/ - ) -{ - if (fDocumentType->isIntSubsetReading()) - { - DOMString attString; - if (elemDecl.hasAttDefs()) - { - attString.appendData(chOpenAngle); - attString.appendData(chBang); - attString.appendData(XMLUni::fgAttListString); - attString.appendData(chSpace); - attString.appendData(elemDecl.getFullName()); - - attString.appendData(chSpace); - attString.appendData(attDef.getFullName()); - - // Get the type and display it - const XMLAttDef::AttTypes type = attDef.getType(); - switch(type) - { - case XMLAttDef::CData : - attString.appendData(chSpace); - attString.appendData(XMLUni::fgCDATAString); - break; - case XMLAttDef::ID : - attString.appendData(chSpace); - attString.appendData(XMLUni::fgIDString); - break; - case XMLAttDef::IDRef : - attString.appendData(chSpace); - attString.appendData(XMLUni::fgIDRefString); - break; - case XMLAttDef::IDRefs : - attString.appendData(chSpace); - attString.appendData(XMLUni::fgIDRefsString); - break; - case XMLAttDef::Entity : - attString.appendData(chSpace); - attString.appendData(XMLUni::fgEntityString); - break; - case XMLAttDef::Entities : - attString.appendData(chSpace); - attString.appendData(XMLUni::fgEntitiesString); - break; - case XMLAttDef::NmToken : - attString.appendData(chSpace); - attString.appendData(XMLUni::fgNmTokenString); - break; - case XMLAttDef::NmTokens : - attString.appendData(chSpace); - attString.appendData(XMLUni::fgNmTokensString); - break; - - case XMLAttDef::Notation : - attString.appendData(chSpace); - attString.appendData(XMLUni::fgNotationString); - break; - - case XMLAttDef::Enumeration : - { - attString.appendData(chSpace); - // attString.appendData(XMLUni::fgEnumerationString); - const XMLCh* enumString = attDef.getEnumeration(); - int length = XMLString::stringLen(enumString); - if (length > 0) { - - DOMString anotherEnumString; - - anotherEnumString.appendData(chOpenParen ); - for(int i=0; i<length; i++) { - if (enumString[i] == chSpace) - anotherEnumString.appendData(chPipe); - else - anotherEnumString.appendData(enumString[i]); - } - anotherEnumString.appendData(chCloseParen); - attString.appendData(anotherEnumString); - } - } - break; - default: - // remaining types don't belong to a DTD - break; - } - //get te default types of the attlist - const XMLAttDef::DefAttTypes def = attDef.getDefaultType(); - switch(def) - { - case XMLAttDef::Required : - attString.appendData(chSpace); - attString.appendData(XMLUni::fgRequiredString); - break; - case XMLAttDef::Implied : - attString.appendData(chSpace); - attString.appendData(XMLUni::fgImpliedString); - break; - case XMLAttDef::Fixed : - attString.appendData(chSpace); - attString.appendData(XMLUni::fgFixedString); - break; - default: - // remaining types don't belong to a DTD - break; - } - - const XMLCh* defaultValue = attDef.getValue(); - if (defaultValue != 0) { - attString.appendData(chSpace); - attString.appendData(chDoubleQuote); - attString.appendData(defaultValue); - attString.appendData(chDoubleQuote); - } - - attString.appendData(chCloseAngle); - fDocumentType->internalSubset.appendData(attString); - } - } -} - -void DOMParser::doctypeComment -( - const XMLCh* const comment -) -{ - if (fDocumentType->isIntSubsetReading()) - { - if (comment != 0) - { - DOMString comString; - comString.appendData(XMLUni::fgCommentString); - comString.appendData(chSpace); - comString.appendData(comment); - comString.appendData(chSpace); - comString.appendData(chDash); - comString.appendData(chDash); - comString.appendData(chCloseAngle); - fDocumentType->internalSubset.appendData(comString); - } - } -} - -void DOMParser::doctypeDecl -( - const DTDElementDecl& elemDecl - , const XMLCh* const publicId - , const XMLCh* const systemId - , const bool /*hasIntSubset*/ - , const bool /*hasExtSubset*/ -) -{ - DOM_DocumentType dt; - dt = fDocument.getImplementation().createDocumentType(elemDecl.getFullName(), publicId, systemId); - fDocumentType = (DocumentTypeImpl*)dt.fImpl; - ((DocumentImpl*)fDocument.fImpl)->setDocumentType(fDocumentType); - -} - -void DOMParser::doctypePI -( - const XMLCh* const target - , const XMLCh* const data -) -{ - if (fDocumentType->isIntSubsetReading()) - { - //add these chars to internalSubset variable - DOMString pi; - pi.appendData(chOpenAngle); - pi.appendData(chQuestion); - pi.appendData(target); - pi.appendData(chSpace); - pi.appendData(data); - pi.appendData(chQuestion); - pi.appendData(chCloseAngle); - - fDocumentType->internalSubset.appendData(pi); - } - -} - - -void DOMParser::doctypeWhitespace -( - const XMLCh* const chars - , const unsigned int /*length*/ -) -{ - if (fDocumentType->isIntSubsetReading()) - fDocumentType->internalSubset.appendData(chars); -} - -void DOMParser::elementDecl -( - const DTDElementDecl& decl - , const bool /*isIgnored*/ -) -{ - if (fDocumentType->isIntSubsetReading()) - { - DOMString elemDecl; - - elemDecl.appendData(chOpenAngle); - elemDecl.appendData(chBang); - elemDecl.appendData(XMLUni::fgElemString); - elemDecl.appendData(chSpace); - elemDecl.appendData(decl.getFullName()); - - //get the ContentSpec information - const XMLCh* contentModel = decl.getFormattedContentModel(); - if (contentModel != 0) { - elemDecl.appendData(chSpace); - elemDecl.appendData(contentModel); - } - - elemDecl.appendData(chCloseAngle); - fDocumentType->internalSubset.appendData(elemDecl); - } -} - -void DOMParser::endAttList -( - const DTDElementDecl& elemDecl -) -{ - // this section sets up default attributes. - // default attribute nodes are stored in a NamedNodeMap DocumentTypeImpl::elements - // default attribute data attached to the document is used to conform to the - // DOM spec regarding creating element nodes & removing attributes with default values - // see DocumentTypeImpl - if (elemDecl.hasAttDefs()) - { - XMLAttDefList* defAttrs = &elemDecl.getAttDefList(); - XMLAttDef* attr = 0; - AttrImpl* insertAttr = 0; - DOM_Element dom_elem = fDocument.createElement(elemDecl.getFullName()); - ElementImpl* elem = (ElementImpl*)(dom_elem.fImpl); - - for(unsigned int i=0; i<defAttrs->getAttDefCount(); i++) - { - attr = &defAttrs->getAttDef(i); - if (attr->getValue() != null) - { - if (fScanner->getDoNamespaces()) - { - // DOM Level 2 wants all namespace declaration attributes - // to be bound to "http://www.w3.org/2000/xmlns/" - // So as long as the XML parser doesn't do it, it needs to - // done here. - DOMString qualifiedName = attr->getFullName(); - int index = DocumentImpl::indexofQualifiedName(qualifiedName); - - XMLBuffer buf(1023, fMemoryManager); - static const XMLCh XMLNS[] = { - chLatin_x, chLatin_m, chLatin_l, chLatin_n, chLatin_s, chNull}; - - if (index > 0) { - // there is prefix - // map to XML URI for all cases except when prefix == "xmlns" - DOMString prefix = qualifiedName.substringData(0, index); - - if (prefix.equals(XMLNS)) - buf.append(XMLUni::fgXMLNSURIName); - else - buf.append(XMLUni::fgXMLURIName); - } - else { - // No prefix - if (qualifiedName.equals(XMLNS)) - buf.append(XMLUni::fgXMLNSURIName); - } - - insertAttr = new (fMemoryManager) AttrNSImpl((DocumentImpl*)fDocument.fImpl, - DOMString(buf.getRawBuffer()), // NameSpaceURI - qualifiedName); // qualified name - - } - else - { - // Namespaces is turned off... - insertAttr = new (fMemoryManager) AttrImpl((DocumentImpl*)fDocument.fImpl, attr->getFullName()); - } - insertAttr->setValue(attr->getValue()); - // memory leak here - AttrImpl * previousAttr = elem->setAttributeNode(insertAttr); - if ( previousAttr != 0 && previousAttr->nodeRefCount ==0) - NodeImpl::deleteIf(previousAttr); - - insertAttr->setSpecified(false); - } - } - ElementImpl *previousElem = (ElementImpl *) - fDocumentType->getElements()->setNamedItem( elem ); - - // - // If this new element is replacing an element node that was already - // in the element named node map, we need to delete the original - // element node, assuming no-one else was referencing it. - // - if (previousElem != 0 && previousElem->nodeRefCount == 0) - NodeImpl::deleteIf(previousElem); - } -} - -void DOMParser::endIntSubset() -{ - fDocumentType->intSubsetReading = false; -} - -void DOMParser::endExtSubset() -{ -} - -void DOMParser::entityDecl -( - const DTDEntityDecl& entityDecl - , const bool /*isPEDecl*/ - , const bool /*isIgnored*/ -) -{ - EntityImpl* entity = ((DocumentImpl*)fDocument.fImpl)->createEntity(entityDecl.getName()); - - entity->setPublicId(entityDecl.getPublicId()); - entity->setSystemId(entityDecl.getSystemId()); - entity->setNotationName(entityDecl.getNotationName()); - - EntityImpl *previousDef = (EntityImpl *) - fDocumentType->entities->setNamedItem( entity ); - - // - // If this new entity node is replacing an entity node that was already - // in the entities named node map (happens if documents redefine the - // predefined entited such as lt), we need to delete the original - // entitiy node, assuming no-one else was referencing it. - // - if (previousDef != 0 && previousDef->nodeRefCount == 0) - NodeImpl::deleteIf(previousDef); - - - if (fDocumentType->isIntSubsetReading()) - { - //add thes chars to internalSubset variable - DOMString entityName; - entityName.appendData(chOpenAngle); - entityName.appendData(chBang); - entityName.appendData(XMLUni::fgEntityString); - entityName.appendData(chSpace); - - entityName.appendData(entityDecl.getName()); - DOMString id = entity->getPublicId(); - if (id != 0) { - entityName.appendData(chSpace); - entityName.appendData(XMLUni::fgPubIDString); - entityName.appendData(chSpace); - entityName.appendData(chDoubleQuote); - entityName.appendData(id); - entityName.appendData(chDoubleQuote); - } - id = entity->getSystemId(); - if (id != 0) { - entityName.appendData(chSpace); - entityName.appendData(XMLUni::fgSysIDString); - entityName.appendData(chSpace); - entityName.appendData(chDoubleQuote); - entityName.appendData(id); - entityName.appendData(chDoubleQuote); - - } - id = entity->getNotationName(); - if (id != 0) { - entityName.appendData(chSpace); - entityName.appendData(XMLUni::fgNDATAString); - entityName.appendData(chSpace); - entityName.appendData(chDoubleQuote); - entityName.appendData(id); - entityName.appendData(chDoubleQuote); - } - id = entityDecl.getValue(); - if (id !=0) { - entityName.appendData(chSpace); - entityName.appendData(chDoubleQuote); - entityName.appendData(id); - entityName.appendData(chDoubleQuote); - } - - entityName.appendData(chCloseAngle); - fDocumentType->internalSubset.appendData(entityName); - } - -} - -void DOMParser::resetDocType() -{ - fDocumentType = null; -} - -void DOMParser::notationDecl -( - const XMLNotationDecl& notDecl - , const bool /*isIgnored*/ -) -{ - NotationImpl* notation = ((DocumentImpl*)fDocument.fImpl)->createNotation(notDecl.getName()); - notation->setPublicId(notDecl.getPublicId()); - notation->setSystemId(notDecl.getSystemId()); - - NotationImpl *previousNot = (NotationImpl *) - fDocumentType->notations->setNamedItem( notation ); - - // - // If this new notation is replacing a notation node that was already - // in the notation named node map, we need to delete the original - // notation node, assuming no-one else was referencing it. - // - if (previousNot != 0 && previousNot->nodeRefCount == 0) - NodeImpl::deleteIf(previousNot); - -} - -void DOMParser::startAttList -( - const DTDElementDecl& /*elemDecl*/ -) -{ -} - -void DOMParser::startIntSubset() -{ - fDocumentType->intSubsetReading = true; -} - -void DOMParser::startExtSubset() -{ -} - -void DOMParser::TextDecl -( - const XMLCh* const /*versionStr*/ - , const XMLCh* const /*encodingStr*/ -) -{ -} - - -// --------------------------------------------------------------------------- -// DOMParser: Grammar preparsing methods -// --------------------------------------------------------------------------- -Grammar* DOMParser::loadGrammar(const char* const systemId, - const short grammarType, - const bool toCache) -{ - // Avoid multiple entrance - if (fParseInProgress) - ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); - - Grammar* grammar = 0; - try - { - fParseInProgress = true; - grammar = fScanner->loadGrammar(systemId, grammarType, toCache); - fParseInProgress = false; - } - catch(const OutOfMemoryException&) - { - throw; - } catch(...) - { - fParseInProgress = false; - throw; - } - - return grammar; -} - -Grammar* DOMParser::loadGrammar(const XMLCh* const systemId, - const short grammarType, - const bool toCache) -{ - // Avoid multiple entrance - if (fParseInProgress) - ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); - - Grammar* grammar = 0; - try - { - fParseInProgress = true; - grammar = fScanner->loadGrammar(systemId, grammarType, toCache); - fParseInProgress = false; - } - catch(const OutOfMemoryException&) - { - throw; - } - catch(...) - { - fParseInProgress = false; - throw; - } - - return grammar; -} - -Grammar* DOMParser::loadGrammar(const InputSource& source, - const short grammarType, - const bool toCache) -{ - // Avoid multiple entrance - if (fParseInProgress) - ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); - - Grammar* grammar = 0; - try - { - fParseInProgress = true; - grammar = fScanner->loadGrammar(source, grammarType, toCache); - fParseInProgress = false; - } - catch(const OutOfMemoryException&) - { - throw; - } - catch(...) - { - fParseInProgress = false; - throw; - } - - return grammar; -} - -void DOMParser::resetCachedGrammarPool() -{ - fGrammarResolver->resetCachedGrammar(); -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOMParser.hpp b/src/xercesc/dom/deprecated/DOMParser.hpp deleted file mode 100644 index 2450bd042caaea383cd4a57e41617b7c2b887f5f..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOMParser.hpp +++ /dev/null @@ -1,1947 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - * - */ - -#if !defined(DOMPARSER_HPP) -#define DOMPARSER_HPP - -#include <xercesc/framework/XMLDocumentHandler.hpp> -#include <xercesc/framework/XMLErrorReporter.hpp> -#include <xercesc/framework/XMLEntityHandler.hpp> -#include <xercesc/util/ValueStackOf.hpp> -#include <xercesc/validators/DTD/DocTypeHandler.hpp> -#include <xercesc/validators/DTD/DTDElementDecl.hpp> -#include "DOM_Document.hpp" -#include "DOM_DocumentType.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class EntityResolver; -class ErrorHandler; -class XMLPScanToken; -class XMLScanner; -class XMLValidator; -class Grammar; -class GrammarResolver; -class XMLGrammarPool; -class XMLEntityResolver; -class PSVIHandler; - -/** - * This class implements the Document Object Model (DOM) interface. - * It should be used by applications which choose to parse and - * process the XML document using the DOM api's. This implementation - * also allows the applications to install an error and an entitty - * handler (useful extensions to the DOM specification). - * - * <p>It can be used to instantiate a validating or non-validating - * parser, by setting a member flag.</p> - */ -class DEPRECATED_DOM_EXPORT DOMParser : - - public XMLDocumentHandler - , public XMLErrorReporter - , public XMLEntityHandler - , public DocTypeHandler - , public XMemory -{ -public : - // ----------------------------------------------------------------------- - // Class types - // ----------------------------------------------------------------------- - enum ValSchemes - { - Val_Never - , Val_Always - , Val_Auto - }; - - - // ----------------------------------------------------------------------- - // Constructors and Detructor - // ----------------------------------------------------------------------- - - /** @name Constructors and Destructor */ - //@{ - /** Construct a DOMParser, with an optional validator - * - * Constructor with an instance of validator class to use for - * validation. If you don't provide a validator, a default one will - * be created for you in the scanner. - * - * @param valToAdopt Pointer to the validator instance to use. The - * parser is responsible for freeing the memory. - */ - DOMParser - ( - XMLValidator* const valToAdopt = 0 - , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager - , XMLGrammarPool* const gramPool = 0 - ); - - /** - * Destructor - */ - ~DOMParser(); - - //@} - - /** Reset the parser - * - * This method resets the state of the DOM driver and makes - * it ready for a fresh parse run. - */ - void reset(); - - - // ----------------------------------------------------------------------- - // Getter methods - // ----------------------------------------------------------------------- - - /** @name Getter methods */ - //@{ - - /** Get the DOM document - * - * This method returns the DOM_Document object representing the - * root of the document tree. This object provides the primary - * access to the document's data. - * - * @return The DOM_Document object which represents the entire - * XML document. - */ - DOM_Document getDocument(); - - /** Get a pointer to the error handler - * - * This method returns the installed error handler. If no handler - * has been installed, then it will be a zero pointer. - * - * @return The pointer to the installed error handler object. - */ - ErrorHandler* getErrorHandler(); - - /** Get a const pointer to the error handler - * - * This method returns the installed error handler. If no handler - * has been installed, then it will be a zero pointer. - * - * @return A const pointer to the installed error handler object. - */ - const ErrorHandler* getErrorHandler() const; - - /** Get a pointer to the PSVI handler - * - * This method returns the installed PSVI handler. If no handler - * has been installed, then it will be a zero pointer. - * - * @return The pointer to the installed PSVI handler object. - */ - PSVIHandler* getPSVIHandler(); - - /** Get a const pointer to the error handler - * - * This method returns the installed error handler. If no handler - * has been installed, then it will be a zero pointer. - * - * @return A const pointer to the installed error handler object. - */ - const PSVIHandler* getPSVIHandler() const; - - /** Get a pointer to the entity resolver - * - * This method returns the installed entity resolver. If no resolver - * has been installed, then it will be a zero pointer. - * - * @return The pointer to the installed entity resolver object. - */ - EntityResolver* getEntityResolver(); - - /** Get a const pointer to the entity resolver - * - * This method returns the installed entity resolver. If no resolver - * has been installed, then it will be a zero pointer. - * - * @return A const pointer to the installed entity resolver object. - */ - const EntityResolver* getEntityResolver() const; - - /** Get a pointer to the entity resolver - * - * This method returns the installed entity resolver. If no resolver - * has been installed, then it will be a zero pointer. - * - * @return The pointer to the installed entity resolver object. - */ - XMLEntityResolver* getXMLEntityResolver(); - - /** Get a const pointer to the entity resolver - * - * This method returns the installed entity resolver. If no resolver - * has been installed, then it will be a zero pointer. - * - * @return A const pointer to the installed entity resolver object. - */ - const XMLEntityResolver* getXMLEntityResolver() const; - - /** Get a const reference to the underlying scanner - * - * This method returns a reference to the underlying scanner object. - * It allows read only access to data maintained in the scanner. - * - * @return A const reference to the underlying scanner object. - */ - const XMLScanner& getScanner() const; - - /** Get a const reference to the validator - * - * This method returns a reference to the parser's installed - * validator. - * - * @return A const reference to the installed validator object. - */ - const XMLValidator& getValidator() const; - - /** - * This method returns an enumerated value that indicates the current - * validation scheme set on this parser. - * - * @return The ValSchemes value current set on this parser. - * @see #setValidationScheme - */ - ValSchemes getValidationScheme() const; - - /** Get the 'do schema' flag - * - * This method returns the state of the parser's schema processing - * flag. - * - * @return true, if the parser is currently configured to - * understand schema, false otherwise. - * - * @see #setDoSchema - */ - bool getDoSchema() const; - - /** Get the 'full schema constraint checking' flag - * - * This method returns the state of the parser's full schema constraint - * checking flag. - * - * @return true, if the parser is currently configured to - * have full schema constraint checking, false otherwise. - * - * @see #setValidationSchemaFullChecking - */ - bool getValidationSchemaFullChecking() const; - - bool getIdentityConstraintChecking() const; - - /** Get error count from the last parse operation. - * - * This method returns the error count from the last parse - * operation. Note that this count is actually stored in the - * scanner, so this method simply returns what the - * scanner reports. - * - * @return number of errors encountered during the latest - * parse operation. - * - */ - int getErrorCount() const; - - /** Get the 'do namespaces' flag - * - * This method returns the state of the parser's namespace processing - * flag. - * - * @return true, if the parser is currently configured to - * understand namespaces, false otherwise. - * - * @see #setDoNamespaces - */ - bool getDoNamespaces() const; - - /** Get the 'exit on first error' flag - * - * This method returns the state of the parser's - * exit-on-First-Fatal-Error flag. If this flag is true, then the - * parse will exit the first time it sees any non-wellformed XML or - * any validity error. The default state is true. - * - * @return true, if the parser is currently configured to - * exit on the first fatal error, false otherwise. - * - * @see #setExitOnFirstFatalError - */ - bool getExitOnFirstFatalError() const; - - /** - * This method returns the state of the parser's - * validation-constraint-fatal flag. - * - * @return true, if the parser is currently configured to - * set validation constraint errors as fatal, false - * otherwise. - * - * @see #setValidationContraintFatal - */ - bool getValidationConstraintFatal() const; - - /** Get the 'include entity references' flag - * - * This method returns the flag that specifies whether the parser is - * creating entity reference nodes in the DOM tree being produced. - * - * @return The state of the create entity reference node - * flag. - * @see #setCreateEntityReferenceNodes - */ - bool getCreateEntityReferenceNodes()const; - - /** Get the 'include ignorable whitespace' flag. - * - * This method returns the state of the parser's include ignorable - * whitespace flag. - * - * @return 'true' if the include ignorable whitespace flag is set on - * the parser, 'false' otherwise. - * - * @see #setIncludeIgnorableWhitespace - */ - bool getIncludeIgnorableWhitespace() const; - - /** Get the 'to create MXLDecl node' flag. - * - * This method returns the state of the parser's to create XMLDecl - * DOM Node flag. - * - * @return 'true' if the toCreateXMLDeclTypeNode flag is set on - * the parser, 'false' otherwise. - * - */ - bool getToCreateXMLDeclTypeNode() const; - - /** Get the set of Namespace/SchemaLocation that is specified externaly. - * - * This method returns the list of Namespace/SchemaLocation that was - * specified using setExternalSchemaLocation. - * - * The parser owns the returned string, and the memory allocated for - * the returned string will be destroyed when the parser is deleted. - * - * To ensure assessiblity of the returned information after the parser - * is deleted, callers need to copy and store the returned information - * somewhere else. - * - * @return a pointer to the list of Namespace/SchemaLocation that was - * specified externally. The pointer spans the same life-time as - * the parser. A null pointer is returned if nothing - * was specified externally. - * - * @see #setExternalSchemaLocation(const XMLCh* const) - */ - XMLCh* getExternalSchemaLocation() const; - - /** Get the noNamespace SchemaLocation that is specified externaly. - * - * This method returns the no target namespace XML Schema Location - * that was specified using setExternalNoNamespaceSchemaLocation. - * - * The parser owns the returned string, and the memory allocated for - * the returned string will be destroyed when the parser is deleted. - * - * To ensure assessiblity of the returned information after the parser - * is deleted, callers need to copy and store the returned information - * somewhere else. - * - * @return a pointer to the no target namespace Schema Location that was - * specified externally. The pointer spans the same life-time as - * the parser. A null pointer is returned if nothing - * was specified externally. - * - * @see #setExternalNoNamespaceSchemaLocation(const XMLCh* const) - */ - XMLCh* getExternalNoNamespaceSchemaLocation() const; - - /** Get the 'Grammar caching' flag - * - * This method returns the state of the parser's grammar caching when - * parsing an XML document. - * - * @return true, if the parser is currently configured to - * cache grammars, false otherwise. - * - * @see #cacheGrammarFromParse - */ - bool isCachingGrammarFromParse() const; - - /** Get the 'Use cached grammar' flag - * - * This method returns the state of the parser's use of cached grammar - * when parsing an XML document. - * - * @return true, if the parser is currently configured to - * use cached grammars, false otherwise. - * - * @see #useCachedGrammarInParse - */ - bool isUsingCachedGrammarInParse() const; - - /** - * Get the 'calculate src offset flag' - * - * This method returns the state of the parser's src offset calculation - * when parsing an XML document. - * - * @return true, if the parser is currently configured to - * calculate src offsets, false otherwise. - * - * @see #setCalculateSrcOfs - */ - bool getCalculateSrcOfs() const; - - /** - * Get the 'force standard uri flag' - * - * This method returns the state if the parser forces standard uri - * - * @return true, if the parser is currently configured to - * force standard uri, i.e. malformed uri will be rejected. - * - * @see #setStandardUriConformant - */ - bool getStandardUriConformant() const; - - /** - * Retrieve the grammar that is associated with the specified namespace key - * - * @param nameSpaceKey Namespace key - * @return Grammar associated with the Namespace key. - */ - Grammar* getGrammar(const XMLCh* const nameSpaceKey); - - /** - * Retrieve the grammar where the root element is declared. - * - * @return Grammar where root element declared - */ - Grammar* getRootGrammar(); - - /** - * Returns the string corresponding to a URI id from the URI string pool. - * - * @param uriId id of the string in the URI string pool. - * @return URI string corresponding to the URI id. - */ - const XMLCh* getURIText(unsigned int uriId) const; - - /** - * Returns the current src offset within the input source. - * - * @return offset within the input source - */ - unsigned int getSrcOffset() const; - - //@} - - - // ----------------------------------------------------------------------- - // Setter methods - // ----------------------------------------------------------------------- - - /** @name Setter methods */ - //@{ - - /** Set the error handler - * - * This method allows applications to install their own error handler - * to trap error and warning messages. - * - * <i>Any previously set handler is merely dropped, since the parser - * does not own them.</i> - * - * @param handler A const pointer to the user supplied error - * handler. - * - * @see #getErrorHandler - */ - void setErrorHandler(ErrorHandler* const handler); - - /** Set the PSVI handler - * - * This method allows applications to install their own PSVI handler. - * - * <i>Any previously set handler is merely dropped, since the parser - * does not own them.</i> - * - * @param handler A const pointer to the user supplied PSVI - * handler. - * - * @see #getPSVIHandler - */ - void setPSVIHandler(PSVIHandler* const handler); - - - /** Set the entity resolver - * - * This method allows applications to install their own entity - * resolver. By installing an entity resolver, the applications - * can trap and potentially redirect references to external - * entities. - * - * <i>Any previously set entity resolver is merely dropped, since the parser - * does not own them. If both setEntityResolver and setXMLEntityResolver - * are called, then the last one is used.</i> - * - * @param handler A const pointer to the user supplied entity - * resolver. - * - * @see #getEntityResolver - */ - void setEntityResolver(EntityResolver* const handler); - - /** Set the entity resolver - * - * This method allows applications to install their own entity - * resolver. By installing an entity resolver, the applications - * can trap and potentially redirect references to external - * entities. - * - * <i>Any previously set entity resolver is merely dropped, since the parser - * does not own them. If both setEntityResolver and setXMLEntityResolver - * are called, then the last one is used.</i> - * - * @param handler A const pointer to the user supplied entity - * resolver. - * - * @see #getXMLEntityResolver - */ - void setXMLEntityResolver(XMLEntityResolver* const handler); - - /** Set the 'do namespaces' flag - * - * This method allows users to enable or disable the parser's - * namespace processing. When set to true, parser starts enforcing - * all the constraints and rules specified by the NameSpace - * specification. - * - * The parser's default state is: false. - * - * @param newState The value specifying whether NameSpace rules should - * be enforced or not. - * - * @see #getDoNamespaces - */ - void setDoNamespaces(const bool newState); - - /** Set the 'exit on first error' flag - * - * This method allows users to set the parser's behaviour when it - * encounters the first fatal error. If set to true, the parser - * will exit at the first fatal error. If false, then it will - * report the error and continue processing. - * - * The default value is 'true' and the parser exits on the - * first fatal error. - * - * @param newState The value specifying whether the parser should - * continue or exit when it encounters the first - * fatal error. - * - * @see #getExitOnFirstFatalError - */ - void setExitOnFirstFatalError(const bool newState); - - /** - * This method allows users to set the parser's behaviour when it - * encounters a validtion constraint error. If set to true, and the - * the parser will treat validation error as fatal and will exit depends on the - * state of "getExitOnFirstFatalError". If false, then it will - * report the error and continue processing. - * - * Note: setting this true does not mean the validation error will be printed with - * the word "Fatal Error". It is still printed as "Error", but the parser - * will exit if "setExitOnFirstFatalError" is set to true. - * - * <p>The default value is 'false'.</p> - * - * @param newState If true, the parser will exit if "setExitOnFirstFatalError" - * is set to true. - * - * @see #getValidationConstraintFatal - * @see #setExitOnFirstFatalError - */ - void setValidationConstraintFatal(const bool newState); - - /** Set the 'include entity references' flag - * - * This method allows the user to specify whether the parser should - * create entity reference nodes in the DOM tree being produced. - * When the 'create' flag is - * true, the parser will create EntityReference nodes in the DOM tree. - * The EntityReference nodes and their child nodes will be read-only. - * When the 'create' flag is false, no EntityReference nodes will be created. - * <p>The replacement text - * of the entity is included in either case, either as a - * child of the Entity Reference node or in place at the location - * of the reference. - * <p>The default value is 'true'. - * - * @param create The new state of the create entity reference nodes - * flag. - * @see #getCreateEntityReferenceNodes - */ - void setCreateEntityReferenceNodes(const bool create); - - /** Set the 'include ignorable whitespace' flag - * - * This method allows the user to specify whether a validating parser - * should include ignorable whitespaces as text nodes. It has no effect - * on non-validating parsers which always include non-markup text. - * <p>When set to true (also the default), ignorable whitespaces will be - * added to the DOM tree as text nodes. The method - * DOM_Text::isIgnorableWhitespace() will return true for those text - * nodes only. - * <p>When set to false, all ignorable whitespace will be discarded and - * no text node is added to the DOM tree. Note: applications intended - * to process the "xml:space" attribute should not set this flag to false. - * And this flag also overrides any schema datateye whitespace facets, - * that is, all ignorable whitespace will be discarded even though - * 'preserve' is set in schema datatype whitespace facets. - * - * @param include The new state of the include ignorable whitespace - * flag. - * - * @see #getIncludeIgnorableWhitespace - */ - void setIncludeIgnorableWhitespace(const bool include); - - /** - * This method allows users to set the validation scheme to be used - * by this parser. The value is one of the ValSchemes enumerated values - * defined by this class: - * - * <br> Val_Never - turn off validation - * <br> Val_Always - turn on validation - * <br> Val_Auto - turn on validation if any internal/external - * DTD subset have been seen - * - * <p>The parser's default state is: Val_Never.</p> - * - * @param newScheme The new validation scheme to use. - * - * @see #getValidationScheme - */ - void setValidationScheme(const ValSchemes newScheme); - - /** Set the 'do schema' flag - * - * This method allows users to enable or disable the parser's - * schema processing. When set to false, parser will not process - * any schema found. - * - * The parser's default state is: false. - * - * Note: If set to true, namespace processing must also be turned on. - * - * @param newState The value specifying whether schema support should - * be enforced or not. - * - * @see #getDoSchema - */ - void setDoSchema(const bool newState); - - /** - * This method allows the user to turn full Schema constraint checking on/off. - * Only takes effect if Schema validation is enabled. - * If turned off, partial constraint checking is done. - * - * Full schema constraint checking includes those checking that may - * be time-consuming or memory intensive. Currently, particle unique - * attribution constraint checking and particle derivation resriction checking - * are controlled by this option. - * - * The parser's default state is: false. - * - * @param schemaFullChecking True to turn on full schema constraint checking. - * - * @see #getValidationSchemaFullChecking - */ - void setValidationSchemaFullChecking(const bool schemaFullChecking); - - void setIdentityConstraintChecking(const bool identityConstraintChecking); - - /** - * This method allows users to set the toCreateXMLDeclTypeNode flag - * by this parser. By setting it to 'true' user can have XMLDecl type - * nodes attached to the DOM tree. - * - * <p>The parser's default state is: false </p> - * - * @param create The new to create XMLDecl type node flag - * - */ - void setToCreateXMLDeclTypeNode(const bool create); - - /** - * This method allows the user to specify a list of schemas to use. - * If the targetNamespace of a schema specified using this method matches - * the targetNamespace of a schema occuring in the instance document in - * the schemaLocation attribute, or if the targetNamespace matches the - * namespace attribute of the "import" element, the schema specified by the - * user using this method will be used (i.e., the schemaLocation attribute - * in the instance document or on the "import" element will be effectively ignored). - * - * If this method is called more than once, only the last one takes effect. - * - * The syntax is the same as for schemaLocation attributes in instance - * documents: e.g, "http://www.example.com file_name.xsd". The user can - * specify more than one XML Schema in the list. - * - * @param schemaLocation the list of schemas to use - * - * @see #getExternalSchemaLocation - */ - - void setExternalSchemaLocation(const XMLCh* const schemaLocation); - - /** - * This method is same as setExternalSchemaLocation(const XMLCh* const). - * It takes native char string as parameter - * - * @param schemaLocation the list of schemas to use - * - * @see #setExternalSchemaLocation(const XMLCh* const) - */ - void setExternalSchemaLocation(const char* const schemaLocation); - - /** - * This method allows the user to specify the no target namespace XML - * Schema Location externally. If specified, the instance document's - * noNamespaceSchemaLocation attribute will be effectively ignored. - * - * If this method is called more than once, only the last one takes effect. - * - * The syntax is the same as for the noNamespaceSchemaLocation attribute - * that may occur in an instance document: e.g."file_name.xsd". - * - * @param noNamespaceSchemaLocation the XML Schema Location with no target namespace - * - * @see #getExternalNoNamespaceSchemaLocation - */ - void setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation); - - /** - * This method is same as setExternalNoNamespaceSchemaLocation(const XMLCh* const). - * It takes native char string as parameter - * - * @param noNamespaceSchemaLocation the XML Schema Location with no target namespace - * - * @see #setExternalNoNamespaceSchemaLocation(const XMLCh* const) - */ - void setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation); - - /** Set the 'Grammar caching' flag - * - * This method allows users to enable or disable caching of grammar when - * parsing XML documents. When set to true, the parser will cache the - * resulting grammar for use in subsequent parses. - * - * If the flag is set to true, the 'Use cached grammar' flag will also be - * set to true. - * - * The parser's default state is: false. - * - * @param newState The value specifying whether we should cache grammars - * or not. - * - * @see #isCachingGrammarFromParse - * @see #useCachedGrammarInParse - */ - void cacheGrammarFromParse(const bool newState); - - /** Set the 'Use cached grammar' flag - * - * This method allows users to enable or disable the use of cached - * grammars. When set to true, the parser will use the cached grammar, - * instead of building the grammar from scratch, to validate XML - * documents. - * - * If the 'Grammar caching' flag is set to true, this mehod ignore the - * value passed in. - * - * The parser's default state is: false. - * - * @param newState The value specifying whether we should use the cached - * grammar or not. - * - * @see #isUsingCachedGrammarInParse - * @see #cacheGrammarFromParse - */ - void useCachedGrammarInParse(const bool newState); - - /** Enable/disable src offset calculation - * - * This method allows users to enable/disable src offset calculation. - * Disabling the calculation will improve performance. - * - * The parser's default state is: false. - * - * @param newState The value specifying whether we should enable or - * disable src offset calculation - * - * @see #getCalculateSrcOfs - */ - void setCalculateSrcOfs(const bool newState); - - /** Force standard uri - * - * This method allows users to tell the parser to force standard uri conformance. - * - * The parser's default state is: false. - * - * @param newState The value specifying whether the parser should reject malformed URI. - * - * @see #getStandardUriConformant - */ - void setStandardUriConformant(const bool newState); - - /** Set the scanner to use when scanning the XML document - * - * This method allows users to set the scanner to use - * when scanning a given XML document. - * - * @param scannerName The name of the desired scanner - */ - void useScanner(const XMLCh* const scannerName); - - //@} - - - // ----------------------------------------------------------------------- - // Parsing methods - // ----------------------------------------------------------------------- - - /** @name Parsing methods */ - //@{ - - /** Parse via an input source object - * - * This method invokes the parsing process on the XML file specified - * by the InputSource parameter. This API is borrowed from the - * SAX Parser interface. - * - * @param source A const reference to the InputSource object which - * points to the XML file to be parsed. - * @exception SAXException Any SAX exception, possibly - * wrapping another exception. - * @exception XMLException An exception from the parser or client - * handler code. - * @exception DOM_DOMException A DOM exception as per DOM spec. - * @see InputSource#InputSource - * @see #setEntityResolver - * @see #setErrorHandler - */ - void parse(const InputSource& source); - - /** Parse via a file path or URL - * - * This method invokes the parsing process on the XML file specified by - * the Unicode string parameter 'systemId'. This method is borrowed - * from the SAX Parser interface. - * - * @param systemId A const XMLCh pointer to the Unicode string which - * contains the path to the XML file to be parsed. - * - * @exception SAXException Any SAX exception, possibly - * wrapping another exception. - * @exception XMLException An exception from the parser or client - * handler code. - * @exception DOM_DOMException A DOM exception as per DOM spec. - * @see #parse(InputSource,...) - */ - void parse(const XMLCh* const systemId); - - /** Parse via a file path or URL (in the local code page) - * - * This method invokes the parsing process on the XML file specified by - * the native char* string parameter 'systemId'. - * - * @param systemId A const char pointer to a native string which - * contains the path to the XML file to be parsed. - * @exception SAXException Any SAX exception, possibly - * wrapping another exception. - * @exception XMLException An exception from the parser or client - * handler code. - * @exception DOM_DOMException A DOM exception as per DOM spec. - * @see #parse(InputSource,...) - */ - void parse(const char* const systemId); - - /** Begin a progressive parse operation - * - * This method is used to start a progressive parse on a XML file. - * To continue parsing, subsequent calls must be to the parseNext - * method. - * - * It scans through the prolog and returns a token to be used on - * subsequent scanNext() calls. If the return value is true, then the - * token is legal and ready for further use. If it returns false, then - * the scan of the prolog failed and the token is not going to work on - * subsequent scanNext() calls. - * - * @param systemId A pointer to a Unicode string represting the path - * to the XML file to be parsed. - * @param toFill A token maintaing state information to maintain - * internal consistency between invocation of 'parseNext' - * calls. - * @return 'true', if successful in parsing the prolog. It indicates the - * user can go ahead with parsing the rest of the file. It - * returns 'false' to indicate that the parser could not parse - * the prolog. - * - * @see #parseNext - * @see #parseFirst(char*,...) - * @see #parseFirst(InputSource&,...) - */ - bool parseFirst - ( - const XMLCh* const systemId - , XMLPScanToken& toFill - ); - - /** Begin a progressive parse operation - * - * This method is used to start a progressive parse on a XML file. - * To continue parsing, subsequent calls must be to the parseNext - * method. - * - * It scans through the prolog and returns a token to be used on - * subsequent scanNext() calls. If the return value is true, then the - * token is legal and ready for further use. If it returns false, then - * the scan of the prolog failed and the token is not going to work on - * subsequent scanNext() calls. - * - * @param systemId A pointer to a regular native string represting - * the path to the XML file to be parsed. - * @param toFill A token maintaing state information to maintain - * internal consistency between invocation of 'parseNext' - * calls. - * - * @return 'true', if successful in parsing the prolog. It indicates the - * user can go ahead with parsing the rest of the file. It - * returns 'false' to indicate that the parser could not parse - * the prolog. - * - * @see #parseNext - * @see #parseFirst(XMLCh*,...) - * @see #parseFirst(InputSource&,...) - */ - bool parseFirst - ( - const char* const systemId - , XMLPScanToken& toFill - ); - - /** Begin a progressive parse operation - * - * This method is used to start a progressive parse on a XML file. - * To continue parsing, subsequent calls must be to the parseNext - * method. - * - * It scans through the prolog and returns a token to be used on - * subsequent scanNext() calls. If the return value is true, then the - * token is legal and ready for further use. If it returns false, then - * the scan of the prolog failed and the token is not going to work on - * subsequent scanNext() calls. - * - * @param source A const reference to the InputSource object which - * points to the XML file to be parsed. - * @param toFill A token maintaing state information to maintain - * internal consistency between invocation of 'parseNext' - * calls. - * - * @return 'true', if successful in parsing the prolog. It indicates the - * user can go ahead with parsing the rest of the file. It - * returns 'false' to indicate that the parser could not parse - * the prolog. - * - * @see #parseNext - * @see #parseFirst(XMLCh*,...) - * @see #parseFirst(char*,...) - */ - bool parseFirst - ( - const InputSource& source - , XMLPScanToken& toFill - ); - - /** Continue a progressive parse operation - * - * This method is used to continue with progressive parsing of - * XML files started by a call to 'parseFirst' method. - * - * It parses the XML file and stops as soon as it comes across - * a XML token (as defined in the XML specification). - * - * @param token A token maintaing state information to maintain - * internal consistency between invocation of 'parseNext' - * calls. - * - * @return 'true', if successful in parsing the next XML token. - * It indicates the user can go ahead with parsing the rest - * of the file. It returns 'false' to indicate that the parser - * could not find next token as per the XML specification - * production rule. - * - * @see #parseFirst(XMLCh*,...) - * @see #parseFirst(char*,...) - * @see #parseFirst(InputSource&,...) - */ - bool parseNext(XMLPScanToken& token); - - /** Reset the parser after a progressive parse - * - * If a progressive parse loop exits before the end of the document - * is reached, the parser has no way of knowing this. So it will leave - * open any files or sockets or memory buffers that were in use at - * the time that the parse loop exited. - * - * The next parse operation will cause these open files and such to - * be closed, but the next parse operation might occur at some unknown - * future point. To avoid this problem, you should reset the parser if - * you exit the loop early. - * - * If you exited because of an error, then this cleanup will be done - * for you. Its only when you exit the file prematurely of your own - * accord, because you've found what you wanted in the file most - * likely. - * - * @param token A token maintaing state information to maintain - * internal consistency between invocation of 'parseNext' - * calls. - * - * @see #parseFirst(XMLCh*,...) - * @see #parseFirst(char*,...) - * @see #parseFirst(InputSource&,...) - */ - void parseReset(XMLPScanToken& token); - - //@} - - // ----------------------------------------------------------------------- - // Grammar preparsing interface - // ----------------------------------------------------------------------- - - /** @name Implementation of Grammar preparsing interface's. */ - //@{ - /** - * Preparse schema grammar (XML Schema, DTD, etc.) via an input source - * object. - * - * This method invokes the preparsing process on a schema grammar XML - * file specified by the SAX InputSource parameter. If the 'toCache' flag - * is enabled, the parser will cache the grammars for re-use. If a grammar - * key is found in the pool, no caching of any grammar will take place. - * - * <p><b>"Experimental - subject to change"</b></p> - * - * @param source A const reference to the SAX InputSource object which - * points to the schema grammar file to be preparsed. - * @param grammarType The grammar type (Schema or DTD). - * @param toCache If <code>true</code>, we cache the preparsed grammar, - * otherwise, no chaching. Default is <code>false</code>. - * @return The preparsed schema grammar object (SchemaGrammar or - * DTDGrammar). That grammar object is owned by the parser. - * - * @exception SAXException Any SAX exception, possibly - * wrapping another exception. - * @exception XMLException An exception from the parser or client - * handler code. - * @exception DOMException A DOM exception as per DOM spec. - * - * @see InputSource#InputSource - */ - Grammar* loadGrammar(const InputSource& source, - const short grammarType, - const bool toCache = false); - - /** - * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL - * - * This method invokes the preparsing process on a schema grammar XML - * file specified by the file path parameter. If the 'toCache' flag - * is enabled, the parser will cache the grammars for re-use. If a grammar - * key is found in the pool, no caching of any grammar will take place. - * - * <p><b>"Experimental - subject to change"</b></p> - * - * @param systemId A const XMLCh pointer to the Unicode string which - * contains the path to the XML grammar file to be - * preparsed. - * @param grammarType The grammar type (Schema or DTD). - * @param toCache If <code>true</code>, we cache the preparsed grammar, - * otherwise, no chaching. Default is <code>false</code>. - * @return The preparsed schema grammar object (SchemaGrammar or - * DTDGrammar). That grammar object is owned by the parser. - * - * @exception SAXException Any SAX exception, possibly - * wrapping another exception. - * @exception XMLException An exception from the parser or client - * handler code. - * @exception DOMException A DOM exception as per DOM spec. - */ - Grammar* loadGrammar(const XMLCh* const systemId, - const short grammarType, - const bool toCache = false); - - /** - * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL - * - * This method invokes the preparsing process on a schema grammar XML - * file specified by the file path parameter. If the 'toCache' flag - * is enabled, the parser will cache the grammars for re-use. If a grammar - * key is found in the pool, no caching of any grammar will take place. - * - * <p><b>"Experimental - subject to change"</b></p> - * - * @param systemId A const char pointer to a native string which contains - * the path to the XML grammar file to be preparsed. - * @param grammarType The grammar type (Schema or DTD). - * @param toCache If <code>true</code>, we cache the preparsed grammar, - * otherwise, no chaching. Default is <code>false</code>. - * @return The preparsed schema grammar object (SchemaGrammar or - * DTDGrammar). That grammar object is owned by the parser. - * - * @exception SAXException Any SAX exception, possibly - * wrapping another exception. - * @exception XMLException An exception from the parser or client - * handler code. - * @exception DOMException A DOM exception as per DOM spec. - */ - Grammar* loadGrammar(const char* const systemId, - const short grammarType, - const bool toCache = false); - - /** - * This method allows the user to reset the pool of cached grammars. - */ - void resetCachedGrammarPool(); - - //@} - - - - // ----------------------------------------------------------------------- - // Implementation of the XMLErrorReporter interface. - // ----------------------------------------------------------------------- - - /** @name Implementation of the XMLErrorReporter interface. */ - //@{ - - /** Handle errors reported from the parser - * - * This method is used to report back errors found while parsing the - * XML file. This method is also borrowed from the SAX specification. - * It calls the corresponding user installed Error Handler method: - * 'fatal', 'error', 'warning' depending on the severity of the error. - * This classification is defined by the XML specification. - * - * @param errCode An integer code for the error. - * @param msgDomain A const pointer to an Unicode string representing - * the message domain to use. - * @param errType An enumeration classifying the severity of the error. - * @param errorText A const pointer to an Unicode string representing - * the text of the error message. - * @param systemId A const pointer to an Unicode string representing - * the system id of the XML file where this error - * was discovered. - * @param publicId A const pointer to an Unicode string representing - * the public id of the XML file where this error - * was discovered. - * @param lineNum The line number where the error occurred. - * @param colNum The column number where the error occurred. - * @see ErrorHandler - */ - virtual void error - ( - const unsigned int errCode - , const XMLCh* const msgDomain - , const XMLErrorReporter::ErrTypes errType - , const XMLCh* const errorText - , const XMLCh* const systemId - , const XMLCh* const publicId - , const XMLSSize_t lineNum - , const XMLSSize_t colNum - ); - - /** Reset any error data before a new parse - * - * This method allows the user installed Error Handler callback to - * 'reset' itself. - * - * <b><font color="#FF0000">This method is a no-op for this DOM - * implementation.</font></b> - */ - virtual void resetErrors(); - //@} - - - // ----------------------------------------------------------------------- - // Implementation of the XMLEntityHandler interface. - // ----------------------------------------------------------------------- - - /** @name Implementation of the XMLEntityHandler interface. */ - //@{ - - /** Handle an end of input source event - * - * This method is used to indicate the end of parsing of an external - * entity file. - * - * <b><font color="#FF0000">This method is a no-op for this DOM - * implementation.</font></b> - * - * @param inputSource A const reference to the InputSource object - * which points to the XML file being parsed. - * @see InputSource - */ - virtual void endInputSource(const InputSource& inputSource); - - /** Expand a system id - * - * This method allows an installed XMLEntityHandler to further - * process any system id's of enternal entities encountered in - * the XML file being parsed, such as redirection etc. - * - * <b><font color="#FF0000">This method always returns 'false' - * for this DOM implementation.</font></b> - * - * @param systemId A const pointer to an Unicode string representing - * the system id scanned by the parser. - * @param toFill A pointer to a buffer in which the application - * processed system id is stored. - * @return 'true', if any processing is done, 'false' otherwise. - */ - virtual bool expandSystemId - ( - const XMLCh* const systemId - , XMLBuffer& toFill - ); - - /** Reset any entity handler information - * - * This method allows the installed XMLEntityHandler to reset - * itself. - * - * <b><font color="#FF0000">This method is a no-op for this DOM - * implementation.</font></b> - */ - virtual void resetEntities(); - - /** Resolve a public/system id - * - * This method allows a user installed entity handler to further - * process any pointers to external entities. The applications can - * implement 'redirection' via this callback. - * - * @param resourceIdentifier An object containing the type of - * resource to be resolved and the associated data members - * corresponding to this type. - * @return The value returned by the user installed resolveEntity - * method or NULL otherwise to indicate no processing was done. - * The returned InputSource is owned by the parser which is - * responsible to clean up the memory. - * @see XMLEntityHandler - * @see XMLEntityResolver - */ - virtual InputSource* resolveEntity - ( - XMLResourceIdentifier* resourceIdentifier - ); - - /** Handle a 'start input source' event - * - * This method is used to indicate the start of parsing an external - * entity file. - * - * <b><font color="#FF0000">This method is a no-op for this DOM parse - * implementation.</font></b> - * - * @param inputSource A const reference to the InputSource object - * which points to the external entity - * being parsed. - */ - virtual void startInputSource(const InputSource& inputSource); - - //@} - - - - // ----------------------------------------------------------------------- - // Implementation of the XMLDocumentHandler interface. - // ----------------------------------------------------------------------- - - /** @name Implementation of the XMLDocumentHandler interface. */ - //@{ - - /** Handle document character events - * - * This method is used to report all the characters scanned by the - * parser. This DOM implementation stores this data in the appropriate - * DOM node, creating one if necessary. - * - * @param chars A const pointer to a Unicode string representing the - * character data. - * @param length The length of the Unicode string returned in 'chars'. - * @param cdataSection A flag indicating if the characters represent - * content from the CDATA section. - */ - virtual void docCharacters - ( - const XMLCh* const chars - , const unsigned int length - , const bool cdataSection - ); - - /** Handle a document comment event - * - * This method is used to report any comments scanned by the parser. - * A new comment node is created which stores this data. - * - * @param comment A const pointer to a null terminated Unicode - * string representing the comment text. - */ - virtual void docComment - ( - const XMLCh* const comment - ); - - /** Handle a document PI event - * - * This method is used to report any PI scanned by the parser. A new - * PI node is created and appended as a child of the current node in - * the tree. - * - * @param target A const pointer to a Unicode string representing the - * target of the PI declaration. - * @param data A const pointer to a Unicode string representing the - * data of the PI declaration. See the PI production rule - * in the XML specification for details. - */ - virtual void docPI - ( - const XMLCh* const target - , const XMLCh* const data - ); - - /** Handle the end of document event - * - * This method is used to indicate the end of the current document. - */ - virtual void endDocument(); - - /** Handle and end of element event - * - * This method is used to indicate the end tag of an element. The - * DOMParse pops the current element off the top of the element - * stack, and make it the new current element. - * - * @param elemDecl A const reference to the object containing element - * declaration information. - * @param urlId An id referring to the namespace prefix, if - * namespaces setting is switched on. - * @param isRoot A flag indicating whether this element was the - * root element. - * @param elemPrefix A const pointer to a Unicode string containing - * the namespace prefix for this element. Applicable - * only when namespace processing is enabled. - */ - virtual void endElement - ( - const XMLElementDecl& elemDecl - , const unsigned int urlId - , const bool isRoot - , const XMLCh* const elemPrefix=0 - ); - - /** Handle and end of entity reference event - * - * This method is used to indicate that an end of an entity reference - * was just scanned. - * - * @param entDecl A const reference to the object containing the - * entity declaration information. - */ - virtual void endEntityReference - ( - const XMLEntityDecl& entDecl - ); - - /** Handle an ignorable whitespace vent - * - * This method is used to report all the whitespace characters, which - * are determined to be 'ignorable'. This distinction between characters - * is only made, if validation is enabled. - * - * Any whitespace before content is ignored. If the current node is - * already of type DOM_Node::TEXT_NODE, then these whitespaces are - * appended, otherwise a new Text node is created which stores this - * data. Essentially all contiguous ignorable characters are collected - * in one node. - * - * @param chars A const pointer to a Unicode string representing the - * ignorable whitespace character data. - * @param length The length of the Unicode string 'chars'. - * @param cdataSection A flag indicating if the characters represent - * content from the CDATA section. - */ - virtual void ignorableWhitespace - ( - const XMLCh* const chars - , const unsigned int length - , const bool cdataSection - ); - - /** Handle a document reset event - * - * This method allows the user installed Document Handler to 'reset' - * itself, freeing all the memory resources. The scanner calls this - * method before starting a new parse event. - */ - virtual void resetDocument(); - - /** Handle a start document event - * - * This method is used to report the start of the parsing process. - */ - virtual void startDocument(); - - /** Handle a start element event - * - * This method is used to report the start of an element. It is - * called at the end of the element, by which time all attributes - * specified are also parsed. A new DOM Element node is created - * along with as many attribute nodes as required. This new element - * is added appended as a child of the current node in the tree, and - * then replaces it as the current node (if the isEmpty flag is false.) - * - * @param elemDecl A const reference to the object containing element - * declaration information. - * @param urlId An id referring to the namespace prefix, if - * namespaces setting is switched on. - * @param elemPrefix A const pointer to a Unicode string containing - * the namespace prefix for this element. Applicable - * only when namespace processing is enabled. - * @param attrList A const reference to the object containing the - * list of attributes just scanned for this element. - * @param attrCount A count of number of attributes in the list - * specified by the parameter 'attrList'. - * @param isEmpty A flag indicating whether this is an empty element - * or not. If empty, then no endElement() call will - * be made. - * @param isRoot A flag indicating whether this element was the - * root element. - * @see DocumentHandler#startElement - */ - virtual void startElement - ( - const XMLElementDecl& elemDecl - , const unsigned int urlId - , const XMLCh* const elemPrefix - , const RefVectorOf<XMLAttr>& attrList - , const unsigned int attrCount - , const bool isEmpty - , const bool isRoot - ); - - /** Handle a start entity reference event - * - * This method is used to indicate the start of an entity reference. - * If the expand entity reference flag is true, then a new - * DOM Entity reference node is created. - * - * @param entDecl A const reference to the object containing the - * entity declaration information. - */ - virtual void startEntityReference - ( - const XMLEntityDecl& entDecl - ); - - /** Handle an XMLDecl event - * - * This method is used to report the XML decl scanned by the parser. - * Refer to the XML specification to see the meaning of parameters. - * - * <b><font color="#FF0000">This method is a no-op for this DOM - * implementation.</font></b> - * - * @param versionStr A const pointer to a Unicode string representing - * version string value. - * @param encodingStr A const pointer to a Unicode string representing - * the encoding string value. - * @param standaloneStr A const pointer to a Unicode string - * representing the standalone string value. - * @param actualEncStr A const pointer to a Unicode string - * representing the actual encoding string - * value. - */ - virtual void XMLDecl - ( - const XMLCh* const versionStr - , const XMLCh* const encodingStr - , const XMLCh* const standaloneStr - , const XMLCh* const actualEncStr - ); - //@} - - - /** @name Deprecated Methods */ - //@{ - /** Set the 'expand entity references' flag - * - * DEPRECATED. USE setCreateEntityReferenceNodes instead. - * This method allows the user to specify whether the parser should - * expand all entity reference nodes. When the 'do expansion' flag is - * true, the DOM tree does not have any entity reference nodes. It is - * replaced by the sub-tree representing the replacement text of the - * entity. When the 'do expansion' flag is false, the DOM tree - * contains an extra entity reference node, whose children is the - * sub tree of the replacement text. - * <p>The default value is 'false'. - * - * @param expand The new state of the expand entity reference - * flag. - * @see #setCreateEntityReferenceNodes - */ - void setExpandEntityReferences(const bool expand); - - /** Get the 'expand entity references' flag. - * DEPRECATED Use getCreateEntityReferenceNodes() instead. - * - * This method returns the state of the parser's expand entity - * references flag. - * - * @return 'true' if the expand entity reference flag is set on - * the parser, 'false' otherwise. - * - * @see #setExpandEntityReferences - * @see #setCreateEntityReferenceNodes - * @see #getCreateEntityReferenceNodes - */ - bool getExpandEntityReferences() const; - - /** - * DEPRECATED Use getValidationScheme() instead - * - * This method returns the state of the parser's validation - * handling flag which controls whether validation checks - * are enforced or not. - * - * @return true, if the parser is currently configured to - * do validation, false otherwise. - * - * @see #setDoValidation - * @see #getValidationScheme - */ - bool getDoValidation() const; - - /** - * DEPRECATED Use setValidationScheme(const ValSchemes newScheme) instead - * - * This method allows users to enable or disable the parser's validation - * checks. - * - * <p>By default, the parser does not to any validation. The default - * value is false.</p> - * - * @param newState The value specifying whether the parser should - * do validity checks or not against the DTD in the - * input XML document. - * - * @see #getDoValidation - * @see #setValidationScheme - */ - void setDoValidation(const bool newState); - - /** - * Deprecated doctypehandler interfaces - */ - virtual void attDef - ( - const DTDElementDecl& elemDecl - , const DTDAttDef& attDef - , const bool ignoring - ); - - virtual void doctypeComment - ( - const XMLCh* const comment - ); - - virtual void doctypeDecl - ( - const DTDElementDecl& elemDecl - , const XMLCh* const publicId - , const XMLCh* const systemId - , const bool hasIntSubset - , const bool hasExtSubset = false - ); - - virtual void doctypePI - ( - const XMLCh* const target - , const XMLCh* const data - ); - - virtual void doctypeWhitespace - ( - const XMLCh* const chars - , const unsigned int length - ); - - virtual void elementDecl - ( - const DTDElementDecl& decl - , const bool isIgnored - ); - - virtual void endAttList - ( - const DTDElementDecl& elemDecl - ); - - virtual void endIntSubset(); - - virtual void endExtSubset(); - - virtual void entityDecl - ( - const DTDEntityDecl& entityDecl - , const bool isPEDecl - , const bool isIgnored - ); - - virtual void resetDocType(); - - virtual void notationDecl - ( - const XMLNotationDecl& notDecl - , const bool isIgnored - ); - - virtual void startAttList - ( - const DTDElementDecl& elemDecl - ); - - virtual void startIntSubset(); - - virtual void startExtSubset(); - - virtual void TextDecl - ( - const XMLCh* const versionStr - , const XMLCh* const encodingStr - ); - - - //@} - - -protected : - // ----------------------------------------------------------------------- - // Protected getter methods - // ----------------------------------------------------------------------- - - /** @name Protected getter methods */ - //@{ - /** Get the current DOM node - * - * This provides derived classes with access to the current node, i.e. - * the node to which new nodes are being added. - */ - DOM_Node getCurrentNode(); - - //@} - - - // ----------------------------------------------------------------------- - // Protected setter methods - // ----------------------------------------------------------------------- - - /** @name Protected setter methods */ - //@{ - - /** Set the current DOM node - * - * This method sets the current node maintained inside the parser to - * the one specified. - * - * @param toSet The DOM node which will be the current node. - */ - void setCurrentNode(DOM_Node toSet); - - /** Set the document node - * - * This method sets the DOM Document node to the one specified. - * - * @param toSet The new DOM Document node for this XML document. - */ - void setDocument(DOM_Document toSet); - //@} - - -private : - // ----------------------------------------------------------------------- - // Protected setter methods - // ----------------------------------------------------------------------- - void initialize(); - void cleanUp(); - - // unimplemented - DOMParser ( const DOMParser& toCopy); - DOMParser& operator= (const DOMParser& other); - - // ----------------------------------------------------------------------- - // Private data members - // - // fCurrentNode - // fCurrentParent - // Used to track the current node during nested element events. Since - // the tree must be built from a set of disjoint callbacks, we need - // these to keep up with where we currently are. - // - // fDocument - // The root document object, filled with the document contents. - // - // fEntityResolver - // The installed SAX entity resolver, if any. Null if none. - // - // fErrorHandler - // The installed SAX error handler, if any. Null if none. - // - // fCreateEntityReferenceNode - // Indicates whether entity reference nodes should be created. - // - // fIncludeIgnorableWhitespace - // Indicates whether ignorable whiltespace should be added to - // the DOM tree for validating parsers. - // - // fNodeStack - // Used to track previous parent nodes during nested element events. - // - // fParseInProgress - // Used to prevent multiple entrance to the parser while its doing - // a parse. - // - // fScanner - // The scanner used for this parser. This is created during the - // constructor. - // - // fWithinElement - // A flag to indicate that the parser is within at least one level - // of element processing. - // - // fDocumentType - // Used to store and update the documentType variable information - // in fDocument - // - // fToCreateXMLDecTypeNode - // A flag to create a DOM_XMLDecl node in the ODM tree if it exists - // This is an extension to xerces implementation - // - // fGrammarPool - // The grammar pool passed from external application (through derivatives). - // which could be 0, not owned. - // - // ----------------------------------------------------------------------- - bool fToCreateXMLDeclTypeNode; - bool fCreateEntityReferenceNodes; - bool fIncludeIgnorableWhitespace; - bool fParseInProgress; - bool fWithinElement; - DOM_Node fCurrentParent; - DOM_Node fCurrentNode; - DOM_Document fDocument; - EntityResolver* fEntityResolver; - XMLEntityResolver* fXMLEntityResolver; - ErrorHandler* fErrorHandler; - PSVIHandler* fPSVIHandler; - ValueStackOf<DOM_Node>* fNodeStack; - XMLScanner* fScanner; - DocumentTypeImpl* fDocumentType; - GrammarResolver* fGrammarResolver; - XMLStringPool* fURIStringPool; - XMLValidator* fValidator; - MemoryManager* fMemoryManager; - XMLGrammarPool* fGrammarPool; -}; - - -// --------------------------------------------------------------------------- -// DOMParser: Handlers for the XMLEntityHandler interface -// --------------------------------------------------------------------------- -inline void DOMParser::endInputSource(const InputSource&) -{ - // The DOM entity resolver doesn't handle this -} - -inline bool DOMParser::expandSystemId(const XMLCh* const, XMLBuffer&) -{ - // The DOM entity resolver doesn't handle this - return false; -} - -inline void DOMParser::resetEntities() -{ - // Nothing to do on this one -} - -inline void DOMParser::startInputSource(const InputSource&) -{ - // The DOM entity resolver doesn't handle this -} - - -// --------------------------------------------------------------------------- -// DOMParser: Getter methods -// --------------------------------------------------------------------------- -inline DOM_Document DOMParser::getDocument() -{ - return fDocument; -} - -inline ErrorHandler* DOMParser::getErrorHandler() -{ - return fErrorHandler; -} - -inline const ErrorHandler* DOMParser::getErrorHandler() const -{ - return fErrorHandler; -} - -inline PSVIHandler* DOMParser::getPSVIHandler() -{ - return fPSVIHandler; -} - -inline const PSVIHandler* DOMParser::getPSVIHandler() const -{ - return fPSVIHandler; -} - -inline EntityResolver* DOMParser::getEntityResolver() -{ - return fEntityResolver; -} - -inline XMLEntityResolver* DOMParser::getXMLEntityResolver() -{ - return fXMLEntityResolver; -} - -inline const XMLEntityResolver* DOMParser::getXMLEntityResolver() const -{ - return fXMLEntityResolver; -} - -inline const EntityResolver* DOMParser::getEntityResolver() const -{ - return fEntityResolver; -} - -inline bool DOMParser::getExpandEntityReferences() const -{ - return !fCreateEntityReferenceNodes; -} -inline bool DOMParser::getCreateEntityReferenceNodes() const -{ - return fCreateEntityReferenceNodes; -} - -inline bool DOMParser::getIncludeIgnorableWhitespace() const -{ - return fIncludeIgnorableWhitespace; -} - -inline const XMLScanner& DOMParser::getScanner() const -{ - return *fScanner; -} - -inline bool DOMParser::getToCreateXMLDeclTypeNode() const -{ - return fToCreateXMLDeclTypeNode; -} - - -// --------------------------------------------------------------------------- -// DOMParser: Setter methods -// --------------------------------------------------------------------------- -inline void DOMParser::setExpandEntityReferences(const bool expand) -{ - fCreateEntityReferenceNodes = !expand; -} - -inline void DOMParser::setCreateEntityReferenceNodes(const bool create) -{ - fCreateEntityReferenceNodes = create; -} - -inline void DOMParser::setIncludeIgnorableWhitespace(const bool include) -{ - fIncludeIgnorableWhitespace = include; -} - -inline void DOMParser::setToCreateXMLDeclTypeNode(const bool create) -{ - fToCreateXMLDeclTypeNode = create; -} - - -// --------------------------------------------------------------------------- -// DOMParser: Protected getter methods -// --------------------------------------------------------------------------- -inline DOM_Node DOMParser::getCurrentNode() -{ - return fCurrentNode; -} - -// --------------------------------------------------------------------------- -// DOMParser: Protected setter methods -// --------------------------------------------------------------------------- -inline void DOMParser::setCurrentNode(DOM_Node toSet) -{ - fCurrentNode = toSet; -} - -inline void DOMParser::setDocument(DOM_Document toSet) -{ - fDocument = toSet; -} - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/DOMString.cpp b/src/xercesc/dom/deprecated/DOMString.cpp deleted file mode 100644 index cf62f32e4c2bfe0dd6aa8efc42415661d65350d1..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOMString.cpp +++ /dev/null @@ -1,1116 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include <stdio.h> -#include <xercesc/util/PlatformUtils.hpp> -#include <xercesc/util/RuntimeException.hpp> -#include <xercesc/util/TransService.hpp> -#include <xercesc/util/XMLString.hpp> -#include <xercesc/util/XMLRegisterCleanup.hpp> -#include "DOM_DOMException.hpp" -#include "DOMString.hpp" - -#ifndef XML_DEBUG -#include "DOMStringImpl.hpp" -#endif - -#include <assert.h> -#include <string.h> - -XERCES_CPP_NAMESPACE_BEGIN - -//---------------------------------------------- -// -// Forward decls -// -//---------------------------------------------- -static void reinitDomConverter(); -static void reinitDomMutex(); -XMLLCPTranscoder* getDomConverter(); - - -// --------------------------------------------------------------------------- -// Local static functions -// --------------------------------------------------------------------------- - -// getDOMConverter - get the converter from the system default -// codepage to Unicode that is to be used when -// a DOMString is constructed from a char *. -// -static XMLLCPTranscoder* gDomConverter = 0; -static XMLRegisterCleanup cleanupDomConverter; - -int DOMString::gLiveStringDataCount = 0; -int DOMString::gTotalStringDataCount = 0; -int DOMString::gLiveStringHandleCount = 0; -int DOMString::gTotalStringHandleCount = 0; - - -XMLLCPTranscoder* getDomConverter() -{ - if (!gDomConverter) - { - XMLLCPTranscoder* transcoder = XMLPlatformUtils::fgTransService->makeNewLCPTranscoder(); - if (!transcoder) - XMLPlatformUtils::panic(PanicHandler::Panic_NoDefTranscoder - ); - - if (XMLPlatformUtils::compareAndSwap((void **)&gDomConverter, transcoder, 0) != 0) - delete transcoder; - else - cleanupDomConverter.registerCleanup(reinitDomConverter); - } - return gDomConverter; -} - -// -// There is one global mutex that is used to synchronize access to the -// allocator free list for DOMStringHandles. This function gets that -// mutex, and will create it on the first attempt to get it. -// -static XMLMutex* DOMStringHandleMutex = 0; // Mutex will be deleted by ~DOMStringHandle. -static XMLRegisterCleanup cleanupDomMutex; - -XMLMutex& DOMStringHandle::getMutex() -{ - if (!DOMStringHandleMutex) - { - XMLMutex* tmpMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager); - if (XMLPlatformUtils::compareAndSwap((void**)&DOMStringHandleMutex, tmpMutex, 0)) - { - // Someone beat us to it, so let's clean up ours - delete tmpMutex; - } - else - cleanupDomMutex.registerCleanup(reinitDomMutex); - - } - - return *DOMStringHandleMutex; -} - - - -//---------------------------------------------- -// -// DOMStringData -// -//---------------------------------------------- - -void DOMStringData::removeRef() -{ - int result = XMLPlatformUtils::atomicDecrement(fRefCount); - if (result==0) - { - fBufferLength = 0xcccc; - fRefCount = 0xcccc; - XMLPlatformUtils::fgMemoryManager->deallocate(this);//delete [] this; // was allocated with new char[size] ! - XMLPlatformUtils::atomicDecrement(DOMString::gLiveStringDataCount); - } -} - - -void DOMStringData::addRef() -{ - XMLPlatformUtils::atomicIncrement(fRefCount); -} - - -DOMStringData *DOMStringData::allocateBuffer(unsigned int length) -{ - unsigned int sizeToAllocate = sizeof(DOMStringData) // buffer will contain an - + length*sizeof(XMLCh); // extra elem because of stub - // array in DOMStringData struct. - DOMStringData *buf = 0; - buf = (DOMStringData *) XMLPlatformUtils::fgMemoryManager->allocate - ( - sizeToAllocate * sizeof(char) - );//new char[sizeToAllocate]; - XMLPlatformUtils::atomicIncrement(DOMString::gLiveStringDataCount); - XMLPlatformUtils::atomicIncrement(DOMString::gTotalStringDataCount); - buf->fBufferLength = length; - buf->fRefCount = 1; - buf->fData[0] = 0; - return buf; -} - - - - -//---------------------------------------------------- -// -// DOMStringHandle -// -//----------------------------------------------------- - - - -// -// Specialized new and delete operators for DOMStringHandles. -// These are used, rather than the standard system operator new, -// for improved performance. -// -// We allocate largish blocks of memory using the standard system -// new function, and sub-allocate string handles from that block. -// Un-allocated string handles within the allocated blocks are kept -// in a singly linked list, making allocation and deallocation -// very quick in the common case. -// -// String handle allocation is thread safe. A multi-threaded -// application may have threads concurrently accessing multiple -// DOM documents; since all string handles come from the same pool, -// this allocator must be safe. The compare and exchange function, -// which is available as a single instruction in most processor -// architectures, and typically surfaced as an OS function, -// is used to safely update the string handle free list. -// -void *DOMStringHandle::freeListPtr = 0; // Point to the head of the - // free list of un-allocated - // string handles, or 0 if there - // are no free string handles. - -static const int allocGroupSize = 1024; // Number of string handles to allocate - // as a chunk from the system's - // memory allocator. - -DOMStringHandle *DOMStringHandle::blockListPtr = 0; // Point to the head of the list - // of larger blocks in which DOMStringHandles - // are allocated. - -// -// Operator new for DOMStringHandles. Called implicitly from the -// DOMStringHandle constructor. -// -void *DOMStringHandle::operator new(size_t sizeToAlloc) -{ - assert(sizeToAlloc == sizeof(DOMStringHandle)); - void *retPtr; - XMLMutexLock lock(&getMutex()); // Lock the DOMStringHandle mutex for - // the duration of this function. - - if (freeListPtr == 0) - { - // Uncommon case. The free list of string handles is empty - // Allocate a new batch of them, using the system's - // operator new to get a chunk of memory. - // - DOMStringHandle *dsg = (DOMStringHandle*) - XMLPlatformUtils::fgMemoryManager->allocate - ( - allocGroupSize * sizeof(DOMStringHandle) - );//::new DOMStringHandle[allocGroupSize]; - - // Link the block itself into the list of blocks. The purpose of this is to - // let us locate and delete the blocks when shutting down. - // - *(DOMStringHandle **)dsg = blockListPtr; - blockListPtr = dsg; - - - // Link all of the new storage for StringHandles into the StringHandle free list - int i; // Start with index 1; index 0 is reserved for linking the - // larger allocation blocks together. - for (i=1; i<allocGroupSize-1; i++) { - *(void **)&dsg[i] = freeListPtr; - freeListPtr = &dsg[i]; - } - } - - retPtr = freeListPtr; - freeListPtr = *(void **)freeListPtr; - - XMLPlatformUtils::atomicIncrement(DOMString::gLiveStringHandleCount); - return retPtr; -} - - -// -// Operator delete for DOMStringHandles. Called implicitly from the -// Destructor for DOMStringHandle. -// -void DOMStringHandle::operator delete(void *pMem) -{ - XMLMutexLock lock(&getMutex()); // Lock the DOMStringHandle mutex for the - // duration of this function. - XMLPlatformUtils::atomicDecrement(DOMString::gLiveStringHandleCount); - *(void **)pMem = freeListPtr; - freeListPtr = pMem; - - // If ALL of the string handles are gone, delete the storage blocks used for the - // handles as well. - if (DOMString::gLiveStringHandleCount == 0) - { - DOMStringHandle *pThisBlock, *pNextBlock; - for (pThisBlock = blockListPtr; pThisBlock != 0; pThisBlock = pNextBlock) - { - pNextBlock = *(DOMStringHandle **)pThisBlock; - XMLPlatformUtils::fgMemoryManager->deallocate(pThisBlock);//delete [] pThisBlock; - } - blockListPtr = 0; - freeListPtr = 0; - } - - -} - - -void DOMStringHandle::addRef() -{ - XMLPlatformUtils::atomicIncrement(fRefCount); -} - - -void DOMStringHandle::removeRef() -{ - int result = XMLPlatformUtils::atomicDecrement(fRefCount); - if (result==0) - { - fDSData->removeRef(); -// delete this; - DOMStringHandle* ptr = this; - delete ptr; - } -} - - -DOMStringHandle *DOMStringHandle::createNewStringHandle(unsigned int bufLength) -{ - DOMStringHandle *h = new DOMStringHandle; - XMLPlatformUtils::atomicIncrement(DOMString::gTotalStringHandleCount); - h -> fLength = 0; - h -> fRefCount = 1; - h -> fDSData = DOMStringData::allocateBuffer(bufLength); - return h; -} - - -DOMStringHandle *DOMStringHandle::cloneStringHandle() -{ - DOMStringHandle *h = new DOMStringHandle; - h->fLength = fLength; - h->fRefCount = 1; - h->fDSData = fDSData; - h->fDSData->addRef(); - return h; -} - -//------------------------------------------------------------ -// -// DOMString -// -//------------------------------------------------------------ - - -DOMString::DOMString() -{ - fHandle = 0; -} - - -DOMString::DOMString(const DOMString &other) : - XMemory(other) -{ - fHandle = other.fHandle; - if (fHandle) - fHandle->addRef(); -} - - -DOMString::DOMString(const XMLCh *data) -{ - fHandle = 0; - if (data != 0) - { - unsigned int dataLength = 0; - while (data[dataLength] != 0) - ++dataLength; - - if (dataLength != 0) - { - fHandle = DOMStringHandle::createNewStringHandle(dataLength+1); - fHandle->fLength = dataLength; - XMLCh *strData = fHandle->fDSData->fData; - unsigned int i; - for (i=0; i<dataLength ; ++i) - strData[i] = data[i]; - - strData[dataLength] = 0; - } - } -} - - - -DOMString::DOMString(const XMLCh *data, unsigned int dataLength) -{ - fHandle = 0; - if (data != 0) - { - if (dataLength > 0) - { - fHandle = DOMStringHandle::createNewStringHandle(dataLength+1); - fHandle->fLength = dataLength; - XMLCh *strData = fHandle->fDSData->fData; - unsigned int i; - for (i=0; i<dataLength ; ++i) - strData[i] = data[i]; - - strData[dataLength] = 0; - } - } -} - - - - -// -// Create a DOMString from a char * string in the default code page -// of the system on which we are executing. -// -// -DOMString::DOMString(const char *srcString) -{ - fHandle = 0; - if (srcString != 0) - { - XMLLCPTranscoder* uniConverter = getDomConverter(); - - unsigned int srcLen = strlen(srcString); - if (srcLen == 0) - return; - - // The charsNeeded normally is same as srcLen. To enhance performance, - // we start with this estimate, and if overflow, then call calcRequiredSize for actual size - fHandle = DOMStringHandle::createNewStringHandle(srcLen + 1); - XMLCh *strData = fHandle->fDSData->fData; - - if (!uniConverter->transcode(srcString, strData, srcLen) || (XMLString::stringLen(strData) != srcLen)) - { - // conversion failed, so try again - if (fHandle) - fHandle->removeRef(); - - fHandle = 0; - - srcLen = uniConverter->calcRequiredSize(srcString); - - fHandle = DOMStringHandle::createNewStringHandle(srcLen + 1); - XMLCh *strData2 = fHandle->fDSData->fData; - - if (!uniConverter->transcode(srcString, strData2, srcLen)) - { - // <TBD> We should throw something here? - } - } - fHandle->fLength = srcLen; - } -} - - - -DOMString::DOMString(int nullValue) -{ - assert(nullValue == 0); - fHandle = 0; -} - - -DOMString::~DOMString() -{ - if (fHandle) - fHandle->removeRef(); - - fHandle = 0; -} - - -DOMString & DOMString::operator =(const DOMString &other) -{ - if (this == &other) - return *this; - - if (fHandle) - fHandle->removeRef(); - - fHandle = other.fHandle; - - if (fHandle) - fHandle->addRef(); - - return *this; -} - - -DOMString & DOMString::operator = (DOM_NullPtr *arg) -{ - assert(arg == 0); - if (fHandle) - fHandle->removeRef(); - - fHandle = 0; - return *this; -} - - - -bool DOMString::operator ==(const DOMString &other) const -{ - return this->fHandle == other.fHandle; -} - - -bool DOMString::operator !=(const DOMString &other) const -{ - return this->fHandle != other.fHandle; -} - - -bool DOMString::operator == (const DOM_NullPtr * /*p*/) const -{ - return (fHandle == 0); -} - -bool DOMString::operator != (const DOM_NullPtr * /*p*/) const -{ - return (fHandle != 0); -} - - - -void DOMString::reserve(unsigned int size) -{ - if (fHandle == 0) - { - if (size > 0) - fHandle = DOMStringHandle::createNewStringHandle(size); - } -} - - - -void DOMString::appendData(const DOMString &other) -{ - if (other.fHandle == 0 || other.fHandle->fLength == 0) - return; - - // If this string is empty and this string does not have an - // already allocated buffer sufficient to hold the string being - // appended, return a clone of the other string. - // - if (fHandle == 0 || (fHandle->fLength == 0 && - fHandle->fDSData->fBufferLength < other.fHandle->fLength)) - { - if (fHandle) fHandle->removeRef(); - this->fHandle = other.fHandle->cloneStringHandle(); - return; - } - - unsigned int newLength = fHandle->fLength + other.fHandle->fLength; - if (newLength >= fHandle->fDSData->fBufferLength || - fHandle->fDSData->fRefCount > 1) - { - // We can't stick the data to be added onto the end of the - // existing string, either because there is not space in - // the buffer, or because the buffer is being shared with - // some other string. So, make a new buffer. - DOMStringData *newBuf = DOMStringData::allocateBuffer(newLength+1); - XMLCh *newP = newBuf->fData; - XMLCh *oldP = fHandle->fDSData->fData; - unsigned int i; - for (i=0; i<fHandle->fLength; ++i) - newP[i] = oldP[i]; - - fHandle->fDSData->removeRef(); - fHandle->fDSData = newBuf; - } - - // - // This string now had enough buffer room to hold the data to - // be appended. Go ahead and copy it in. - XMLCh *srcP = other.fHandle->fDSData->fData; - XMLCh *destP = &fHandle->fDSData->fData[fHandle->fLength]; - unsigned int i; - for (i=0; i<other.fHandle->fLength; i++) - destP[i] = srcP[i]; - - fHandle->fLength += other.fHandle->fLength; -} - - - -void DOMString::appendData(XMLCh ch) -{ - unsigned int newLength = 0; - - if (fHandle == 0) - { - fHandle = DOMStringHandle::createNewStringHandle(2); - newLength = 1; - } - else - newLength = fHandle->fLength + 1; - - if (newLength >= fHandle->fDSData->fBufferLength || - fHandle->fDSData->fRefCount > 1) - { - // We can't stick the data to be added onto the end of the - // existing string, either because there is not space in - // the buffer, or because the buffer is being shared with - // some other string. So, make a new buffer. - DOMStringData *newBuf = DOMStringData::allocateBuffer(newLength+1); - XMLCh *newP = newBuf->fData; - XMLCh *oldP = fHandle->fDSData->fData; - unsigned int i; - for (i=0; i<fHandle->fLength; ++i) - newP[i] = oldP[i]; - - fHandle->fDSData->removeRef(); - fHandle->fDSData = newBuf; - } - - XMLCh *destP = &fHandle->fDSData->fData[fHandle->fLength]; - destP[0] = ch; - - fHandle->fLength ++; -} - -// TODO: A custom version could be written more efficiently, avoiding -// the creation of the temporary DOMString -void DOMString::appendData(const XMLCh* other) -{ - appendData(DOMString(other)); -} - - -DOMString& DOMString::operator +=(const DOMString &other) -{ - appendData(other); - - return *this; -} - -DOMString& DOMString::operator +=(const XMLCh *str) -{ - appendData(str); - - return *this; -} - -DOMString& DOMString::operator +=(XMLCh ch) -{ - appendData(ch); - - return *this; -} - - - -XMLCh DOMString::charAt(unsigned int index) const -{ - XMLCh retCh = 0; - if ((fHandle != 0) && (index < fHandle->fLength)) - retCh = fHandle->fDSData->fData[index]; - return retCh; -} - - -DOMString DOMString::clone() const -{ - DOMString retString; - - if (fHandle != 0) - retString.fHandle = this->fHandle->cloneStringHandle(); - - return retString; -} - - - -void DOMString::deleteData(unsigned int offset, unsigned int delLength) -{ - unsigned int stringLen = this->length(); - if (offset > stringLen) - throw DOM_DOMException(DOM_DOMException::INDEX_SIZE_ERR, 0); - - // Cap the value of delLength to avoid trouble with overflows - // in the following length computations. - if (delLength > stringLen) - delLength = stringLen; - - // If the length of data to be deleted would extend off the end - // of the string, cut it back to stop at the end of string. - if (offset + delLength >= stringLen) - delLength = stringLen - offset; - - if (delLength == 0) - return; - - - unsigned int newStringLength = stringLen - delLength; - if (fHandle->fDSData->fRefCount > 1 && offset+delLength < stringLen) - { - // The deletion is of a range in the middle of the string - // and there's another string handle using the buffer so - // we need to make a new buffer before moving characters - // around. - DOMStringData *newBuf = DOMStringData::allocateBuffer(newStringLength+1); - XMLCh *newP = newBuf->fData; - XMLCh *oldP = fHandle->fDSData->fData; - unsigned int i; - for (i=0; i<offset; i++) - newP[i] = oldP[i]; - - for (i=offset; i<newStringLength; i++) - newP[i] = oldP[i+delLength]; - - fHandle->fLength = newStringLength; - fHandle->fDSData->removeRef(); - fHandle->fDSData = newBuf; - } - else if (offset+delLength < stringLen) - { - // The deletion is of a range in the middle of the string, - // but no other string is sharing the buffer, so we can - // just delete in place. - unsigned int i; - XMLCh *bufP = fHandle->fDSData->fData; - for (i=offset; i<newStringLength; i++) - bufP[i] = bufP[i+delLength]; - - fHandle->fLength = newStringLength; - } - else - { - // The deletion continues to the end of the string. - // Simply reset the length. We don't need to worry - // about other strings sharing the buffer because - // no characters are moved. - fHandle->fLength = newStringLength; - } -} - - - -bool DOMString::equals(const DOMString &other) const -{ - bool retVal = true; - if (this->fHandle != 0 && other.fHandle != 0) - { - if (this->fHandle->fLength != other.fHandle->fLength) - { - retVal = false; - } - else - { - XMLCh *thisP = this->fHandle->fDSData->fData; - XMLCh *otherP = other.fHandle->fDSData->fData; - unsigned int i; - for (i=0; i<this->fHandle->fLength; i++) - { - if (thisP[i] != otherP[i]) - { - retVal = false; - break; - } - } - } - } - else - { - // At this point, one or more of the fHandle - // pointers is known to be zero. - if (fHandle && fHandle->fLength != 0 || - other.fHandle && other.fHandle->fLength != 0) - retVal = false; - - } - return retVal; -} - - - -bool DOMString::equals(const XMLCh *other) const -{ - if (this->fHandle != 0 && other != 0) - { - // Both strings have non-null data pointers, so - // we can go ahead and actually compare them. - XMLCh *thisP = this->fHandle->fDSData->fData; - unsigned int len = this->fHandle->fLength; - - unsigned int i; - for (i=0; i<len; i++) - { - if (other[i] == 0) // "other" is null terminated. - return false; // (If there were no chance of a DOM - // string having a 0 char in the middle of - // it, this test could be omitted.) - - if (thisP[i] != other[i]) - return false; - } - - if (other[len] != 0) // This test for the end of the other - return false; // string can't be done without first - // checking that we haven't walked off the - // end. (It has actually happened - off end - // of string, page, and valid memory.) - - return true; - } - - - // At this point, we know that at least one of the strings had a null - // data pointer. - if (fHandle && fHandle->fLength != 0) - return false; - - if (other && *other != 0) - return false; - - return true; // Both strings are empty. DOMString treats zero-length - // and a null data pointer as equivalent. -} - - -void DOMString::insertData(unsigned int offset, const DOMString &src) -{ - unsigned int origStrLength = this->length(); - if (offset > origStrLength) - throw DOM_DOMException(DOM_DOMException::INDEX_SIZE_ERR, 0); - - if (fHandle == 0) - { - *this = src.clone(); - return; - } - - if (src.fHandle == 0 || src.fHandle->fLength == 0) - return; - - XMLCh *srcP = src.fHandle->fDSData->fData; - unsigned int srcLength = src.fHandle->fLength; - unsigned int newLength = fHandle->fLength + srcLength; - if (newLength >= fHandle->fDSData->fBufferLength || - fHandle->fDSData->fRefCount > 1 || fHandle == src.fHandle ) - { - // We can't stick the data to be added into the - // existing string, either because there is not space in - // the buffer, or because the buffer is being shared with - // some other string. - // So, make a new buffer. - - DOMStringData *newBuf = DOMStringData::allocateBuffer(newLength+1); - XMLCh *newP = newBuf->fData; - XMLCh *oldP = fHandle->fDSData->fData; - unsigned int i; - for (i=0; i<offset; ++i) - newP[i] = oldP[i]; - - for (i=0; i<srcLength; i++) - newP[i+offset] = srcP[i]; - - for (i=offset; i<origStrLength; i++) - newP[i+srcLength] = oldP[i]; - - fHandle->fDSData->removeRef(); - fHandle->fDSData = newBuf; - } - else - { - // There is room in the already-existing buffer to hold - // the data to be inserted. Insert it. - // - XMLCh *destP = fHandle->fDSData->fData; - int i; - for (i=(int)origStrLength-1; i>=(int)offset; i--) - destP[i+srcLength] = destP[i]; - - unsigned int j; - for (j=0; j<srcLength; j++) - destP[j+offset] = srcP[j]; - } - - fHandle->fLength += srcLength; -} - - - -unsigned int DOMString::length() const -{ - unsigned int len = 0; - if (fHandle != 0) - len = fHandle->fLength; - - return len; -} - - - -void DOMString::print() const -{ - unsigned int len = this->length(); - - if (len > 0) - { - // Transcode from Unicode to char * in whatever the system local code page is. - char *pc = transcode(XMLPlatformUtils::fgMemoryManager); - fputs(pc, stdout); - - XMLPlatformUtils::fgMemoryManager->deallocate(pc);//delete [] pc; - } -} - - -void DOMString::println() const -{ - print(); - putchar('\n'); -} - - - -const XMLCh *DOMString::rawBuffer() const -{ - XMLCh *retP = 0; - if (fHandle) - { - retP = fHandle->fDSData->fData; - retP[fHandle->fLength]=0; - } - return retP; -} - - -char *DOMString::transcode() const -{ - if (!fHandle || fHandle->fLength == 0) - { - char* retP = new char[1]; - *retP = 0; - return retP; - } - - // We've got some data - const XMLCh* srcP = rawBuffer(); - - // - // Find out how many output chars we need and allocate a buffer big enough - // for that plus a null. - // - // The charsNeeded normally is same as fHandle->fLength. To enhance performance, - // we start with this estimate, and if overflow, then call calcRequiredSize for actual size - unsigned int charsNeeded = fHandle->fLength; - char* retP = new char[charsNeeded + 1]; - - if (!getDomConverter()->transcode(srcP, retP, charsNeeded) || (XMLString::stringLen(retP) != charsNeeded)) - { - delete [] retP; - charsNeeded = getDomConverter()->calcRequiredSize(srcP); - retP = new char[charsNeeded + 1]; - if (!getDomConverter()->transcode(srcP, retP, charsNeeded)) - { - // <TBD> We should throw something here? - } - } - - // Cap it off and return it - retP[charsNeeded] = 0; - return retP; -} - -char *DOMString::transcode(MemoryManager* const manager) const -{ - if (!fHandle || fHandle->fLength == 0) - { - char* retP = (char*) manager->allocate(sizeof(char));//new char[1]; - *retP = 0; - return retP; - } - - // We've got some data - const XMLCh* srcP = rawBuffer(); - - // - // Find out how many output chars we need and allocate a buffer big enough - // for that plus a null. - // - // The charsNeeded normally is same as fHandle->fLength. To enhance performance, - // we start with this estimate, and if overflow, then call calcRequiredSize for actual size - unsigned int charsNeeded = fHandle->fLength; - char* retP = (char*) manager->allocate((charsNeeded + 1) * sizeof(char));//new char[charsNeeded + 1]; - - if (!getDomConverter()->transcode(srcP, retP, charsNeeded) || (XMLString::stringLen(retP) != charsNeeded)) - { - manager->deallocate(retP);//delete [] retP; - charsNeeded = getDomConverter()->calcRequiredSize(srcP); - retP = (char*) manager->allocate((charsNeeded + 1) * sizeof(char));//new char[charsNeeded + 1]; - if (!getDomConverter()->transcode(srcP, retP, charsNeeded)) - { - // <TBD> We should throw something here? - } - } - - // Cap it off and return it - retP[charsNeeded] = 0; - return retP; -} - - -DOMString DOMString::transcode(const char* str) -{ - return DOMString(str); -} - -bool DOMString::operator < (const DOMString &other) const -{ - return (compareString(other) < 0); -} - -int DOMString::compareString(const DOMString &other) const -{ - // Note: this strcmp does not match the semantics - // of the standard C strcmp. All it needs to do is - // define some less than - equals - greater than ordering - // of strings. How doesn't matter. - // - unsigned int thisLen = length(); - unsigned int otherLen = other.length(); - - if (thisLen < otherLen) - return -1; - - if (thisLen > otherLen) - return 1; - - if (thisLen == 0) - return 0; - - XMLCh *thisP = this->fHandle->fDSData->fData; - XMLCh *otherP = other.fHandle->fDSData->fData; - unsigned int i; - for (i=0; i<thisLen; i++) - { - if (thisP[i] < otherP[i]) - return -1; - else if (thisP[i] > otherP[i]) - return 1; - } - - return 0; -} - - -DOMString DOMString::substringData(unsigned int offset, unsigned int count) const -{ - unsigned int thisLen = length(); - if (offset > thisLen) - throw DOM_DOMException(DOM_DOMException::INDEX_SIZE_ERR, 0); - - // Cap count to the string length to eliminate overflow - // problems when we get passed bogus values, like -1. - if (count > thisLen) - count = thisLen; - - // If the count extends past the end of the string, cut it - // back so that the returned string will stop at the end - // of the source string. - if (offset + count >= thisLen) - count = thisLen - offset; - - if (count == 0) - return DOMString(); - - // If the substring starts at the beginning of the original string - // we do not need to copy the data, but can set up a new - // string handle with the shorter length. - if (offset == 0) - { - DOMString retString = this->clone(); - retString.fHandle->fLength = count; - return retString; - } - - // The substring starts somewhere in the interior of the orignal string. - // Create a completely new DOMString. No buffer sharing is possible. - XMLCh *data = fHandle->fDSData->fData; - return DOMString(data+offset, count); - -} - - -DOMString operator + (const DOMString &lhs, const DOMString &rhs) -{ - DOMString retString = lhs.clone(); - retString.appendData(rhs); - return retString; -} - -DOMString operator + (const DOMString &lhs, const XMLCh* rhs) -{ - DOMString retString = lhs.clone(); - retString.appendData(rhs); - return retString; -} - -DOMString operator + (const XMLCh* lhs, const DOMString& rhs) -{ - DOMString retString = DOMString(lhs); - retString.appendData(rhs); - return retString; -} - - -DOMString operator + (const DOMString &lhs, XMLCh rhs) -{ - DOMString retString = lhs.clone(); - retString.appendData(rhs); - return retString; -} - -DOMString operator + (XMLCh lhs, const DOMString& rhs) - -{ - DOMString retString; - retString.appendData(lhs); - retString.appendData(rhs); - return retString; -} - - -// ----------------------------------------------------------------------- -// Notification that lazy data has been deleted -// ----------------------------------------------------------------------- -static void reinitDomConverter() -{ - delete gDomConverter; // Delete the local code page converter. - gDomConverter = 0; -} - - -static void reinitDomMutex() -{ - delete DOMStringHandleMutex; // Delete the synchronization mutex, - DOMStringHandleMutex = 0; -} - - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOMString.hpp b/src/xercesc/dom/deprecated/DOMString.hpp deleted file mode 100644 index ee4d4c0450b76ee9d4987471446437d95e664f83..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOMString.hpp +++ /dev/null @@ -1,472 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOMString_HEADER_GUARD_ -#define DOMString_HEADER_GUARD_ - -#include <xercesc/util/XMemory.hpp> - -#ifdef XML_DEBUG -#include "DOMStringImpl.hpp" -XERCES_CPP_NAMESPACE_BEGIN -#else -XERCES_CPP_NAMESPACE_BEGIN -class DOMStringHandle; -#endif - -class DOM_NullPtr; - -/** - * <code>DOMString</code> is the generic string class that stores all strings - * used in the DOM C++ API. - * - * Though this class supports most of the common string operations to manipulate - * strings, it is not meant to be a comphrehensive string class. - */ - -class DEPRECATED_DOM_EXPORT DOMString : public XMemory{ -public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor for DOMString. The resulting DOMString - * object refers to no string at all; it will compare == 0. - * - */ - DOMString(); - - /** - * Copy constructor. - * - * @param other The object to be copied. - */ - DOMString(const DOMString &other); - - /** - * Constructor to build a DOMString from an XML character array. - * (XMLCh is a 16 bit UNICODE character). - * - * @param other The null-terminated character array to be - * that provides the initial value for the DOMString. - */ - DOMString(const XMLCh *other); - - /** - * Constructor to build a DOMString from a character array of given length. - * - * @param other The character array to be imported into the <code>DOMString</code> - * @param length The length of the character array to be imported - */ - DOMString(const XMLCh *other, unsigned int length); - - /** - * Constructor to build a DOMString from an 8 bit character array. - * The char * string will be transcoded to UNICODE using the default - * code page on the system where the code is running. - * - * @param other The character array to be imported into the <code>DOMString</code> - */ - DOMString(const char *other); - - /** - * Construct a null DOMString. - */ - DOMString(int nullPointerValue); - - /** - * Assignment operator. Make destination DOMString refer to the same - * underlying string in memory as the source string. - * - * @param other the source DOMString. - */ - DOMString & operator = (const DOMString &other); - - - - DOMString & operator = (DOM_NullPtr *other); - - //@} - /** @name Destructor. */ - //@{ - - /** - * Destructor for DOMString - * - */ - ~DOMString(); - - //@} - /** @name Operators for string manipulation. */ - //@{ - - /** - * Concatenate a DOMString to another. - * - * @param other The string to be concatenated. - * @return The concatenated object - */ - // DOMString operator + (const DOMString &other); - - //@} - /** @name Equality and Inequality operators. */ - //@{ - - /** - * Equality operator. - * - * @param other The object to be compared with. - * @return True if the two DOMStrings refer to the same underlying string - * in memory. - * <p> - * WARNING: operator == does NOT compare the contents of - * the two strings. To do this, use the <code>DOMString::equals()</code> - * This behavior is modelled after the String operations in Java, and - * is also similar to operator == on the other DOM_* classes. - */ - bool operator == (const DOMString &other) const; - - /** - * Inequality operator. - * - * @param other The object to be compared with. - * @return True if the two DOMStrings refer to different underlying strings in - * memory. - * <p> - * WARNING: operator == does NOT compare the contents of - * the two strings. To do this, use the <code>DOMString::equals()</code> - * This behavior is modelled after the String operations in Java, and - * is also similar to operator == on the other DOM_* classes. - */ - bool operator != (const DOMString &other) const; - - /** - * Equality operator. Test for a null DOMString, which is one that does - * not refer to any string at all; similar to a null object reference - * variable in Java. - * - * @param other must be 0 or null. - * @return - */ - bool operator == (const DOM_NullPtr *other) const; - - /** - * Inequality operator, for null test. - * - * @param other must be 0 or null. - * @return True if the two strings are different, false otherwise - */ - bool operator != (const DOM_NullPtr *other) const; - - //@} - /** @name Functions to change the string. */ - //@{ - - - /** - * Preallocate storage in the string to hold a given number of characters. - * A DOMString will grow its buffer on demand, as characters are added, - * but it can be more efficient to allocate once in advance, if the size is known. - * - * @param size The number of 16 bit characters to reserve. - */ - void reserve(unsigned int size); - - - /** - * Appends the content of another <code>DOMString</code> to this string. - * - * @param other The object to be appended - */ - void appendData(const DOMString &other); - - /** - * Append a single Unicode character to this string. - * - * @param ch The single character to be appended - */ - void appendData(XMLCh ch); - - /** - * Append a null-terminated XMLCh * (Unicode) string to this string. - * - * @param other The object to be appended - */ - void appendData(const XMLCh *other); - - - /** - * Appends the content of another <code>DOMString</code> to this string. - * - * @param other The object to be appended - */ - DOMString& operator +=(const DOMString &other); - - - /** - * Appends the content of a c-style string to this string. - * - * @param other The string to be appended - */ - DOMString& operator +=(const XMLCh* other); - - - /** - * Appends a character to this string. - * - * @param ch The character to be appended - */ - DOMString& operator +=(XMLCh ch); - - - /** - * Clears the data of this <code>DOMString</code>. - * - * @param offset The position from the beginning from which the data must be deleted - * @param count The count of characters from the offset that must be deleted - */ - void deleteData(unsigned int offset, unsigned int count); - - /** - * Inserts a string within the existing <code>DOMString</code> at an arbitrary position. - * - * @param offset The offset from the beginning at which the insertion needs to be done - * in <code>this</code> object - * @param data The <code>DOMString</code> containing the data that needs to be inserted - * @return The object to be returned. - */ - void insertData(unsigned int offset, const DOMString &data); - - //@} - /** @name Functions to get properties of the string. */ - //@{ - - /** - * Returns the character at the specified position. - * - * @param index The position at which the character is being requested - * @return Returns the character at the specified position. - */ - XMLCh charAt(unsigned int index) const; - - /** - * Returns a handle to the raw buffer in the <code>DOMString</code>. - * - * @return The pointer inside the <code>DOMString</code> containg the string data. - * Note: the data is not always null terminated. Do not rely on - * a null being there, and do not add one, as several DOMStrings - * with different lengths may share the same raw buffer. - */ - const XMLCh *rawBuffer() const; - - /** - * Returns a copy of the string, transcoded to the local code page. The - * caller owns the (char *) string that is returned, and is responsible - * for deleting it. - * - * Note: The buffer returned is allocated using the global operator new - * and users need to make sure to use the corresponding delete []. - * This method will be deprecated in later versions, as we move - * towards using a memory manager for allocation and deallocation. - * - * @return A pointer to a newly allocated buffer of char elements, which - * represents the original string, but in the local encoding. - */ - char *transcode() const; - - /** - * Returns a copy of the string, transcoded to the local code page. The - * caller owns the (char *) string that is returned, and is responsible - * for deleting it. - * - * @param manager the memory manager to use for allocating returned - * returned buffer. - * - * @return A pointer to a newly allocated buffer of char elements, which - * represents the original string, but in the local encoding. - */ - char *transcode(MemoryManager* const manager) const; - - - /** - * Creates a DOMString, transcoded from an input 8 bit char * string - * in the local code page. - * - * @param str The string to be transcoded - * @return A new DOMString object - */ - static DOMString transcode(const char* str); - - - - /** - * Returns a sub-string of the <code>DOMString</code> starting at a specified position. - * - * @param offset The offset from the beginning from which the sub-string is being requested. - * @param count The count of characters in the requested sub-string - * @return The sub-string of the <code>DOMString</code> being requested - */ - DOMString substringData(unsigned int offset, unsigned int count) const; - - /** - * Returns the length of the DOMString. - * - * @return The length of the string - */ - unsigned int length() const; - - //@} - /** @name Cloning function. */ - //@{ - - /** - * Makes a clone of a the DOMString. - * - * @return The object to be cloned. - */ - DOMString clone() const; - - //@} - /** @name Print functions. */ - //@{ - - /** - * Dumps the <code>DOMString</code> on the console. - * - */ - void print() const; - - /** - * Dumps the <code>DOMString</code> on the console with a line feed at the end. - * - */ - void println() const; - - //@} - /** @name Functions to compare a string with another. */ - //@{ - - /** - * Compares a DOMString with another. - * - * This compareString does not match the semantics of the standard C strcmp. - * All it needs to do is define some less than - equals - greater than - * ordering of strings. How doesn't matter. - * - * - * @param other The object to be compared with - * @return Either -1, 0, or 1 based on the comparison. - */ - int compareString(const DOMString &other) const; - - /** - * Less than operator. It is a helper operator for compareString. - * - * @param other The object to be compared with. - * @return True if this DOMString is lexically less than the other DOMString. - */ - bool operator < (const DOMString &other) const; - - /** - * Tells if a <code>DOMString</code> contains the same character data - * as another. - * - * @param other The DOMString to be compared with. - * @return True if the two <code>DOMString</code>s are same, false otherwise. - */ - bool equals(const DOMString &other) const; - - - /** - * Compare a DOMString with a null-terminated raw 16-bit character - * string. - * - * @param other The character string to be compared with. - * @return True if the strings are the same, false otherwise. - */ - bool equals(const XMLCh *other) const; - - - //@} - friend class DOMStringData; - friend class DOMStringHandle; - friend class DomMemDebug; -private: - - DOMStringHandle *fHandle; - static int gLiveStringHandleCount; - static int gTotalStringHandleCount; - static int gLiveStringDataCount; - static int gTotalStringDataCount; -}; - - -/****** Global Helper Functions ******/ - -/** - * Concatenate two DOMString's. - * - * @param lhs the first string - * @param rhs the second string - * @return The concatenated object - */ -DOMString DEPRECATED_DOM_EXPORT operator + (const DOMString &lhs, const DOMString &rhs); - -/** - * Concatenate a null terminated Unicode string to a DOMString. - * - * @param lhs the DOMString - * @param rhs the XMLCh * string - * @return The concatenated object - */ -DOMString DEPRECATED_DOM_EXPORT operator + (const DOMString &lhs, const XMLCh* rhs); - - -/** - * Concatenate a DOMString to a null terminated Unicode string - * - * @param lhs the null-terminated Unicode string - * @param rhs the DOMString - * @return The concatenated object - */ -DOMString DEPRECATED_DOM_EXPORT operator + (const XMLCh* lhs, const DOMString &rhs); - - -/** - * Concatenate a single Unicode character to a DOMString. - * - * @param lhs the DOMString - * @param rhs the character - * @return The concatenated object - */ -DOMString DEPRECATED_DOM_EXPORT operator + (const DOMString &lhs, XMLCh rhs); - - -/** - * Concatenate a DOMString to a single Unicode character. - * - * @param lhs the character - * @param rhs the DOMString - * @return The concatenated object - */ -DOMString DEPRECATED_DOM_EXPORT operator + (XMLCh lhs, const DOMString &rhs); - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/DOMStringImpl.hpp b/src/xercesc/dom/deprecated/DOMStringImpl.hpp deleted file mode 100644 index ac523b92fb61d16083ff0a2571b177443677c3aa..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOMStringImpl.hpp +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef DOMStringImpl_HEADER_GUARD_ -#define DOMStringImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - -#include <xercesc/util/XercesDefs.hpp> -#include <xercesc/util/Mutexes.hpp> -#include <stdio.h> - -XERCES_CPP_NAMESPACE_BEGIN - -class DOMStringData -{ -public: - unsigned int fBufferLength; - int fRefCount; - XMLCh fData[1]; - - static DOMStringData *allocateBuffer(unsigned int length); - inline void addRef(); - inline void removeRef(); -}; - -class DOMStringHandle -{ -public: - unsigned int fLength; // The logical length of the DOMString. - // This may be shorter than the buffer length. - int fRefCount; // The number of DOMString objects pointing to - // this string handle. - DOMStringData *fDSData; // Pointer to the string buffer. May be null. - - void *operator new( size_t sizeToAlloc); // StringHandles have custom, optimized - void operator delete( void *pvMem ); // memory allocation. - - -private: - static void *freeListPtr; // Head of the linked list of unallocated String Handles - - static DOMStringHandle *blockListPtr; // Head of the linked list of memory blocks from which - // string handles are sub-allocated. - -public: - static DOMStringHandle *createNewStringHandle(unsigned int bufLength); - DOMStringHandle *cloneStringHandle(); - inline void addRef(); - inline void removeRef(); - ~DOMStringHandle() {}; - static void DOMStringCleanup(); -private: - inline DOMStringHandle() {}; - static inline XMLMutex &getMutex(); -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/DOM_Attr.cpp b/src/xercesc/dom/deprecated/DOM_Attr.cpp deleted file mode 100644 index ed24d9b2ff8baf5b27cb5abda6e71be53411ef87..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Attr.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_Attr.hpp" -#include "AttrImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - - -DOM_Attr::DOM_Attr() -: DOM_Node(null) -{ -}; - - -DOM_Attr::DOM_Attr(const DOM_Attr & other) -: DOM_Node(other) -{ -}; - - -DOM_Attr::DOM_Attr(AttrImpl *impl) : - DOM_Node(impl) -{ -}; - - -DOM_Attr::~DOM_Attr() -{ -}; - - -DOM_Attr & DOM_Attr::operator = (const DOM_Attr & other) -{ - return (DOM_Attr &) DOM_Node::operator = (other); -}; - - -DOM_Attr & DOM_Attr::operator = (const DOM_NullPtr *other) -{ - return (DOM_Attr &) DOM_Node::operator = (other); -}; - - - -DOMString DOM_Attr::getName() const -{ - return ((AttrImpl *)fImpl)->getName().clone(); -}; - - -bool DOM_Attr::getSpecified() const -{ - return ((AttrImpl *)fImpl)->getSpecified(); -}; - - -DOMString DOM_Attr::getValue() const -{ - // The value of an attribute does not need to be cloned before - // returning, because it is computed dynamically from the - // children of the attribute. - // - return ((AttrImpl *)fImpl)->getValue(); -}; - - -void DOM_Attr::setValue(const DOMString &value) { - ((AttrImpl *)fImpl)->setValue(value); -}; - - -//Introduced in DOM Level 2 - -DOM_Element DOM_Attr::getOwnerElement() const -{ - return DOM_Element(((AttrImpl *)fImpl)->getOwnerElement()); -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_Attr.hpp b/src/xercesc/dom/deprecated/DOM_Attr.hpp deleted file mode 100644 index ea12bfcbe0fc4391cba9a2e96d879d28bfeb7588..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Attr.hpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_Attr_HEADER_GUARD_ -#define DOM_Attr_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_Node.hpp" -#include "DOM_Element.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class AttrImpl; - -/** -* The <code>DOM_Attr</code> class refers to an attribute of an XML element. -* -* Typically the allowable values for the -* attribute are defined in a documenttype definition. -* <p><code>DOM_Attr</code> objects inherit the <code>DOM_Node</code> interface, but -* since attributes are not actually child nodes of the elements they are associated with, the -* DOM does not consider them part of the document tree. Thus, the -* <code>DOM_Node</code> attributes <code>parentNode</code>, -* <code>previousSibling</code>, and <code>nextSibling</code> have a null -* value for <code>DOM_Attr</code> objects. The DOM takes the view that -* attributes are properties of elements rather than having a separate -* identity from the elements they are associated with; this should make it -* more efficient to implement such features as default attributes associated -* with all elements of a given type. Furthermore, attribute nodes -* may not be immediate children of a <code>DocumentFragment</code>. However, -* they can be associated with <code>Element</code> nodes contained within a -* <code>DocumentFragment</code>. In short, users of the DOM -* need to be aware that <code>Attr</code> nodes have some things in common -* with other objects inheriting the <code>Node</code> interface, but they -* also are quite distinct. -* -*/ -class DEPRECATED_DOM_EXPORT DOM_Attr: public DOM_Node { - -public: - /** @name Constructors and assignment operators */ - //@{ - /** - * Default constructor for DOM_Attr. The resulting object does not - * refer to any Attribute; it will compare == to 0, and is similar - * to a null object reference variable in Java. - * - */ - DOM_Attr(); - -public: - - /** - * Copy constructor. Creates a new <code>DOM_Attr</code> that refers to the - * same underlying Attribute as the original. See also DOM_Node::clone(), - * which will copy an actual attribute, rather than just creating a new - * reference to the original attribute. - * - * @param other The source attribute reference object - */ - DOM_Attr(const DOM_Attr &other); - - /** - * Assignment operator - * - * @param other The source attribute object - */ - DOM_Attr & operator = (const DOM_Attr &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_Attr & operator = (const DOM_NullPtr *val); - - - - //@} - /** @name Destructor */ - //@{ - - /** - * Destructor. The object being destroyed is a reference to the Attribute - * "node", not the underlying attribute itself. - * - */ - ~DOM_Attr(); - //@} - - /** @name Getter functions */ - //@{ - /** - * Returns the name of this attribute. - */ - DOMString getName() const; - - /** - * - * Returns true if the attribute received its value explicitly in the - * XML document, or if a value was assigned programatically with - * the setValue function. Returns false if the attribute value - * came from the default value declared in the document's DTD. - */ - bool getSpecified() const; - - /** - * Returns the value of the attribute. - * - * The value of the attribute is returned as a string. - * Character and general entity references are replaced with their values. - */ - DOMString getValue() const; - - //@} - /** @name Setter functions */ - //@{ - /** - * Sets the value of the attribute. A text node with the unparsed contents - * of the string will be created. - * - * @param value The value of the DOM attribute to be set - */ - void setValue(const DOMString &value); - //@} - - /** @name Functions introduced in DOM Level 2. */ - //@{ - /** - * The <code>DOM_Element</code> node this attribute is attached to or - * <code>null</code> if this attribute is not in use. - * - */ - DOM_Element getOwnerElement() const; - //@} - -protected: - DOM_Attr(AttrImpl *attr); - - friend class DOM_Element; - friend class DOM_Document; - -}; - -XERCES_CPP_NAMESPACE_END - -#endif - - diff --git a/src/xercesc/dom/deprecated/DOM_CDATASection.cpp b/src/xercesc/dom/deprecated/DOM_CDATASection.cpp deleted file mode 100644 index 043913193a93da31a63be15dbf98df1624f17cc8..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_CDATASection.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_CDATASection.hpp" -#include "DOM_Text.hpp" -#include "CDATASectionImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_CDATASection::DOM_CDATASection() -: DOM_Text(null) -{ -}; - - -DOM_CDATASection::DOM_CDATASection(const DOM_CDATASection & other) -: DOM_Text(other) -{ -}; - - -DOM_CDATASection::DOM_CDATASection(CDATASectionImpl *impl) : - DOM_Text(impl) -{ -}; - - -DOM_CDATASection::~DOM_CDATASection() -{ -}; - - -DOM_CDATASection & DOM_CDATASection::operator = (const DOM_CDATASection & other) -{ - return (DOM_CDATASection &) DOM_Text::operator = (other); -}; - - -DOM_CDATASection & DOM_CDATASection::operator = (const DOM_NullPtr *other) -{ - return (DOM_CDATASection &) DOM_Node::operator = (other); -}; - - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_CDATASection.hpp b/src/xercesc/dom/deprecated/DOM_CDATASection.hpp deleted file mode 100644 index 98617c9e9f0f64ef7399653699302280cfffc9a5..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_CDATASection.hpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_CDataSection_HEADER_GUARD_ -#define DOM_CDataSection_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_Text.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class CDATASectionImpl; - -/** - * <code>DOM_CDataSection</code> objects refer to the data from an - * XML CDATA section. These are used to escape blocks of text containing characters - * that would otherwise be regarded as markup. - * - * <p>Note that the string data associated with the CDATA section may - * contain characters that need to be escaped when appearing in an - * XML document outside of a CDATA section. - * <p> The <code>DOM_CDATASection</code> class inherits from the - * <code>DOM_CharacterData</code> class through the <code>Text</code> - * interface. Adjacent CDATASection nodes are not merged by use - * of the Element.normalize() method. - */ -class DEPRECATED_DOM_EXPORT DOM_CDATASection: public DOM_Text { -public: - /** @name Constructors and assignment operators */ - //@{ - /** - * Default constructor for DOM_CDATASection. The resulting object does not - * refer to any actual CData section; it will compare == to 0, and is similar - * to a null object reference variable in Java. - * - */ - DOM_CDATASection(); - /** - * Copy constructor. Creates a new <code>DOM_CDataSection</code> that refers to the - * same underlying data as the original. See also <code>DOM_Node::clone()</code>, - * which will copy the underlying data, rather than just creating a new - * reference to the original object. - * - * @param other The source <code>DOM_CDATASection</code> object - */ - DOM_CDATASection(const DOM_CDATASection &other); - - /** - * Assignment operator. - * - * @param other The object to be copied. - */ - DOM_CDATASection & operator = (const DOM_CDATASection &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_CDATASection & operator = (const DOM_NullPtr *val); - - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_CDATASection. - * - */ - - ~DOM_CDATASection(); - //@} - - -protected: - DOM_CDATASection(CDATASectionImpl *); - - friend class DOM_Document; - -}; - -XERCES_CPP_NAMESPACE_END - -#endif - - diff --git a/src/xercesc/dom/deprecated/DOM_CharacterData.cpp b/src/xercesc/dom/deprecated/DOM_CharacterData.cpp deleted file mode 100644 index 49053d6007922ab5ab7f2cfa49b716f5145c1c19..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_CharacterData.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_CharacterData.hpp" -#include "CharacterDataImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_CharacterData::DOM_CharacterData() -: DOM_Node(null) -{ -}; - -DOM_CharacterData::DOM_CharacterData(CharacterDataImpl *impl) : -DOM_Node(impl) -{ -}; - - -DOM_CharacterData::DOM_CharacterData(const DOM_CharacterData & other) : -DOM_Node(other) -{ -}; - - -DOM_CharacterData::~DOM_CharacterData() { -}; - -DOM_CharacterData & DOM_CharacterData::operator = (const DOM_CharacterData &other) -{ - return (DOM_CharacterData &) DOM_Node::operator = (other); -}; - -DOM_CharacterData & DOM_CharacterData::operator = (const DOM_NullPtr *other) -{ - return (DOM_CharacterData &) DOM_Node::operator = (other); -}; - - -DOMString DOM_CharacterData::getData() const -{ - return ((CharacterDataImpl *)fImpl)->getData().clone(); -}; - - -void DOM_CharacterData::setData(const DOMString &data){ - ((CharacterDataImpl *)fImpl)->setData(data); -}; - - - -unsigned int DOM_CharacterData::getLength() const -{ - return ((CharacterDataImpl *)fImpl)->getCharDataLength(); -}; - - - -DOMString DOM_CharacterData::substringData(unsigned int offset, unsigned int count) const -{ - return ((CharacterDataImpl *)fImpl)->substringData(offset, count); -}; - - - -void DOM_CharacterData::appendData(const DOMString &arg) -{ - ((CharacterDataImpl *)fImpl)->appendData(arg); -}; - - - -void DOM_CharacterData::insertData(unsigned int offset, const DOMString &arg){ - ((CharacterDataImpl *)fImpl)->insertData(offset, arg); -}; - - - - -void DOM_CharacterData::deleteData(unsigned int offset, unsigned int count) -{ - ((CharacterDataImpl *)fImpl)->deleteData(offset, count); -}; - - -void DOM_CharacterData::replaceData(unsigned int offset, unsigned int count, const DOMString &arg) -{ - ((CharacterDataImpl *)fImpl)->replaceData(offset, count, arg); -}; - - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_CharacterData.hpp b/src/xercesc/dom/deprecated/DOM_CharacterData.hpp deleted file mode 100644 index a073a05b89e47fb1d995d88ee20d730f7d9a6bf0..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_CharacterData.hpp +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_CharacterData_HEADER_GUARD_ -#define DOM_CharacterData_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class CharacterDataImpl; - -/** - * The <code>DOM_CharacterData</code> interface extends Node with a set of - * methods for accessing character data in the DOM. - * - * For clarity this set is defined here rather than on each class that uses - * these methods. No DOM objects correspond directly to - * <code>CharacterData</code>, though <code>Text</code> and others do inherit - * the interface from it. All <code>offset</code>s in this interface start - * from 0, and index in terms of Unicode 16 bit storage units. - */ -class DEPRECATED_DOM_EXPORT DOM_CharacterData: public DOM_Node { - -private: - -public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor for DOM_CharacterData. While there can be - * no actual DOM nodes of type CharacterData, the C++ objects - * function more like reference variables, and instances of - * <code>DOM_CharacterData</code> can exist. They will be null when created - * by this constructor, and can then be assigned to refer to Text - * or CDATASection nodes. - */ - DOM_CharacterData(); - - /** - * Copy constructor - * - * @param other The object to be copied - */ - DOM_CharacterData(const DOM_CharacterData &other); - /** - * Assignment operator - * - * @param other The object to be copied - */ - DOM_CharacterData & operator = (const DOM_CharacterData &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_CharacterData & operator = (const DOM_NullPtr *val); - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_CharacterData. The object being destroyed - * is the reference to the Character Data node, not the character - * data itself. - */ - ~DOM_CharacterData(); - - - //@} - - /** @name Getter functions. */ - //@{ - /** - * Returns the character data of the node that implements this interface. - * - * The DOM implementation may not put arbitrary limits on the amount of data that - * may be stored in a <code>CharacterData</code> node. However, - * implementation limits may mean that the entirety of a node's data may - * not fit into a single <code>DOMString</code>. In such cases, the user - * may call <code>substringData</code> to retrieve the data in - * appropriately sized pieces. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. - * @exception DOMException - * DOMSTRING_SIZE_ERR: Raised when it would return more characters than - * fit in a <code>DOMString</code> variable on the implementation - * platform. - */ - DOMString getData() const; - /** - * Returns the number of characters that are available through <code>data</code> and - * the <code>substringData</code> method below. - * - * This may have the value - * zero, i.e., <code>CharacterData</code> nodes may be empty. - */ - unsigned int getLength() const; - /** - * Extracts a range of data from the node. - * - * @param offset Start offset of substring to extract. - * @param count The number of characters to extract. - * @return The specified substring. If the sum of <code>offset</code> and - * <code>count</code> exceeds the <code>length</code>, then all - * characters to the end of the data are returned. - * @exception DOMException - * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater - * than the number of characters in <code>data</code>, or if the - * specified <code>count</code> is negative. - * <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text does not - * fit into a <code>DOMString</code>. - */ - DOMString substringData(unsigned int offset, - unsigned int count) const; - //@} - /** @name Functions that set or change data. */ - //@{ - /** - * Append the string to the end of the character data of the node. - * - * Upon success, <code>data</code> provides access to the concatenation of - * <code>data</code> and the <code>DOMString</code> specified. - * @param arg The <code>DOMString</code> to append. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - */ - void appendData(const DOMString &arg); - /** - * Insert a string at the specified character offset. - * - * @param offset The character offset at which to insert. - * @param arg The <code>DOMString</code> to insert. - * @exception DOMException - * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater - * than the number of characters in <code>data</code>. - * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - */ - void insertData(unsigned int offset, const DOMString &arg); - /** - * Remove a range of characters from the node. - * - * Upon success, - * <code>data</code> and <code>length</code> reflect the change. - * @param offset The offset from which to remove characters. - * @param count The number of characters to delete. If the sum of - * <code>offset</code> and <code>count</code> exceeds <code>length</code> - * then all characters from <code>offset</code> to the end of the data - * are deleted. - * @exception DOMException - * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater - * than the number of characters in <code>data</code>, or if the - * specified <code>count</code> is negative. - * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - */ - void deleteData(unsigned int offset, - unsigned int count); - /** - * Replace the characters starting at the specified character offset with - * the specified string. - * - * @param offset The offset from which to start replacing. - * @param count The number of characters to replace. If the sum of - * <code>offset</code> and <code>count</code> exceeds <code>length</code> - * , then all characters to the end of the data are replaced (i.e., the - * effect is the same as a <code>remove</code> method call with the same - * range, followed by an <code>append</code> method invocation). - * @param arg The <code>DOMString</code> with which the range must be - * replaced. - * @exception DOMException - * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater - * than the number of characters in <code>data</code>, or if the - * specified <code>count</code> is negative. - * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - */ - void replaceData(unsigned int offset, - unsigned int count, - const DOMString &arg); - - /** - * Sets the character data of the node that implements this interface. - * - * @param data The <code>DOMString</code> to set. - */ - void setData(const DOMString &data); - //@} - -protected: - DOM_CharacterData(CharacterDataImpl *impl); - -}; - -XERCES_CPP_NAMESPACE_END - -#endif - - diff --git a/src/xercesc/dom/deprecated/DOM_Comment.cpp b/src/xercesc/dom/deprecated/DOM_Comment.cpp deleted file mode 100644 index b0c034a8d201721103d5a66d1e84a781bc70bb0e..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Comment.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_Comment.hpp" -#include "CommentImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_Comment::DOM_Comment() -: DOM_CharacterData(null) -{ -}; - - -DOM_Comment::DOM_Comment(const DOM_Comment & other) -: DOM_CharacterData(other) -{ -}; - - -DOM_Comment::DOM_Comment(CommentImpl *impl) : - DOM_CharacterData(impl) -{ -}; - - -DOM_Comment::~DOM_Comment() -{ -}; - - -DOM_Comment & DOM_Comment::operator = (const DOM_Comment & other) -{ - return (DOM_Comment &) DOM_CharacterData::operator = (other); -}; - -DOM_Comment & DOM_Comment::operator = (const DOM_NullPtr *other) -{ - return (DOM_Comment &) DOM_Node::operator = (other); -}; - - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_Comment.hpp b/src/xercesc/dom/deprecated/DOM_Comment.hpp deleted file mode 100644 index 3cc58a9b622cd56511cd0571bf4400e81ef9eba4..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Comment.hpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_Comment_HEADER_GUARD_ -#define DOM_Comment_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_CharacterData.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class CommentImpl; - -/** - * Class to refer to XML comment nodes in the DOM. - * - * <P>The string value contains all of the characters between - * the starting '<code><!--</code>' and ending '<code>--></code>'. - */ -class DEPRECATED_DOM_EXPORT DOM_Comment: public DOM_CharacterData { - -public: - /** @name Constructors and assignment operators */ - //@{ - /** - * Default constructor for DOM_Comment. The resulting object does not - * refer to an actual Comment node; it will compare == to 0, and is similar - * to a null object reference variable in Java. It may subsequently be - * assigned to refer to an actual comment node. - * <p> - * New comment nodes are created by DOM_Document::createComment(). - * - */ - DOM_Comment(); - - /** - * Copy constructor. Creates a new <code>DOM_Comment</code> that refers to the - * same underlying node as the original. See also DOM_Node::clone(), - * which will copy the actual Comment node, rather than just creating a new - * reference to the original node. - * - * @param other The object to be copied. - */ - DOM_Comment(const DOM_Comment &other); - /** - * Assignment operator. - * - * @param other The object to be copied. - */ - DOM_Comment & operator = (const DOM_Comment &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_Comment & operator = (const DOM_NullPtr *val); - - - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_Comment. The object being destroyed is the reference - * object, not the underlying Comment node itself. - * - */ - ~DOM_Comment(); - //@} - -protected: - DOM_Comment(CommentImpl *comment); - - friend class DOM_Document; - - - -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/DOM_DOMException.cpp b/src/xercesc/dom/deprecated/DOM_DOMException.cpp deleted file mode 100644 index 552f1105018c3097378c9b34fe9f3f7909008607..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_DOMException.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_DOMException.hpp" -#include "DOMString.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_DOMException::DOM_DOMException() -: msg(0) -{ - code = (ExceptionCode) 0; -}; - - -DOM_DOMException::DOM_DOMException(short exCode, const DOMString &message) -: msg(message) -{ - code = (ExceptionCode) exCode; -}; - - -DOM_DOMException::DOM_DOMException(const DOM_DOMException &other) -: msg(other.msg) -{ - code = other.code; -}; - - -DOM_DOMException::~DOM_DOMException() -{ -}; - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_DOMException.hpp b/src/xercesc/dom/deprecated/DOM_DOMException.hpp deleted file mode 100644 index 9b90c6e836e7b8df9557a3fcebcf0b59a1197574..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_DOMException.hpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_DOMException_HEADER_GUARD_ -#define DOM_DOMException_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOMString.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -/** - * Encapsulate a general DOM error or warning. - * - * <p> The DOM will create and throw an instance of DOMException - * when an error condition is detected. Exceptions can occur - * when an application directly manipulates the DOM document - * tree that is produced by the parser, or when a document tree - * is created from scratch using the DOM API. DOM exceptions will - * not be generated by the parser while constructing a document - * tree from an XML source document. - * - * <p>Unlike the other classes in the C++ DOM API, DOM_DOMException - * is NOT a reference to an underlying implementation class, and - * does not provide automatic memory management. Code that catches - * a DOM exception is responsible for deleting it, or otherwise - * arranging for its disposal. - * - */ -class DEPRECATED_DOM_EXPORT DOM_DOMException { -public: - /** @name Enumerators for DOM Exceptions */ - //@{ - enum ExceptionCode { - INDEX_SIZE_ERR = 1, - DOMSTRING_SIZE_ERR = 2, - HIERARCHY_REQUEST_ERR = 3, - WRONG_DOCUMENT_ERR = 4, - INVALID_CHARACTER_ERR = 5, - NO_DATA_ALLOWED_ERR = 6, - NO_MODIFICATION_ALLOWED_ERR = 7, - NOT_FOUND_ERR = 8, - NOT_SUPPORTED_ERR = 9, - INUSE_ATTRIBUTE_ERR = 10, - INVALID_STATE_ERR = 11, - SYNTAX_ERR = 12, - INVALID_MODIFICATION_ERR = 13, - NAMESPACE_ERR = 14, - INVALID_ACCESS_ERR = 15 - }; - //@} -public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor for DOM_DOMException. - * - */ - DOM_DOMException(); - - /** - * Constructor which takes an error code and a message. - * - * @param code The error code which indicates the exception - * @param message The string containing the error message - */ - DOM_DOMException(short code, const DOMString &message); - - /** - * Copy constructor. - * - * @param other The object to be copied. - */ - DOM_DOMException(const DOM_DOMException &other); - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_DOMException. Applications are responsible - * for deleting DOM_Exception objects that they catch after they - * have completed their exception processing. - * - */ - virtual ~DOM_DOMException(); - //@} - - /** @name Public variables. */ - //@{ - /** - * A code value, from the set defined by the ExceptionCode enum, - * indicating the type of error that occured. - */ - ExceptionCode code; - - /** - * A string value. Applications may use this field to hold an error - * message. The field value is not set by the DOM implementation, - * meaning that the string will be empty when an exception is first - * thrown. - */ - DOMString msg; - //@} - -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/DOM_DOMImplementation.cpp b/src/xercesc/dom/deprecated/DOM_DOMImplementation.cpp deleted file mode 100644 index 7b6d2f6eb6c574686267a156374d1451a68ad3d5..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_DOMImplementation.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_DOMImplementation.hpp" -#include "DOM_Document.hpp" -#include "DOM_DocumentType.hpp" -#include "DOM_DOMException.hpp" -#include "DocumentImpl.hpp" -#include "DocumentTypeImpl.hpp" -#include "DStringPool.hpp" -#include <xercesc/util/XMLChar.hpp> -#include <xercesc/util/PlatformUtils.hpp> -#include <xercesc/util/XMLRegisterCleanup.hpp> - -XERCES_CPP_NAMESPACE_BEGIN - - -// -// Static constants. These are lazily initialized on first usage. -// (Static constructors can not be safely used because -// of order of initialization dependencies.) - - -static DOM_DOMImplementation *gDomimp; // Points to the singleton instance - // of DOMImplementation that is returned - // by any call to getImplementation(). - -static DOMString *gXML = 0; // Points to "XML" -static DOMString *g1_0 = 0; // Points to "1.0" -static DOMString *g2_0 = 0; // Points to "2.0" -static DOMString *gTrav = 0; // Points to "Traversal" -static DOMString *gRange = 0; // Points to "Range" -static DOMString *gCore = 0; // Points to "Core" - -// -// we define only one clean up object, if any of the above -// ever get initialized, then the cleanup function will be -// registered to the same cleanup Obj again and again. -// -// that cleanup function will delete/null all the g* -// -static XMLRegisterCleanup DOM_DOMImplementationCleanup; - -// Note #1136 - There needs to be a separate implementation class for -// DOMImplementation, so that the user programming model -// is consistent with the rest of the C++ DOM API, and -// so that hasFeature will only work on the result of -// getImplementation(), and not on DOM_DOMImplemenation objects -// created with the default constructor. -// -DOM_DOMImplementation::DOM_DOMImplementation() { -} - - - -DOM_DOMImplementation::DOM_DOMImplementation(const DOM_DOMImplementation & /*other*/) -{ -} - - -DOM_DOMImplementation::~DOM_DOMImplementation() -{ -} - - -DOM_DOMImplementation & DOM_DOMImplementation::operator = (const DOM_DOMImplementation & /*other*/) -{ - return *this; -} - -// ----------------------------------------------------------------------- -// Reset the singleton DOM_DOMImplementation -// ----------------------------------------------------------------------- -static void reinitImplementation() { - delete gDomimp; - gDomimp = 0; -} - -// getImplementation() - Always returns the same singleton instance, which -// is lazily created on the first call. Note that -// DOM_Implementation must be thread-safe because -// it is common to all DOM documents, and while a single -// document is not thread-safe within itself, we do -// promise that different documents can safely be -// used concurrently by different threads. -// -DOM_DOMImplementation &DOM_DOMImplementation::getImplementation() { - static XMLRegisterCleanup implementationCleanup; - - if (gDomimp == 0) - { - DOM_DOMImplementation *t = new DOM_DOMImplementation; - if (XMLPlatformUtils::compareAndSwap((void **)&gDomimp, t, 0) != 0) - { - delete t; - } - else - { - implementationCleanup.registerCleanup(reinitImplementation); - } - - } - return *gDomimp; -} - -bool DOM_DOMImplementation::hasFeature(const DOMString &feature, const DOMString &version) -{ - bool anyVersion = (version == null || version.length() == 0); - bool version1_0 = version.equals(DStringPool::getStaticString("1.0" - , &g1_0 - , reinitDOM_DOMImplementation - , DOM_DOMImplementationCleanup)); - bool version2_0 = version.equals(DStringPool::getStaticString("2.0" - , &g2_0 - , reinitDOM_DOMImplementation - , DOM_DOMImplementationCleanup)); - - // case-insensitive compare - if(!XMLString::compareIString(feature.rawBuffer(), DStringPool::getStaticString("XML" - , &gXML - , reinitDOM_DOMImplementation - , DOM_DOMImplementationCleanup).rawBuffer()) - && (anyVersion || version1_0 || version2_0)) - return true; - - if(!XMLString::compareIString(feature.rawBuffer(), DStringPool::getStaticString("Core" - , &gCore - , reinitDOM_DOMImplementation - , DOM_DOMImplementationCleanup).rawBuffer()) - && (anyVersion || version1_0 || version2_0)) - return true; - - if(!XMLString::compareIString(feature.rawBuffer(), DStringPool::getStaticString("Traversal" - , &gTrav - , reinitDOM_DOMImplementation - , DOM_DOMImplementationCleanup).rawBuffer()) - && (anyVersion || version2_0)) - return true; - - if(!XMLString::compareIString(feature.rawBuffer(), DStringPool::getStaticString("Range" - , &gRange - , reinitDOM_DOMImplementation - , DOM_DOMImplementationCleanup).rawBuffer()) - && (anyVersion || version2_0)) - return true; - - - return false; -} - - -//Introduced in DOM Level 2 - -DOM_DocumentType DOM_DOMImplementation::createDocumentType(const DOMString &qualifiedName, - const DOMString &publicId, const DOMString &systemId) -{ - if(!XMLChar1_0::isValidName(qualifiedName.rawBuffer(), XMLString::stringLen(qualifiedName.rawBuffer()))) - throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR,null); - return DOM_DocumentType(new DocumentTypeImpl(null, qualifiedName, publicId, systemId)); -} - -DOM_Document DOM_DOMImplementation::createDocument(const DOMString &namespaceURI, - const DOMString &qualifiedName, const DOM_DocumentType &doctype, MemoryManager* const manager) -{ - return DOM_Document(new (manager) DocumentImpl(namespaceURI, qualifiedName, - doctype == null ? null : (DocumentTypeImpl *) doctype.fImpl, manager)); -} - -// ----------------------------------------------------------------------- -// Notification that lazy data has been deleted -// ----------------------------------------------------------------------- -void DOM_DOMImplementation::reinitDOM_DOMImplementation() { - - delete gXML; - gXML = 0; - - delete g1_0; - g1_0 = 0; - - delete g2_0; - g2_0 = 0; - - delete gTrav; - gTrav = 0; - - delete gRange; - gRange = 0; - - delete gCore; - gCore = 0; - -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_DOMImplementation.hpp b/src/xercesc/dom/deprecated/DOM_DOMImplementation.hpp deleted file mode 100644 index f1f1579db80b96b174312fe9143d375c98e68323..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_DOMImplementation.hpp +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_DOMImplementation_HEADER_GUARD_ -#define DOM_DOMImplementation_HEADER_GUARD_ - -#include <xercesc/util/PlatformUtils.hpp> -#include "DOMString.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DOM_Document; -class DOM_DocumentType; - -/** - * This class provides a way to query the capabilities of an implementation - * of the DOM - */ - - -class DEPRECATED_DOM_EXPORT DOM_DOMImplementation { - private: - DOM_DOMImplementation(const DOM_DOMImplementation &other); - - public: -/** @name Constructors and assignment operators */ -//@{ - /** - * Construct a DOM_Implementation reference variable, which should - * be assigned to the return value from - * <code>DOM_Implementation::getImplementation()</code>. - */ - DOM_DOMImplementation(); - - /** - * Assignment operator - * - */ - DOM_DOMImplementation & operator = (const DOM_DOMImplementation &other); -//@} - - /** @name Destructor */ - //@{ - /** - * Destructor. The object being destroyed is a reference to the DOMImplemenentation, - * not the underlying DOMImplementation object itself, which is owned by - * the implementation code. - * - */ - - ~DOM_DOMImplementation(); - //@} - - /** @name Getter functions */ - //@{ - - /** - * Test if the DOM implementation implements a specific feature. - * - * @param feature The string of the feature to test (case-insensitive). The legal - * values are defined throughout this specification. The string must be - * an <EM>XML name</EM> (see also Compliance). - * @param version This is the version number of the package name to test. - * In Level 1, this is the string "1.0". If the version is not specified, - * supporting any version of the feature will cause the method to return - * <code>true</code>. - * @return <code>true</code> if the feature is implemented in the specified - * version, <code>false</code> otherwise. - */ - bool hasFeature(const DOMString &feature, const DOMString &version); - - - /** Return a reference to a DOM_Implementation object for this - * DOM implementation. - * - * Intended to support applications that may be - * using DOMs retrieved from several different sources, potentially - * with different underlying implementations. - */ - static DOM_DOMImplementation &getImplementation(); - - //@} - - /** @name Functions introduced in DOM Level 2. */ - //@{ - /** - * Creates an empty <code>DOM_DocumentType</code> node. - * Entity declarations and notations are not made available. - * Entity reference expansions and default attribute additions - * do not occur. It is expected that a future version of the DOM - * will provide a way for populating a <code>DOM_DocumentType</code>. - * - * @param qualifiedName The <em>qualified name</em> - * of the document type to be created. - * @param publicId The external subset public identifier. - * @param systemId The external subset system identifier. - * @return A new <code>DOM_DocumentType</code> node with - * <code>Node.ownerDocument</code> set to <code>null</code>. - * @exception DOMException - * INVALID_CHARACTER_ERR: Raised if the specified qualified name - * contains an illegal character. - * <br> - * NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is malformed. - */ - DOM_DocumentType createDocumentType(const DOMString &qualifiedName, - const DOMString &publicId, const DOMString &systemId); - - /** - * Creates an XML <code>DOM_Document</code> object of the specified type - * with its document element. - * - * @param namespaceURI The <em>namespace URI</em> of - * the document element to create, or <code>null</code>. - * @param qualifiedName The <em>qualified name</em> - * of the document element to be created. - * @param doctype The type of document to be created or <code>null</code>. - * <p>When <code>doctype</code> is not <code>null</code>, its - * <code>Node.ownerDocument</code> attribute is set to the document - * being created. - * @return A new <code>DOM_Document</code> object. - * @exception DOMException - * INVALID_CHARACTER_ERR: Raised if the specified qualified name - * contains an illegal character. - * <br> - * NAMESPACE_ERR: Raised if the <CODE>qualifiedName</CODE> is - * malformed, or if the <CODE>qualifiedName</CODE> has a prefix that is - * "xml" and the <CODE>namespaceURI</CODE> is different from - * "http://www.w3.org/XML/1998/namespace". - * <br> - * WRONG_DOCUMENT_ERR: Raised if <code>doctype</code> has already - * been used with a different document. - */ - DOM_Document createDocument(const DOMString &namespaceURI, - const DOMString &qualifiedName, const DOM_DocumentType &doctype, - MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - //@} - - // ----------------------------------------------------------------------- - // Notification that lazy data has been deleted - // ----------------------------------------------------------------------- - static void reinitDOM_DOMImplementation(); -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/DOM_Document.cpp b/src/xercesc/dom/deprecated/DOM_Document.cpp deleted file mode 100644 index 564507a0d975299f19cae7db925627a5c5d82900..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Document.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - - -#include "DOM_Document.hpp" -#include "DeepNodeListImpl.hpp" -#include "DocumentImpl.hpp" -#include "NodeIteratorImpl.hpp" -#include "TreeWalkerImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_Document::DOM_Document (DocumentImpl *impl) : - DOM_Node(impl) -{ -}; - - -DOM_Document::DOM_Document() : - DOM_Node(null) -{ -}; - - -DOM_Document::DOM_Document(const DOM_Document &other) -: DOM_Node(other) -{ -}; - - -DOM_Document::~DOM_Document() -{ -}; - -DOM_Document & DOM_Document::operator = (const DOM_Document &other) -{ - return (DOM_Document &) DOM_Node::operator = (other); -}; - - -DOM_Document & DOM_Document::operator = (const DOM_NullPtr *other) -{ - return (DOM_Document &) DOM_Node::operator = (other); -}; - - -DOM_Document DOM_Document::createDocument(MemoryManager* const manager) -{ - return DOM_Document(new (manager) DocumentImpl(manager)); -}; - - -DOM_Notation DOM_Document::createNotation(const DOMString &name) -{ - return DOM_Notation(((DocumentImpl *)fImpl)->createNotation(name)); -}; - - -DOM_DocumentType DOM_Document::getDoctype() const { - return DOM_DocumentType(((DocumentImpl *)fImpl)->getDoctype()); -}; - - -DOM_DOMImplementation &DOM_Document::getImplementation() const { - return DOM_DOMImplementation::getImplementation(); -}; - -DOM_Element DOM_Document::getDocumentElement() const { - return DOM_Element(((DocumentImpl *)fImpl)->getDocumentElement()); -}; - - -DOM_Element DOM_Document::createElement(const DOMString &tagName) -{ - return DOM_Element(((DocumentImpl *)fImpl)->createElement(tagName)); -}; - - - -DOM_Element DOM_Document::createElement(const XMLCh *tagName) -{ - return DOM_Element(((DocumentImpl *)fImpl)->createElement(tagName)); -}; - - - -DOM_Entity DOM_Document::createEntity(const DOMString &name) -{ - return DOM_Entity(((DocumentImpl *)fImpl)->createEntity(name)); -}; - - - -DOM_DocumentFragment DOM_Document::createDocumentFragment() -{ - return DOM_DocumentFragment(((DocumentImpl *)fImpl)->createDocumentFragment()); -}; - - -DOM_DocumentType DOM_Document::createDocumentType(const DOMString &name) -{ - return DOM_DocumentType(((DocumentImpl *)fImpl)->createDocumentType(name)); -}; - - - -DOM_Text DOM_Document::createTextNode(const DOMString &data) { - return DOM_Text(((DocumentImpl *)fImpl)->createTextNode(data)); -}; - - -DOM_Comment DOM_Document::createComment(const DOMString &data) { - return DOM_Comment(((DocumentImpl *)fImpl)->createComment(data)); -}; - - -DOM_CDATASection DOM_Document::createCDATASection(const DOMString &data) { - return DOM_CDATASection(((DocumentImpl *)fImpl)->createCDATASection(data)); -}; - - -DOM_ProcessingInstruction DOM_Document::createProcessingInstruction(const DOMString &target, - const DOMString &data) { - return DOM_ProcessingInstruction(((DocumentImpl *)fImpl)->createProcessingInstruction(target, data)); -}; - - -DOM_Attr DOM_Document::createAttribute(const DOMString &name) { - return DOM_Attr(((DocumentImpl *)fImpl)->createAttribute(name)); -}; - - -DOM_EntityReference DOM_Document::createEntityReference(const DOMString &name) { - return DOM_EntityReference(((DocumentImpl *)fImpl)->createEntityReference(name)); -}; - - -DOM_NodeIterator DOM_Document::createNodeIterator(DOM_Node root, unsigned long whatToShow, DOM_NodeFilter* filter, bool entityReferenceExpansion) { - return DOM_NodeIterator(DocumentImpl::createNodeIterator(root, whatToShow, filter, entityReferenceExpansion)); -}; - - -DOM_TreeWalker DOM_Document::createTreeWalker(DOM_Node root, unsigned long whatToShow, DOM_NodeFilter* filter, bool entityReferenceExpansion) { - return DOM_TreeWalker(DocumentImpl::createTreeWalker(root, whatToShow, filter, entityReferenceExpansion)); -}; - - -DOM_NodeList DOM_Document::getElementsByTagName(const DOMString &tagname) const { - return DOM_NodeList(((DocumentImpl *)fImpl)->getElementsByTagName(tagname)); -}; - - -//Introduced in DOM Level 2 - -DOM_Node DOM_Document::importNode(const DOM_Node &importedNode, bool deep) -{ - return DOM_Node(((DocumentImpl *)fImpl)->importNode(importedNode.fImpl, deep)); -}; - - -DOM_Element DOM_Document::createElementNS(const DOMString &namespaceURI, - const DOMString &qualifiedName) -{ - return DOM_Element(((DocumentImpl *)fImpl)->createElementNS(namespaceURI, qualifiedName)); -} - - -DOM_Attr DOM_Document::createAttributeNS(const DOMString &namespaceURI, - const DOMString &qualifiedName) -{ - return DOM_Attr(((DocumentImpl *)fImpl)->createAttributeNS(namespaceURI, qualifiedName)); -} - - -DOM_NodeList DOM_Document::getElementsByTagNameNS(const DOMString &namespaceURI, - const DOMString &localName) const -{ - return DOM_NodeList(((DocumentImpl *)fImpl)->getElementsByTagNameNS(namespaceURI, localName)); -} - - -DOM_Element DOM_Document::getElementById(const DOMString &elementId) -{ - return DOM_Element(((DocumentImpl *)fImpl)->getElementById(elementId)); -} - - -DOM_XMLDecl DOM_Document::createXMLDecl(const DOMString& version, const DOMString& encoding, const DOMString& standalone) -{ - return DOM_XMLDecl( ((DocumentImpl *)fImpl)->createXMLDecl(version, encoding, standalone)); -} - -DOM_Range DOM_Document::createRange() -{ - return DOM_Range( ((DocumentImpl *)fImpl)->createRange() ); -} - - -void DOM_Document::setErrorChecking(bool check) { - ((DocumentImpl *)fImpl)->setErrorChecking(check); -} - -bool DOM_Document::getErrorChecking() { - return ((DocumentImpl *)fImpl)->getErrorChecking(); -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_Document.hpp b/src/xercesc/dom/deprecated/DOM_Document.hpp deleted file mode 100644 index 5db162feed5910541987dd1e0825e30b99b7fdde..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Document.hpp +++ /dev/null @@ -1,578 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ -*/ - -#ifndef DOM_Document_HEADER_GUARD_ -#define DOM_Document_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_DocumentType.hpp" -#include "DOM_DOMImplementation.hpp" -#include "DOM_Element.hpp" -#include "DOM_DocumentFragment.hpp" -#include "DOM_Comment.hpp" -#include "DOM_CDATASection.hpp" -#include "DOM_ProcessingInstruction.hpp" -#include "DOM_Attr.hpp" -#include "DOM_Entity.hpp" -#include "DOM_EntityReference.hpp" -#include "DOM_NodeList.hpp" -#include "DOM_Notation.hpp" -#include "DOM_Text.hpp" -#include "DOM_Node.hpp" -#include "DOM_NodeIterator.hpp" -#include "DOM_TreeWalker.hpp" -#include "DOM_XMLDecl.hpp" -#include "DOM_Range.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DocumentImpl; -class NodeIteratorImpl; - - -/** -* Class to refer to XML Document nodes in the DOM. -* -* Conceptually, a DOM document node is the root of the document tree, and provides -* the primary access to the document's data. -* <p>Since elements, text nodes, comments, processing instructions, etc. -* cannot exist outside the context of a <code>Document</code>, the -* <code>Document</code> interface also contains the factory methods needed -* to create these objects. The <code>Node</code> objects created have a -* <code>ownerDocument</code> attribute which associates them with the -* <code>Document</code> within whose context they were created. -*/ -class DEPRECATED_DOM_EXPORT DOM_Document: public DOM_Node { - -public: - /** @name Constructors and assignment operators */ - //@{ - /** - * The default constructor for DOM_Document creates a null - * DOM_Document object that refers to no document. It may subsequently be - * assigned to refer to an actual Document node. - * - * To create a new document, use the static method - * <code> DOM_Document::createDocument(). </code> - * - */ - DOM_Document(); - - /** - * Copy constructor. Creates a new <code>DOM_Document</code> that refers to the - * same underlying actual document as the original. - * - * @param other The object to be copied - */ - DOM_Document(const DOM_Document &other); - /** - * Assignment operator - * - * @param other The object to be copied - */ - DOM_Document & operator = (const DOM_Document &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_Document & operator = (const DOM_NullPtr *val); - - - - //@} - /** @name Destructor */ - //@{ - - /** - * Destructor. The object being destroyed is the reference - * object, not the underlying Document itself. - * - * <p>The reference counting memory management will - * delete the underlying document itself if this - * DOM_Document is the last remaining to refer to the Document, - * and if there are no remaining references to any of the nodes - * within the document tree. If other live references do remain, - * the underlying document itself remains also. - * - */ - ~DOM_Document(); - - //@} - /** @name Factory methods to create new nodes for the Document */ - //@{ - - /** - * Create a new empty document. - * - * This differs from the <code> DOM_Document </code> default - * constructor, which creates - * a null reference only, not an actual document. - * - * <p>This function is an extension to the DOM API, which - * lacks any mechanism for the creation of new documents. - * @return A new <code>DOM_Document</code>, which may then - * be populated using the DOM API calls. - */ - static DOM_Document createDocument(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - - /** - * Create a new entity. - * - * Non-standard extension. - * @param name The name of the entity to instantiate - * - */ - DOM_Entity createEntity(const DOMString &name); - - /** - * Creates an element of the type specified. - * - * Note that the instance returned - * implements the Element interface, so attributes can be specified - * directly on the returned object. - * @param tagName The name of the element type to instantiate. - * @return A <code>DOM_Element</code> that reference the new element. - * @exception DOMException - * INVALID_CHARACTER_ERR: Raised if the specified name contains an - * illegal character. - */ - DOM_Element createElement(const DOMString &tagName); - - /** - * Creates an element of the type specified. - * This non-standard overload of createElement, with the name specified as - * raw Unicode string, is intended for use from XML parsers, - * and is the best performing way to create elements. The name - * string is not checked for conformance to the XML rules for valid - * element names. - * - * - * @param tagName The name of the element type to instantiate, as - * a null-terminated unicode string. - * @return A new <CODE>DOM_Element</CODE> - * object with the <CODE>nodeName</CODE> attribute set to - * <CODE>tagName</CODE>, and <CODE>localName</CODE>, - * <CODE>prefix</CODE>, and <CODE>namespaceURI</CODE> set to - * <CODE>null</CODE>. - */ - DOM_Element createElement(const XMLCh *tagName); - - - /** - * Creates an empty DocumentFragment object. - * - * @return A <code>DOM_DocumentFragment</code> that references the newly - * created document fragment. - */ - DOM_DocumentFragment createDocumentFragment(); - - /** - * Creates a Text node given the specified string. - * - * @param data The data for the node. - * @return A <code>DOM_Text</code> object that references the newly - * created text node. - */ - DOM_Text createTextNode(const DOMString &data); - - /** - * Creates a Comment node given the specified string. - * - * @param data The data for the comment. - * @return A <code>DOM_Comment</code> that references the newly - * created comment node. - */ - DOM_Comment createComment(const DOMString &data); - - /** - * Creates a CDATASection node whose value is the specified - * string. - * - * @param data The data for the <code>DOM_CDATASection</code> contents. - * @return A <code>DOM_CDATASection</code> object. - * @exception DOMException - * NOT_SUPPORTED_ERR: Raised if this document is an HTML document. - */ - DOM_CDATASection createCDATASection(const DOMString &data); - - /** - * Create a DocumentType node. Non-standard extension. - * - * @return A <code>DOM_DocumentType</code> that references the newly - * created DocumentType node. - * - */ - DOM_DocumentType createDocumentType(const DOMString &name); - - - /** - * Create a Notation. - * - * Non-standard extension. - * - * @param name The name of the notation to instantiate - * @return A <code>DOM_Notation</code> that references the newly - * created Notation node. - */ - DOM_Notation createNotation(const DOMString &name); - - - /** - * Creates a ProcessingInstruction node given the specified - * name and data strings. - * - * @param target The target part of the processing instruction. - * @param data The data for the node. - * @return A <code>DOM_ProcessingInstruction</code> that references the newly - * created PI node. - * @exception DOMException - * INVALID_CHARACTER_ERR: Raised if an illegal character is specified. - */ - DOM_ProcessingInstruction createProcessingInstruction(const DOMString &target, - const DOMString &data); - - - /** - * Creates an Attr of the given name. - * - * Note that the - * <code>Attr</code> instance can then be attached to an Element - * using the <code>DOMElement::setAttribute()</code> method. - * @param name The name of the attribute. - * @return A new <CODE>DOM_Attr</CODE> - * object with the <CODE>nodeName</CODE> attribute set to - * <CODE>name</CODE>, and <CODE>localName</CODE>, <CODE>prefix</CODE>, - * and <CODE>namespaceURI</CODE> set to - * <CODE>null</CODE>. - * @exception DOMException - * INVALID_CHARACTER_ERR: Raised if the specified name contains an - * illegal character. - */ - DOM_Attr createAttribute(const DOMString &name); - - - /** - * Creates an EntityReference object. - * - * @param name The name of the entity to reference. - * @return A <code>DOM_EntityReference</code> that references the newly - * created EntityReference node. - * @exception DOMException - * INVALID_CHARACTER_ERR: Raised if the specified name contains an - * illegal character. - */ - DOM_EntityReference createEntityReference(const DOMString &name); - - - /** - * Creates a NodeIterator object. (DOM2) - * - * NodeIterators are used to step through a set of nodes, e.g. the set of nodes in a NodeList, the - * document subtree governed by a particular node, the results of a query, or any other set of nodes. - * The set of nodes to be iterated is determined by the implementation of the NodeIterator. DOM Level 2 - * specifies a single NodeIterator implementation for document-order traversal of a document subtree. - * Instances of these iterators are created by calling <code>DocumentTraversal.createNodeIterator()</code>. - * - * To produce a view of the document that has entity references expanded and does not - * expose the entity reference node itself, use the <code>whatToShow</code> flags to hide the entity - * reference node and set expandEntityReferences to true when creating the iterator. To - * produce a view of the document that has entity reference nodes but no entity expansion, - * use the <code>whatToShow</code> flags to show the entity reference node and set - * expandEntityReferences to false. - * - * @param root The root node of the DOM tree - * @param whatToShow This attribute determines which node types are presented via the iterator. - * @param filter The filter used to screen nodes - * @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are - * visible to the iterator. If false, they will be skipped over. - */ - - DOM_NodeIterator createNodeIterator(DOM_Node root, - unsigned long whatToShow, - DOM_NodeFilter* filter, - bool entityReferenceExpansion); - /** - * Creates a TreeWalker object. (DOM2) - * - * TreeWalker objects are used to navigate a document tree or subtree using the view of the document defined - * by its whatToShow flags and any filters that are defined for the TreeWalker. Any function which performs - * navigation using a TreeWalker will automatically support any view defined by a TreeWalker. - * - * Omitting nodes from the logical view of a subtree can result in a structure that is substantially different from - * the same subtree in the complete, unfiltered document. Nodes that are siblings in the TreeWalker view may - * be children of different, widely separated nodes in the original view. For instance, consider a Filter that skips - * all nodes except for Text nodes and the root node of a document. In the logical view that results, all text - * nodes will be siblings and appear as direct children of the root node, no matter how deeply nested the - * structure of the original document. - * - * To produce a view of the document that has entity references expanded - * and does not expose the entity reference node itself, use the whatToShow - * flags to hide the entity reference node and set <code>expandEntityReferences</code> to - * true when creating the TreeWalker. To produce a view of the document - * that has entity reference nodes but no entity expansion, use the - * <code>whatToShow</code> flags to show the entity reference node and set - * <code>expandEntityReferences</code> to false - * - * @param root The root node of the DOM tree - * @param whatToShow This attribute determines which node types are presented via the tree-walker. - * @param filter The filter used to screen nodes - * @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are - * visible to the tree-walker. If false, they will be skipped over. - */ - - DOM_TreeWalker createTreeWalker(DOM_Node root, - unsigned long whatToShow, - DOM_NodeFilter* filter, - bool entityReferenceExpansion); - - /** - * Creates a XMLDecl type Node . Non-Standard (an extension to xerces) - * - * XMLDecl Nodes are created to get version, encoding and standalone information in a document tree - * - * This node if created gets attached to a document object or an entity node. There can be no child - * to this type of node. - * - * @param version The version data of the document. Currently possible value is 1.0 - * @param encoding The encoding type specified in the document - * @param standalone The information whether the document is standalone or not - */ - - DOM_XMLDecl createXMLDecl(const DOMString& version, - const DOMString& encoding, - const DOMString& standalone); - - /** - * To create the range consisting of boundary-points and offset of the - * selected contents - * - * @return The initial state of the Range such that both the boundary-points - * are positioned at the beginning of the corresponding DOM_DOcument, before - * any content. The range returned can only be used to select content - * associated with this document, or with documentFragments and Attrs for - * which this document is the ownerdocument - */ - DOM_Range createRange(); - - //@} - /** @name Getter functions */ - //@{ - /** - * Get Document Type Declaration (see <code>DOM_DocumentType</code>) associated - * with this document. - * - * For documents without - * a document type declaration this returns <code>null</code> reference object. The DOM Level - * 1 does not support editing the Document Type Declaration, therefore - * <code>docType</code> cannot be altered in any way. - */ - DOM_DocumentType getDoctype() const; - - - - /** - * Return the <code>DOMImplementation</code> object that handles this document. - */ - DOM_DOMImplementation &getImplementation() const; - - - /** - * Return a reference to the root element of the document. - */ - DOM_Element getDocumentElement() const; - - /** - * Returns a <code>DOM_NodeList</code> of all the elements with a - * given tag name. The returned node list is "live", in that changes - * to the document tree made after a nodelist was initially - * returned will be immediately reflected in the node list. - * - * The elements in the node list are ordered in the same order in which they - * would be encountered in a - * preorder traversal of the <code>Document</code> tree. - * @param tagname The name of the tag to match on. The special value "*" - * matches all tags. - * @return A reference to a NodeList containing all the matched - * <code>Element</code>s. - */ - DOM_NodeList getElementsByTagName(const DOMString &tagname) const; - - //@} - /** @name Functions introduced in DOM Level 2. */ - //@{ - - /** - * Imports a node from another document to this document. - * The returned node has no parent (<CODE>parentNode</CODE> is - * <CODE>null</CODE>). The source node is not altered or removed from the - * original document; this method creates a new copy of the source - * node.<BR>For all nodes, importing a node creates a node object owned by - * the importing document, with attribute values identical to the source - * node's <CODE>nodeName</CODE> and <CODE>nodeType</CODE>, plus the - * attributes related to namespaces (prefix and namespaces URI). - * - * @param importedNode The node to import. - * @param deep If <CODE>true</CODE>, recursively import the subtree under the - * specified node; if <CODE>false</CODE>, import only the node itself, - * as explained above. This does not apply to <CODE>DOM_Attr</CODE>, - * <CODE>DOM_EntityReference</CODE>, and <CODE>DOM_Notation</CODE> nodes. - * @return The imported node that belongs to this <CODE>DOM_Document</CODE>. - * @exception DOMException - * NOT_SUPPORTED_ERR: Raised if the type of node being imported is - * not supported. - */ - DOM_Node importNode(const DOM_Node &importedNode, bool deep); - - /** - * Creates an element of the given qualified name and - * namespace URI. - * - * @param namespaceURI The <em>namespace URI</em> of - * the element to create. - * @param qualifiedName The <em>qualified name</em> - * of the element type to instantiate. - * @return A new <code>DOM_Element</code> object. - * @exception DOMException - * INVALID_CHARACTER_ERR: Raised if the specified qualified name contains - * an illegal character. - * <br> - * NAMESPACE_ERR: Raised if the <CODE>qualifiedName</CODE> is - * malformed, if the <CODE>qualifiedName</CODE> has a prefix and the - * <CODE>namespaceURI</CODE> is <CODE>null</CODE> or an empty string, - * or if the <CODE>qualifiedName</CODE> has a prefix that is "xml" and - * the <CODE>namespaceURI</CODE> is different from - * "http://www.w3.org/XML/1998/namespace". - */ - DOM_Element createElementNS(const DOMString &namespaceURI, - const DOMString &qualifiedName); - - /** - * Creates an attribute of the given qualified name and namespace - * URI. - * - * @param namespaceURI The <em>namespace URI</em> of - * the attribute to create. - * @param qualifiedName The <em>qualified name</em> - * of the attribute to instantiate. - * @return A new <code>DOM_Attr</code> object. - * @exception DOMException - * INVALID_CHARACTER_ERR: Raised if the specified qualified name contains - * an illegal character. - * <br> - * NAMESPACE_ERR: Raised if the <CODE>qualifiedName</CODE> is - * malformed, if the <CODE>qualifiedName</CODE> has a prefix and the - * <CODE>namespaceURI</CODE> is <CODE>null</CODE> or an empty string, - * if the <CODE>qualifiedName</CODE> has a prefix that is "xml" and the - * <CODE>namespaceURI</CODE> is different from - * "http://www.w3.org/XML/1998/namespace", if the - * <CODE>qualifiedName</CODE> has a prefix that is "xmlns" and the - * <CODE>namespaceURI</CODE> is different from - * "http://www.w3.org/2000/xmlns/", or if the - * <CODE>qualifiedName</CODE> is "xmlns" and the - * <CODE>namespaceURI</CODE> is different from - * "http://www.w3.org/2000/xmlns/". - */ - DOM_Attr createAttributeNS(const DOMString &namespaceURI, - const DOMString &qualifiedName); - - /** - * Returns a <code>DOM_NodeList</code> of all the <code>DOM_Element</code>s - * with a given <em>local name</em> and - * namespace URI in the order in which they would be encountered in a - * preorder traversal of the <code>DOM_Document</code> tree. - * - * @param namespaceURI The <em>namespace URI</em> of - * the elements to match on. The special value "*" matches all - * namespaces. - * @param localName The <em>local name</em> of the - * elements to match on. The special value "*" matches all local names. - * @return A new <code>DOM_NodeList</code> object containing all the matched - * <code>DOM_Element</code>s. - */ - DOM_NodeList getElementsByTagNameNS(const DOMString &namespaceURI, - const DOMString &localName) const; - - /** - * Returns the <code>DOM_Element</code> whose ID is given by <code>elementId</code>. - * If no such element exists, returns <code>null</code>. - * Behavior is not defined if more than one element has this <code>ID</code>. - * <P><B>Note:</B> The DOM implementation must have information that says - * which attributes are of type ID. Attributes with the name "ID" are not of - * type ID unless so defined. Implementations that do not know whether - * attributes are of type ID or not are expected to return - * <CODE>null</CODE>.</P> - * - * @param elementId The unique <code>id</code> value for an element. - * @return The matching element. - */ - DOM_Element getElementById(const DOMString &elementId); - - /** - * Sets whether the DOM implementation performs error checking - * upon operations. Turning off error checking only affects - * the following DOM checks: - * <ul> - * <li>Checking strings to make sure that all characters are - * legal XML characters - * <li>Hierarchy checking such as allowed children, checks for - * cycles, etc. - * </ul> - * <p> - * Turning off error checking does <em>not</em> turn off the - * following checks: - * <ul> - * <li>Read only checks - * <li>Checks related to DOM events - * </ul> - */ - void setErrorChecking(bool check); - - /** - * Returns true if the DOM implementation performs error checking. - */ - bool getErrorChecking(); - - //@} - -protected: - DOM_Document (DocumentImpl *impl); - - friend class DOM_Node; - friend class DocumentImpl; - friend class NodeIteratorImpl; - friend class DOM_DOMImplementation; - -}; - - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/DOM_DocumentFragment.cpp b/src/xercesc/dom/deprecated/DOM_DocumentFragment.cpp deleted file mode 100644 index be38f65d40ec489e4a78ee8b0c8c7f7a03901032..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_DocumentFragment.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_DocumentFragment.hpp" -#include "DocumentFragmentImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_DocumentFragment::DOM_DocumentFragment() -: DOM_Node(null) -{ -}; - - -DOM_DocumentFragment::DOM_DocumentFragment(const DOM_DocumentFragment & other) -: DOM_Node(other) -{ -}; - - -DOM_DocumentFragment::DOM_DocumentFragment(DocumentFragmentImpl *impl) : - DOM_Node(impl) -{ -}; - - -DOM_DocumentFragment::~DOM_DocumentFragment() -{ -}; - - -DOM_DocumentFragment & DOM_DocumentFragment::operator = (const DOM_DocumentFragment & other) -{ - return (DOM_DocumentFragment &) DOM_Node::operator = (other); -}; - - -DOM_DocumentFragment & DOM_DocumentFragment::operator = (const DOM_NullPtr *other) -{ - return (DOM_DocumentFragment &) DOM_Node::operator = (other); -}; - - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_DocumentFragment.hpp b/src/xercesc/dom/deprecated/DOM_DocumentFragment.hpp deleted file mode 100644 index e932de5b55027013f4ba06c44f5aa1fce2bf5af7..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_DocumentFragment.hpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_DocumentFragment_HEADER_GUARD_ -#define DOM_DocumentFragment_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DocumentFragmentImpl; - -/** - * <code>DocumentFragment</code> is a "lightweight" or "minimal" - * <code>Document</code> object. - * - * It is very common to want to be able to - * extract a portion of a document's tree or to create a new fragment of a - * document. Imagine implementing a user command like cut or rearranging a - * document by moving fragments around. It is desirable to have an object - * which can hold such fragments and it is quite natural to use a Node for - * this purpose. While it is true that a <code>Document</code> object could - * fulfil this role, a <code>Document</code> object can potentially be a - * heavyweight object, depending on the underlying implementation. What is - * really needed for this is a very lightweight object. - * <code>DocumentFragment</code> is such an object. - * <p>Furthermore, various operations -- such as inserting nodes as children - * of another <code>Node</code> -- may take <code>DocumentFragment</code> - * objects as arguments; this results in all the child nodes of the - * <code>DocumentFragment</code> being moved to the child list of this node. - * <p>The children of a <code>DocumentFragment</code> node are zero or more - * nodes representing the tops of any sub-trees defining the structure of the - * document. <code>DocumentFragment</code> nodes do not need to be - * well-formed XML documents (although they do need to follow the rules - * imposed upon well-formed XML parsed entities, which can have multiple top - * nodes). For example, a <code>DocumentFragment</code> might have only one - * child and that child node could be a <code>Text</code> node. Such a - * structure model represents neither an HTML document nor a well-formed XML - * document. - * <p>When a <code>DocumentFragment</code> is inserted into a - * <code>Document</code> (or indeed any other <code>Node</code> that may take - * children) the children of the <code>DocumentFragment</code> and not the - * <code>DocumentFragment</code> itself are inserted into the - * <code>Node</code>. This makes the <code>DocumentFragment</code> very - * useful when the user wishes to create nodes that are siblings; the - * <code>DocumentFragment</code> acts as the parent of these nodes so that the - * user can use the standard methods from the <code>Node</code> interface, - * such as <code>insertBefore()</code> and <code>appendChild()</code>. - */ - -class DEPRECATED_DOM_EXPORT DOM_DocumentFragment: public DOM_Node { - -public: - /** @name Constructors and assignment operators */ - //@{ - /** - * Default constructor for <code>DOM_DocumentFragment</code>. The resulting object does not - * refer to an actual Document Fragment node; it will compare == to 0, and is similar - * to a null object reference variable in Java. It may subsequently be - * assigned to refer to an actual Document Fragment node. - * <p> - * New document fragment nodes are created by DOM_Document::createDocumentFragment(). - * - */ - - DOM_DocumentFragment(); - - /** - * Copy constructor. Creates a new <code>DOM_DocumentFragment</code> that refers to the - * same underlying node as the original. See also DOM_Node::clone(), - * which will copy the actual Document fragment node, rather than just creating a new - * reference to the original node. - * - * @param other The object to be copied - */ - DOM_DocumentFragment(const DOM_DocumentFragment &other); - - /** - * Assignment operator - * - * @param other The object to be copied - */ - DOM_DocumentFragment & operator = (const DOM_DocumentFragment &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_DocumentFragment & operator = (const DOM_NullPtr *val); - - //@} - /** @name Destructor */ - //@{ - - /** - * Destructor. The object being destroyed is the reference - * object, not the underlying Comment node itself. - * - */ - ~DOM_DocumentFragment(); - - //@} - -protected: - DOM_DocumentFragment(DocumentFragmentImpl *); - - friend class DOM_Document; - friend class RangeImpl; -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/DOM_DocumentType.cpp b/src/xercesc/dom/deprecated/DOM_DocumentType.cpp deleted file mode 100644 index 5ea86171e1b8265baddfa47ee1a7aa71819b1e88..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_DocumentType.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_DocumentType.hpp" -#include "DocumentTypeImpl.hpp" -#include "DOM_NamedNodeMap.hpp" -#include <assert.h> - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_DocumentType::DOM_DocumentType() -: DOM_Node(null) -{ -}; - - -DOM_DocumentType::DOM_DocumentType(int nullPointer) -: DOM_Node(null) -{ - //Note: the assert below has no effect in release build - //needs to revisit later - assert(nullPointer == 0); -}; - - -DOM_DocumentType::DOM_DocumentType(const DOM_DocumentType & other) -: DOM_Node(other) -{ -}; - - -DOM_DocumentType::DOM_DocumentType(DocumentTypeImpl *impl) : - DOM_Node(impl) -{ -}; - - -DOM_DocumentType::~DOM_DocumentType() -{ -}; - - -DOM_DocumentType & DOM_DocumentType::operator = (const DOM_DocumentType & other) -{ - return (DOM_DocumentType &) DOM_Node::operator = (other); -}; - - -DOM_DocumentType & DOM_DocumentType::operator = (const DOM_NullPtr *other) -{ - return (DOM_DocumentType &) DOM_Node::operator = (other); -}; - - -DOMString DOM_DocumentType::getName() const -{ - return ((DocumentTypeImpl *)fImpl)->getName().clone(); -}; - - - -DOM_NamedNodeMap DOM_DocumentType::getEntities() const -{ - return DOM_NamedNodeMap(((DocumentTypeImpl *)fImpl)->getEntities()); -}; - - - -DOM_NamedNodeMap DOM_DocumentType::getNotations() const -{ - return DOM_NamedNodeMap(((DocumentTypeImpl *)fImpl)->getNotations()); -}; - - -//Introduced in DOM Level 2 - -DOMString DOM_DocumentType::getPublicId() const -{ - return ((DocumentTypeImpl *)fImpl)->getPublicId().clone(); -} - - -DOMString DOM_DocumentType::getSystemId() const -{ - return ((DocumentTypeImpl *)fImpl)->getSystemId().clone(); -} - - -DOMString DOM_DocumentType::getInternalSubset() const -{ - return ((DocumentTypeImpl *)fImpl)->getInternalSubset().clone(); -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_DocumentType.hpp b/src/xercesc/dom/deprecated/DOM_DocumentType.hpp deleted file mode 100644 index 2bdc4e1de5a83b07b23e11a320782aba2567cd40..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_DocumentType.hpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_DocumentType_HEADER_GUARD_ -#define DOM_DocumentType_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DOM_NamedNodeMap; -class DocumentTypeImpl; - -/** - * Each <code>Document</code> has a <code>doctype</code> whose value - * is either <code>null</code> or a <code>DocumentType</code> object. - * - * The <code>DOM_DocumentType</code> class provides access - * to the list of entities and notations that are defined for the document. - * <p>The DOM Level 1 doesn't support editing <code>DocumentType</code> nodes. - */ -class DEPRECATED_DOM_EXPORT DOM_DocumentType: public DOM_Node { - -public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor for DOM_DocumentType. The resulting object does not - * refer to an actual DocumentType node; it will compare == to 0, and is similar - * to a null object reference variable in Java. It may subsequently be - * assigned to refer to the actual DocumentType node. - * <p> - * A new DocumentType node for a document that does not already have one - * can be created by DOM_Document::createDocumentType(). - * - */ - DOM_DocumentType(); - - /** - * Constructor for a null DOM_DocumentType. - * This allows passing 0 directly as a null DOM_DocumentType to - * function calls that take DOM_DocumentType as parameters. - * - * @param nullPointer Must be 0. - */ - DOM_DocumentType(int nullPointer); - - /** - * Copy constructor. Creates a new <code>DOM_Comment</code> that refers to the - * same underlying node as the original. - * - * - * @param other The object to be copied. - */ - DOM_DocumentType(const DOM_DocumentType &other); - - - /** - * Assignment operator. - * - * @param other The object to be copied. - */ - DOM_DocumentType & operator = (const DOM_DocumentType &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_DocumentType & operator = (const DOM_NullPtr *val); - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_DocumentType. The object being destroyed is the reference - * object, not the underlying DocumentType node itself. - * - */ - ~DOM_DocumentType(); - //@} - - /** @name Getter functions. */ - //@{ - /** - * The name of DTD; i.e., the name immediately following the - * <code>DOCTYPE</code> keyword in an XML source document. - */ - DOMString getName() const; - - /** - * This function returns a <code>NamedNodeMap</code> containing the general entities, both - * external and internal, declared in the DTD. Parameter entities are not contained. - * Duplicates are discarded. - * <p> - * Note: this functionality is not implemented in the initial release - * of the parser, and the returned NamedNodeMap will be empty. - */ - DOM_NamedNodeMap getEntities() const; - - - /** - * This function returns a named node map containing an entry for - * each notation declared in a document's DTD. Duplicates are discarded. - * - * <p> - * Note: this functionality is not implemented in the initial release - * of the parser, and the returned NamedNodeMap will be empty. - */ - DOM_NamedNodeMap getNotations() const; - //@} - - /** @name Functions introduced in DOM Level 2. */ - //@{ - /** - * Get the public identifier of the external subset. - * - * @return The public identifier of the external subset. - */ - DOMString getPublicId() const; - - /** - * Get the system identifier of the external subset. - * - * @return The system identifier of the external subset. - */ - DOMString getSystemId() const; - - /** - * Get the internal subset as a string. - * - * @return The internal subset as a string. - */ - DOMString getInternalSubset() const; - //@} - -protected: - DOM_DocumentType(DocumentTypeImpl *); - - friend class DOM_Document; - friend class DOM_DOMImplementation; -}; - -XERCES_CPP_NAMESPACE_END - -#endif - - diff --git a/src/xercesc/dom/deprecated/DOM_Element.cpp b/src/xercesc/dom/deprecated/DOM_Element.cpp deleted file mode 100644 index 8debd8b15409ee968f54ba76c416d2c3b2ce3bcf..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Element.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_Element.hpp" -#include "DOM_Attr.hpp" -#include "DOM_NodeList.hpp" -#include "ElementImpl.hpp" -#include "DeepNodeListImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_Element::DOM_Element() -: DOM_Node(null) -{ -}; - - -DOM_Element::DOM_Element(const DOM_Element & other) -: DOM_Node(other) -{ -}; - - -DOM_Element::DOM_Element(ElementImpl *impl) : - DOM_Node(impl) -{ -}; - - -DOM_Element::~DOM_Element() -{ -}; - - -DOM_Element & DOM_Element::operator = (const DOM_Element & other) -{ - return (DOM_Element &) DOM_Node::operator = (other); -}; - - -DOM_Element & DOM_Element::operator = (const DOM_NullPtr *other) -{ - return (DOM_Element &) DOM_Node::operator = (other); -}; - - -DOMString DOM_Element::getTagName() const -{ - return ((ElementImpl *)fImpl)->getTagName().clone(); -}; - - -DOMString DOM_Element::getAttribute(const DOMString &name) const -{ - return ((ElementImpl *)fImpl)->getAttribute(name).clone(); -}; - - -void DOM_Element::setAttribute(const DOMString &name, - const DOMString &value) -{ - ((ElementImpl *)fImpl)->setAttribute(name, value); -}; - - - -void DOM_Element::removeAttribute(const DOMString &name) -{ - ((ElementImpl *)fImpl)->removeAttribute(name); -}; - - -DOM_Attr DOM_Element::getAttributeNode(const DOMString &name) const -{ - return DOM_Attr(((ElementImpl *)fImpl)->getAttributeNode(name)); -}; - - -DOM_Attr DOM_Element::setAttributeNode(DOM_Attr newAttr) -{ - return DOM_Attr(((ElementImpl *)fImpl)-> - setAttributeNode((AttrImpl *)newAttr.fImpl)); -}; - - -DOM_Attr DOM_Element::removeAttributeNode(DOM_Attr oldAttr) -{ - return DOM_Attr(((ElementImpl *)fImpl)-> - removeAttributeNode((AttrImpl *)oldAttr.fImpl)); -}; - - -DOM_NodeList DOM_Element::getElementsByTagName(const DOMString &name) const -{ - return DOM_NodeList(((ElementImpl *)fImpl)->getElementsByTagName(name)); - -}; - - -//Introduced in DOM Level 2 - -DOMString DOM_Element::getAttributeNS(const DOMString &namespaceURI, - const DOMString &localName) const -{ - return ((ElementImpl *)fImpl)->getAttributeNS(namespaceURI, localName).clone(); -} - -void DOM_Element::setAttributeNS(const DOMString &namespaceURI, - const DOMString &qualifiedName, const DOMString &value) -{ - ((ElementImpl *)fImpl)->setAttributeNS(namespaceURI, qualifiedName, value); -} - - -void DOM_Element::removeAttributeNS(const DOMString &namespaceURI, - const DOMString &localName) -{ - ((ElementImpl *)fImpl)->removeAttributeNS(namespaceURI, localName); -} - - -DOM_Attr DOM_Element::getAttributeNodeNS(const DOMString &namespaceURI, - const DOMString &localName) const -{ - return DOM_Attr(((ElementImpl *)fImpl)->getAttributeNodeNS(namespaceURI, localName)); -} - - -DOM_Attr DOM_Element::setAttributeNodeNS(DOM_Attr newAttr) -{ - return DOM_Attr(((ElementImpl *)fImpl)-> - setAttributeNodeNS((AttrImpl *)newAttr.fImpl)); -} - - -DOM_NodeList DOM_Element::getElementsByTagNameNS(const DOMString &namespaceURI, - const DOMString &localName) const -{ - return DOM_NodeList(((ElementImpl *)fImpl)->getElementsByTagNameNS(namespaceURI, - localName)); -} - - -bool DOM_Element::hasAttributes() const -{ - return ((ElementImpl *)fImpl)->hasAttributes(); -}; - - -bool DOM_Element::hasAttribute(const DOMString &name) const -{ - return ((ElementImpl *)fImpl)->hasAttribute(name); -}; - - -bool DOM_Element::hasAttributeNS(const DOMString &namespaceURI, - const DOMString &localName) const -{ - return ((ElementImpl *)fImpl)->hasAttributeNS(namespaceURI, localName); -} - - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_Element.hpp b/src/xercesc/dom/deprecated/DOM_Element.hpp deleted file mode 100644 index ba1d578f54ff30ddefcb5b8f13e2a4b580b11ac0..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Element.hpp +++ /dev/null @@ -1,412 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_Element_HEADER_GUARD_ -#define DOM_Element_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DOM_Attr; -class DOM_NodeList; -class ElementImpl; - -/** - * By far the vast majority of objects (apart from text) that authors - * encounter when traversing a document are <code>DOM_Element</code> nodes. - * - * Assume the following XML document:<elementExample id="demo"> - * <subelement1/> - * <subelement2><subsubelement/></subelement2> - * </elementExample> - * <p>When represented using DOM, the top node is an <code>DOM_Element</code> node - * for "elementExample", which contains two child <code>DOM_Element</code> nodes, - * one for "subelement1" and one for "subelement2". "subelement1" contains no - * child nodes. - * <p>Elements may have attributes associated with them; since the - * <code>DOM_Element</code> interface inherits from <code>DOM_Node</code>, the generic - * <code>DOM_Node</code> interface method <code>getAttributes</code> may be used - * to retrieve the set of all attributes for an element. There are methods on - * the <code>DOM_Element</code> interface to retrieve either an <code>DOM_Attr</code> - * object by name or an attribute value by name. In XML, where an attribute - * value may contain entity references, an <code>DOM_Attr</code> object should be - * retrieved to examine the possibly fairly complex sub-tree representing the - * attribute value. On the other hand, in HTML, where all attributes have - * simple string values, methods to directly access an attribute value can - * safely be used as a convenience. - */ - -class DEPRECATED_DOM_EXPORT DOM_Element: public DOM_Node { -private: - -public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor for DOM_Element. The resulting object does not - * refer to an actual Element node; it will compare == to 0, and is similar - * to a null object reference variable in Java. It may subsequently be - * assigned to refer to an actual Element node. - * <p> - * New comment nodes are created by DOM_Document::createElement(). - * - */ - DOM_Element(); - - /** - * Copy constructor. Creates a new <code>DOM_Element</code> that refers to the - * same underlying actual element as the original. - * - * @param other The object to be copied - */ - DOM_Element(const DOM_Element &other); - - /** - * Assignment operator. - * - * @param other The object to be copied. - */ - DOM_Element & operator = (const DOM_Element &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_Element & operator = (const DOM_NullPtr *val); - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor. The object being destroyed is the reference - * object, not the underlying Element itself. - * - */ - ~DOM_Element(); - //@} - /** @name Getter functions. */ - //@{ - - /** - * The name of the element. - * - * For example, in: <elementExample - * id="demo"> ... </elementExample> , <code>tagName</code> has - * the value <code>"elementExample"</code>. Note that this is - * case-preserving in XML, as are all of the operations of the DOM. - */ - DOMString getTagName() const; - - /** - * Retrieves an attribute value by name. - * - * @param name The name of the attribute to retrieve. - * @return The <code>DOM_Attr</code> value as a string, or the empty string if - * that attribute does not have a specified or default value. - */ - DOMString getAttribute(const DOMString &name) const; - - /** - * Retrieves an <code>DOM_Attr</code> node by name. - * - * @param name The name (<CODE>nodeName</CODE>) of the attribute to retrieve. - * @return The <code>DOM_Attr</code> node with the specified name (<CODE>nodeName</CODE>) or - * <code>null</code> if there is no such attribute. - */ - DOM_Attr getAttributeNode(const DOMString &name) const; - - /** - * Returns a <code>NodeList</code> of all descendant elements with a given - * tag name, in the order in which they would be encountered in a preorder - * traversal of the <code>DOM_Element</code> tree. - * - * @param name The name of the tag to match on. The special value "*" - * matches all tags. - * @return A list of matching <code>DOM_Element</code> nodes. - */ - DOM_NodeList getElementsByTagName(const DOMString &name) const; - - //@} - /** @name Set functions. */ - //@{ - - /** - * Adds a new attribute. - * - * If an attribute with that name is already present - * in the element, its value is changed to be that of the value parameter. - * This value is a simple string, it is not parsed as it is being set. So - * any markup (such as syntax to be recognized as an entity reference) is - * treated as literal text, and needs to be appropriately escaped by the - * implementation when it is written out. In order to assign an attribute - * value that contains entity references, the user must create an - * <code>DOM_Attr</code> node plus any <code>Text</code> and - * <code>EntityReference</code> nodes, build the appropriate subtree, and - * use <code>setAttributeNode</code> to assign it as the value of an - * attribute. - * @param name The name of the attribute to create or alter. - * @param value Value to set in string form. - * @exception DOMException - * INVALID_CHARACTER_ERR: Raised if the specified name contains an - * illegal character. - * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - */ - void setAttribute(const DOMString &name, - const DOMString &value); - /** - * Adds a new attribute. - * - * If an attribute with that name (<CODE>nodeName</CODE>) is already present - * in the element, it is replaced by the new one. - * @param newAttr The <code>DOM_Attr</code> node to add to the attribute list. - * @return If the <code>newAttr</code> attribute replaces an existing - * attribute, the replaced - * <code>DOM_Attr</code> node is returned, otherwise <code>null</code> is - * returned. - * @exception DOMException - * WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a - * different document than the one that created the element. - * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an - * attribute of another <code>DOM_Element</code> object. The DOM user must - * explicitly clone <code>DOM_Attr</code> nodes to re-use them in other - * elements. - */ - DOM_Attr setAttributeNode(DOM_Attr newAttr); - - //@} - /** @name Functions which modify the Element. */ - //@{ - /** - * Removes the specified attribute node. - * If the removed <CODE>DOM_Attr</CODE> - * has a default value it is immediately replaced. The replacing attribute - * has the same namespace URI and local name, as well as the original prefix, - * when applicable. - * - * @param oldAttr The <code>DOM_Attr</code> node to remove from the attribute - * list. - * @return The <code>DOM_Attr</code> node that was removed. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - * <br>NOT_FOUND_ERR: Raised if <code>oldAttr</code> is not an attribute - * of the element. - */ - DOM_Attr removeAttributeNode(DOM_Attr oldAttr); - - /** - * Removes an attribute by name. - * - * If the removed attribute - * is known to have a default value, an attribute immediately appears - * containing the default value as well as the corresponding namespace URI, - * local name, and prefix when applicable.<BR>To remove an attribute by local - * name and namespace URI, use the <CODE>removeAttributeNS</CODE> method. - * @param name The name of the attribute to remove. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - */ - void removeAttribute(const DOMString &name); - - //@} - /** @name Functions introduced in DOM Level 2. */ - //@{ - - /** - * Retrieves an attribute value by local name and namespace URI. - * - * @param namespaceURI The <em>namespace URI</em> of - * the attribute to retrieve. - * @param localName The <em>local name</em> of the - * attribute to retrieve. - * @return The <code>DOM_Attr</code> value as a string, or an <CODE>null</CODE> if - * that attribute does not have a specified or default value. - */ - DOMString getAttributeNS(const DOMString &namespaceURI, - const DOMString &localName) const; - - /** - * Adds a new attribute. If an attribute with the same - * local name and namespace URI is already present on the element, its prefix - * is changed to be the prefix part of the <CODE>qualifiedName</CODE>, and - * its value is changed to be the <CODE>value</CODE> parameter. This value is - * a simple string, it is not parsed as it is being set. So any markup (such - * as syntax to be recognized as an entity reference) is treated as literal - * text, and needs to be appropriately escaped by the implementation when it - * is written out. In order to assign an attribute value that contains entity - * references, the user must create an <CODE>DOM_Attr</CODE> - * node plus any <CODE>DOM_Text</CODE> and <CODE>DOM_EntityReference</CODE> - * nodes, build the appropriate subtree, and use - * <CODE>setAttributeNodeNS</CODE> or <CODE>setAttributeNode</CODE> to assign - * it as the value of an attribute. - * - * @param namespaceURI The <em>namespace URI</em> of - * the attribute to create or alter. - * @param qualifiedName The <em>qualified name</em> of the - * attribute to create or alter. - * @param value The value to set in string form. - * @exception DOMException - * INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an - * illegal character. - * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - * <br> - * NAMESPACE_ERR: Raised if the <CODE>qualifiedName</CODE> is - * malformed, if the <CODE>qualifiedName</CODE> has a prefix and the - * <CODE>namespaceURI</CODE> is <CODE>null</CODE> or an empty string, - * if the <CODE>qualifiedName</CODE> has a prefix that is "xml" and the - * <CODE>namespaceURI</CODE> is different from - * "http://www.w3.org/XML/1998/namespace", if the - * <CODE>qualifiedName</CODE> has a prefix that is "xmlns" and the - * <CODE>namespaceURI</CODE> is different from - * "http://www.w3.org/2000/xmlns/", or if the - * <CODE>qualifiedName</CODE> is "xmlns" and the - * <CODE>namespaceURI</CODE> is different from - * "http://www.w3.org/2000/xmlns/". - */ - void setAttributeNS(const DOMString &namespaceURI, - const DOMString &qualifiedName, const DOMString &value); - - /** - * Removes an attribute by local name and namespace URI. If the - * removed attribute has a default value it is immediately replaced. - * The replacing attribute has the same namespace URI and local name, as well as - * the original prefix. - * - * @param namespaceURI The <em>namespace URI</em> of - * the attribute to remove. - * @param localName The <em>local name</em> of the - * attribute to remove. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - */ - void removeAttributeNS(const DOMString &namespaceURI, - const DOMString &localName); - - /** - * Retrieves an <code>DOM_Attr</code> node by local name and namespace URI. - * - * @param namespaceURI The <em>namespace URI</em> of - * the attribute to retrieve. - * @param localName The <em>local name</em> of the - * attribute to retrieve. - * @return The <code>DOM_Attr</code> node with the specified attribute local - * name and namespace URI or <code>null</code> if there is no such attribute. - */ - DOM_Attr getAttributeNodeNS(const DOMString &namespaceURI, - const DOMString &localName) const; - - /** - * Adds a new attribute. - * - * If an attribute with that local name and namespace URI is already present - * in the element, it is replaced by the new one. - * - * @param newAttr The <code>DOM_Attr</code> node to add to the attribute list. - * @return If the <code>newAttr</code> attribute replaces an existing - * attribute with the same <em>local name</em> and <em>namespace URI</em>, - * the replaced <code>DOM_Attr</code> node is - * returned, otherwise <code>null</code> is returned. - * @exception DOMException - * WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a - * different document than the one that created the element. - * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an - * attribute of another <code>DOM_Element</code> object. The DOM user must - * explicitly clone <code>DOM_Attr</code> nodes to re-use them in other - * elements. - */ - DOM_Attr setAttributeNodeNS(DOM_Attr newAttr); - - /** - * Returns a <code>DOM_NodeList</code> of all the <code>DOM_Element</code>s - * with a given local name and namespace URI in the order in which they - * would be encountered in a preorder traversal of the - * <code>DOM_Document</code> tree, starting from this node. - * - * @param namespaceURI The <em>namespace URI</em> of - * the elements to match on. The special value "*" matches all - * namespaces. - * @param localName The <em>local name</em> of the - * elements to match on. The special value "*" matches all local names. - * @return A new <code>DOM_NodeList</code> object containing all the matched - * <code>DOM_Element</code>s. - */ - DOM_NodeList getElementsByTagNameNS(const DOMString &namespaceURI, - const DOMString &localName) const; - - /** - * Returns whether this node (if it is an element) has any attributes. - * @return <code>true</code> if this node has any attributes, - * <code>false</code> otherwise. - */ - bool hasAttributes() const; - - /** - * Returns <code>true</code> when an attribute with a given name is - * specified on this element or has a default value, <code>false</code> - * otherwise. - * @param name The name of the attribute to look for. - * @return <code>true</code> if an attribute with the given name is - * specified on this element or has a default value, <code>false</code> - * otherwise. - */ - bool hasAttribute(const DOMString &name) const; - - /** - * Returns <code>true</code> when an attribute with a given local name and - * namespace URI is specified on this element or has a default value, - * <code>false</code> otherwise. HTML-only DOM implementations do not - * need to implement this method. - * @param namespaceURI The namespace URI of the attribute to look for. - * @param localName The local name of the attribute to look for. - * @return <code>true</code> if an attribute with the given local name - * and namespace URI is specified or has a default value on this - * element, <code>false</code> otherwise. - * @since DOM Level 2 - */ - bool hasAttributeNS(const DOMString &namespaceURI, - const DOMString &localName) const; - - //@} - - protected: - DOM_Element(ElementImpl *impl); - - friend class DOM_Document; - friend class DOM_Attr; -}; - -XERCES_CPP_NAMESPACE_END - -#endif - - diff --git a/src/xercesc/dom/deprecated/DOM_Entity.cpp b/src/xercesc/dom/deprecated/DOM_Entity.cpp deleted file mode 100644 index 942c90a5c406caa92e23a91b0b25e8a6a71d9b69..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Entity.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_Entity.hpp" -#include "EntityImpl.hpp" -#include "DOM_NodeList.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_Entity::DOM_Entity() -: DOM_Node(null) -{ -}; - - -DOM_Entity::DOM_Entity(const DOM_Entity & other) -: DOM_Node(other) -{ -}; - - -DOM_Entity::DOM_Entity(EntityImpl *impl) : - DOM_Node(impl) -{ -}; - - -DOM_Entity::~DOM_Entity() -{ -}; - - -DOM_Entity & DOM_Entity::operator = (const DOM_Entity & other) -{ - return (DOM_Entity &) DOM_Node::operator = (other); -}; - - -DOM_Entity & DOM_Entity::operator = (const DOM_NullPtr *other) -{ - return (DOM_Entity &) DOM_Node::operator = (other); -}; - - -DOMString DOM_Entity::getPublicId() const -{ - return ((EntityImpl *)fImpl)->getPublicId().clone(); -}; - -DOMString DOM_Entity::getSystemId() const -{ - return ((EntityImpl *)fImpl)->getSystemId().clone(); -}; - - -DOMString DOM_Entity::getNotationName() const -{ - return ((EntityImpl *)fImpl)->getNotationName().clone(); -}; - -DOM_Node DOM_Entity::getFirstChild() const -{ - return DOM_Node( ((EntityImpl*)fImpl)->getFirstChild()); -}; - -DOM_Node DOM_Entity::getLastChild() const -{ - return DOM_Node(((EntityImpl*)fImpl)->getLastChild()); -}; - -DOM_NodeList DOM_Entity::getChildNodes() const -{ - return DOM_NodeList((EntityImpl*)fImpl); -}; - -bool DOM_Entity::hasChildNodes() const -{ - return ((EntityImpl*)fImpl)->hasChildNodes(); -}; - -DOM_Node DOM_Entity::getPreviousSibling() const -{ - return DOM_Node(((EntityImpl*)fImpl)->getPreviousSibling()); -}; - - -DOM_Node DOM_Entity::getNextSibling() const -{ - return DOM_Node(((EntityImpl*)fImpl)->getNextSibling()); -}; - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_Entity.hpp b/src/xercesc/dom/deprecated/DOM_Entity.hpp deleted file mode 100644 index bfac31b5c6a91d92fd0f0fd6aede89660dd5b5f9..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Entity.hpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_Entity_HEADER_GUARD_ -#define DOM_Entity_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class EntityImpl; - -/** - * This interface represents an entity, either parsed or unparsed, in an XML - * document. - * - * Note that this models the entity itself not the entity - * declaration. <code>Entity</code> declaration modeling has been left for a - * later Level of the DOM specification. - * <p>The <code>nodeName</code> attribute that is inherited from - * <code>Node</code> contains the name of the entity. - * <p>An XML processor may choose to completely expand entities before the - * structure model is passed to the DOM; in this case there will be no - * <code>EntityReference</code> nodes in the document tree. - * - * <p>Note: the first release of this parser does not create entity - * nodes when reading an XML document. Entities may be - * programatically created using DOM_Document::createEntity(). - */ -class DEPRECATED_DOM_EXPORT DOM_Entity: public DOM_Node { -public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor for DOM_Entity. - * - */ - DOM_Entity(); - - /** - * Copy constructor. - * - * @param other The object to be copied. - */ - DOM_Entity(const DOM_Entity &other); - - /** - * Assignment operator. - * - * @param other The object to be copied. - */ - DOM_Entity & operator = (const DOM_Entity &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_Entity & operator = (const DOM_NullPtr *val); - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_Entity. - * - */ - ~DOM_Entity(); - - //@} - /** @name Get functions. */ - //@{ - /** - * The public identifier associated with the entity, if specified. - * - * If the public identifier was not specified, this is <code>null</code>. - */ - DOMString getPublicId() const; - - /** - * The system identifier associated with the entity, if specified. - * - * If the system identifier was not specified, this is <code>null</code>. - */ - DOMString getSystemId() const; - - /** - * For unparsed entities, the name of the notation for the entity. - * - * For parsed entities, this is <code>null</code>. - */ - DOMString getNotationName() const; - - DOM_Node getFirstChild() const; - DOM_Node getLastChild() const; - DOM_NodeList getChildNodes() const; - bool hasChildNodes() const; - DOM_Node getPreviousSibling() const; - DOM_Node getNextSibling() const; - //@} - -protected: - DOM_Entity(EntityImpl *impl); - - friend class DOM_Document; -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/DOM_EntityReference.cpp b/src/xercesc/dom/deprecated/DOM_EntityReference.cpp deleted file mode 100644 index 82f628e7a786f3dc008187037048da4cb3da8dd7..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_EntityReference.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_EntityReference.hpp" -#include "EntityReferenceImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_EntityReference::DOM_EntityReference() -: DOM_Node(null) -{ -}; - - -DOM_EntityReference::DOM_EntityReference(const DOM_EntityReference & other) -: DOM_Node(other) -{ -}; - - -DOM_EntityReference::DOM_EntityReference(EntityReferenceImpl *impl) : - DOM_Node(impl) -{ -}; - - -DOM_EntityReference::~DOM_EntityReference() -{ -}; - - -DOM_EntityReference & DOM_EntityReference::operator = (const DOM_EntityReference & other) -{ - return (DOM_EntityReference &) DOM_Node::operator = (other); -}; - - -DOM_EntityReference & DOM_EntityReference::operator = (const DOM_NullPtr *other) -{ - return (DOM_EntityReference &) DOM_Node::operator = (other); -}; - - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_EntityReference.hpp b/src/xercesc/dom/deprecated/DOM_EntityReference.hpp deleted file mode 100644 index 4dede89f8d7105fd27a3068e4af22c40ae1bb83f..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_EntityReference.hpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_EntityReference_HEADER_GUARD_ -#define DOM_EntityReference_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class EntityReferenceImpl; - -/** - * <code>EntityReference</code> nodes will appear in the structure - * model when an entity reference is in the source document, or when the user - * wishes to insert an entity reference. - * - * The expansion of the entity will appear as child nodes of the entity - * reference node. The expansion may be just simple text, or it may - * be more complex, containing additional entity refs. - * -*/ - -class DEPRECATED_DOM_EXPORT DOM_EntityReference: public DOM_Node { -public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor for DOM_EntityReference. The resulting object does not - * refer to an actual Entity Reference node; it will compare == to 0, and is similar - * to a null object reference variable in Java. It may subsequently be - * assigned to refer to an actual entity reference node. - * <p> - * New entity reference nodes are created by DOM_Document::createEntityReference(). - * - */ - DOM_EntityReference(); - - /** - * Copy constructor. Creates a new <code>DOM_EntityReference</code> that refers to the - * same underlying node as the original. - * - * @param other The object to be copied. - */ - DOM_EntityReference(const DOM_EntityReference &other); - - /** - * Assignment operator. - * - * @param other The object to be copied. - */ - DOM_EntityReference & operator = (const DOM_EntityReference &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_EntityReference & operator = (const DOM_NullPtr *val); - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_EntityReference. The object being destroyed is the reference - * object, not the underlying entity reference node itself. - * - */ - ~DOM_EntityReference(); - //@} - -protected: - DOM_EntityReference(EntityReferenceImpl *impl); - - friend class DOM_Document; -}; - -XERCES_CPP_NAMESPACE_END - -#endif - - diff --git a/src/xercesc/dom/deprecated/DOM_NamedNodeMap.cpp b/src/xercesc/dom/deprecated/DOM_NamedNodeMap.cpp deleted file mode 100644 index d60b5f03aa124e6ad1e6f3b62cce9f85697add55..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_NamedNodeMap.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_Node.hpp" -#include "DOM_NamedNodeMap.hpp" -#include "NamedNodeMapImpl.hpp" -#include "ElementImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - - -const unsigned short DOM_NamedNodeMap::NNM_ELEMENT = 0; -const unsigned short DOM_NamedNodeMap::NNM_OTHER = 1; - - -DOM_NamedNodeMap::DOM_NamedNodeMap() -{ - fImpl = 0; - flagElem = NNM_OTHER; -} - - -DOM_NamedNodeMap::DOM_NamedNodeMap(const DOM_NamedNodeMap & other) -{ - this->fImpl = other.fImpl; - this->flagElem = other.flagElem; - (other.flagElem == NNM_ELEMENT) ? NodeImpl::addRef((NodeImpl *)fImpl) : - NamedNodeMapImpl::addRef((NamedNodeMapImpl *)fImpl); -} - - -DOM_NamedNodeMap::DOM_NamedNodeMap(NamedNodeMapImpl *impl) -{ - fImpl = impl; - flagElem = NNM_OTHER; - if (impl != null) - NamedNodeMapImpl::addRef((NamedNodeMapImpl *)fImpl); -} - -DOM_NamedNodeMap::DOM_NamedNodeMap(NodeImpl *impl) -{ - fImpl = impl; - flagElem = NNM_ELEMENT; - NodeImpl::addRef((NodeImpl *)fImpl); -} - - -DOM_NamedNodeMap::~DOM_NamedNodeMap() -{ - (flagElem == NNM_OTHER) ? NamedNodeMapImpl::removeRef((NamedNodeMapImpl *)fImpl) : - NodeImpl::removeRef((NodeImpl *)fImpl); -} - -bool DOM_NamedNodeMap::operator == (const DOM_NamedNodeMap &other) const -{ - return this->fImpl == other.fImpl; -} - - -bool DOM_NamedNodeMap::operator != (const DOM_NamedNodeMap &other) const -{ - return this->fImpl != other.fImpl; -} - - -bool DOM_NamedNodeMap::operator == (const DOM_NullPtr * /*p*/) const -{ - return this->fImpl == 0; -} - - -bool DOM_NamedNodeMap::operator != (const DOM_NullPtr * /*p*/) const -{ - return this->fImpl != 0; -} - - -DOM_NamedNodeMap & DOM_NamedNodeMap::operator = (const DOM_NamedNodeMap & other) -{ - if (this->fImpl != other.fImpl) - { - // update reference counts and change pointers - (flagElem == NNM_OTHER) ? NamedNodeMapImpl::removeRef((NamedNodeMapImpl *)fImpl) : NodeImpl::removeRef((NodeImpl *)fImpl); - - this->fImpl = other.fImpl; - this->flagElem = other.flagElem; - - (flagElem == NNM_OTHER) ? NamedNodeMapImpl::addRef((NamedNodeMapImpl *)fImpl) : NodeImpl::addRef((NodeImpl *)fImpl); - } - return *this; -} - - -DOM_NamedNodeMap & DOM_NamedNodeMap::operator = (const DOM_NullPtr * /*other*/) -{ - - (flagElem == NNM_OTHER) ? NamedNodeMapImpl::removeRef((NamedNodeMapImpl *)fImpl) : NodeImpl::removeRef((NodeImpl *)fImpl); - this->fImpl = 0; - this->flagElem = NNM_OTHER; - return *this; -} - - -DOM_Node DOM_NamedNodeMap::getNamedItem(const DOMString &name) const -{ - return (flagElem == NNM_OTHER) ? DOM_Node(((NamedNodeMapImpl *)fImpl)->getNamedItem(name)) : - DOM_Node(((ElementImpl *)fImpl)->NNM_getNamedItem(name)); -} - - -DOM_Node DOM_NamedNodeMap::setNamedItem(DOM_Node arg) -{ - return (flagElem == NNM_OTHER) ? DOM_Node(((NamedNodeMapImpl *)fImpl)->setNamedItem(arg.fImpl)) : - DOM_Node(((ElementImpl *)fImpl)->NNM_setNamedItem(arg.fImpl)); -} - - -DOM_Node DOM_NamedNodeMap::removeNamedItem(const DOMString &name) -{ - return (flagElem == NNM_OTHER) ? DOM_Node(((NamedNodeMapImpl *)fImpl)->removeNamedItem(name)) : - DOM_Node(((ElementImpl *)fImpl)->NNM_removeNamedItem(name)); -} - - -DOM_Node DOM_NamedNodeMap::item(unsigned int index) const -{ - return (flagElem == NNM_OTHER) ? DOM_Node(((NamedNodeMapImpl *)fImpl)->item(index)) : - DOM_Node(((ElementImpl *)fImpl)->NNM_item(index)); -} - - -unsigned int DOM_NamedNodeMap::getLength() const -{ - return (flagElem == NNM_OTHER) ? ((NamedNodeMapImpl *)fImpl)->getLength() : - ((ElementImpl *)fImpl)->NNM_getLength(); -} - - -//Introduced in DOM Level 2 - -DOM_Node DOM_NamedNodeMap::getNamedItemNS(const DOMString &namespaceURI, - const DOMString &localName) -{ - return (flagElem == NNM_OTHER) ? DOM_Node(((NamedNodeMapImpl *)fImpl)->getNamedItemNS(namespaceURI, localName)) : - DOM_Node(((ElementImpl *)fImpl)->NNM_getNamedItemNS(namespaceURI, localName)); -} - -DOM_Node DOM_NamedNodeMap::setNamedItemNS(DOM_Node arg) -{ - return (flagElem == NNM_OTHER) ? DOM_Node(((NamedNodeMapImpl *)fImpl)->setNamedItemNS(arg.fImpl)) : - DOM_Node(((ElementImpl *)fImpl)->NNM_setNamedItemNS(arg.fImpl)); -} - -DOM_Node DOM_NamedNodeMap::removeNamedItemNS(const DOMString &namespaceURI, - const DOMString &localName) -{ - return (flagElem == NNM_OTHER) ? DOM_Node(((NamedNodeMapImpl *)fImpl)->removeNamedItemNS(namespaceURI, localName)) : - DOM_Node(((ElementImpl *)fImpl)->NNM_removeNamedItemNS(namespaceURI, localName)); -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_NamedNodeMap.hpp b/src/xercesc/dom/deprecated/DOM_NamedNodeMap.hpp deleted file mode 100644 index 8a803ff37f0c41dd54708255d03aa8cc03e744bd..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_NamedNodeMap.hpp +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_NamedNodeMap_HEADER_GUARD_ -#define DOM_NamedNodeMap_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> - -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class NamedNodeMapImpl; - -/** -* <code>NamedNodeMap</code>s are used to -* represent collections of nodes that can be accessed by name. -* -* Note that <code>NamedNodeMap</code> does not inherit from <code>NodeList</code>; -* <code>NamedNodeMap</code>s are not maintained in any particular order. -* Nodes contained in a <code>NamedNodeMap</code> may -* also be accessed by an ordinal index, but this is simply to allow -* convenient enumeration of the contents, and -* does not imply that the DOM specifies an order to these Nodes. -*/ -class DEPRECATED_DOM_EXPORT DOM_NamedNodeMap { -private: - void *fImpl; - short flagElem; - - static const unsigned short NNM_ELEMENT; - static const unsigned short NNM_OTHER; - -public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor for DOM_NamedNodeMap. The resulting object does not - * refer to an actual DOM_NamedNodeMap node; it will compare == to 0, and is similar - * to a null object reference variable in Java. NamedNopes are instantiated - * by these methods: DOM_Node::getAttributes, DOM_DocumentType::getEntities - * andDOM_DocumentType::getNotations - * - */ - DOM_NamedNodeMap(); - - /** - * Copy constructor. Creates a new <code>DOM_NamedNodeMap</code> reference object - * that refers to the same underlying NamedNodeMap as the original. - * - * @param other The object to be copied. - */ - DOM_NamedNodeMap(const DOM_NamedNodeMap &other); - - /** - * Assignment operator. - * - * @param other The object to be copied. - */ - DOM_NamedNodeMap & operator = (const DOM_NamedNodeMap &other); - - /** - * Assignment operator. - * - * @param other The object to be copied. - */ - DOM_NamedNodeMap & operator = (const DOM_NullPtr *other); - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_NamedNodeMap. The object being destroyed is the reference - * object, not the underlying NamedNodeMap itself. - * - * <p>Like most other DOM types in this implementation, memory management - * of named node maps is automatic. Instances of DOM_NamedNodeMap function - * as references to an underlying heap based implementation object, - * and should never be explicitly new-ed or deleted in application code, but - * should appear only as local variables or function parameters. - * - */ - ~DOM_NamedNodeMap(); - - //@} - - /** @Comparisons. */ - //@{ - /** - * Test whether this NamedNodeMap reference refers to the same underlying - * named node map as the other reference object. This does not - * compare the contents of two different objects. - * - * @param other The value to be compared - * @return Returns true if the underlying named node map is same - */ - bool operator == (const DOM_NamedNodeMap &other) const; - - /** - * Test whether this NamedNodeMap reference refers to a different underlying - * named node map as the other reference object. This does not - * compare the contents of two different objects. - * - * @param other The value to be compared - * @return Returns true if the underlying named node map is different - */ - bool operator != (const DOM_NamedNodeMap &other) const; - - - /** - * Use this comparison operator to test whether a Named Node Map reference - * is null. - * - * @param p The value to be compared, which must be 0 or null. - * @return Returns true if the named node map is null - */ - bool operator == (const DOM_NullPtr *p) const; - - /** - * Use this comparison operator to test whether a Named Node Map reference - * is not null. - * - * @param p The value to be compared, which must not be 0 or null. - * @return Returns true if the named node map is not null - */ - bool operator != (const DOM_NullPtr *p) const; - - //@} - - /** @name Set functions. */ - //@{ - - /** - * Adds a node using its <code>nodeName</code> attribute. - * - * <br>As the <code>nodeName</code> attribute is used to derive the name - * which the node must be stored under, multiple nodes of certain types - * (those that have a "special" string value) cannot be stored as the names - * would clash. This is seen as preferable to allowing nodes to be aliased. - * @param arg A node to store in a named node map. The node will later be - * accessible using the value of the <code>nodeName</code> attribute of - * the node. If a node with that name is already present in the map, it - * is replaced by the new one. - * @return If the new <code>Node</code> replaces an existing node the - * replaced <code>Node</code> is returned, - * otherwise <code>null</code> is returned. - * @exception DOMException - * WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a - * different document than the one that created the - * <code>NamedNodeMap</code>. - * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this - * <code>NamedNodeMap</code> is readonly. - * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an - * <code>Attr</code> that is already an attribute of another - * <code>Element</code> object. The DOM user must explicitly clone - * <code>Attr</code> nodes to re-use them in other elements. - */ - DOM_Node setNamedItem(DOM_Node arg); - - //@} - /** @name Get functions. */ - //@{ - - /** - * Returns the <code>index</code>th item in the map. - * - * If <code>index</code> - * is greater than or equal to the number of nodes in the map, this returns - * <code>null</code>. - * @param index Index into the map. - * @return The node at the <code>index</code>th position in the - * <code>NamedNodeMap</code>, or <code>null</code> if that is not a valid - * index. - */ - DOM_Node item(unsigned int index) const; - - /** - * Retrieves a node specified by name. - * - * @param name The <code>nodeName</code> of a node to retrieve. - * @return A <code>DOM_Node</code> (of any type) with the specified <code>nodeName</code>, or - * <code>null</code> if it does not identify any node in - * the map. - */ - DOM_Node getNamedItem(const DOMString &name) const; - - /** - * The number of nodes in the map. - * - * The range of valid child node indices is - * 0 to <code>length-1</code> inclusive. - */ - unsigned int getLength() const; - - //@} - /** @name Functions to change the node collection. */ - //@{ - - /** - * Removes a node specified by name. - * - * If the removed node is an - * <code>Attr</code> with a default value it is immediately replaced. - * @param name The <code>nodeName</code> of a node to remove. - * @return The node removed from the map or <code>null</code> if no node - * with such a name exists. - * @exception DOMException - * NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in - * the map. - * <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>NamedNodeMap</code> - * is readonly. - */ - DOM_Node removeNamedItem(const DOMString &name); - - //@} - /** @name Functions introduced in DOM Level 2. */ - //@{ - - /** - * Retrieves a node specified by local name and namespace URI. - * - * @param namespaceURI The <em>namespace URI</em> of - * the node to retrieve. - * @param localName The <em>local name</em> of the node to retrieve. - * @return A <code>DOM_Node</code> (of any type) with the specified - * local name and namespace URI, or <code>null</code> if they do not - * identify any node in the map. - */ - DOM_Node getNamedItemNS(const DOMString &namespaceURI, - const DOMString &localName); - - /** - * Adds a node using its <CODE>namespaceURI</CODE> and <CODE>localName</CODE>. - * - * @param arg A node to store in a named node map. The node will later be - * accessible using the value of the <CODE>namespaceURI</CODE> and - * <CODE>localName</CODE> attribute of the node. If a node with those - * namespace URI and local name is already present in the map, it is - * replaced by the new one. - * @return If the new <code>DOM_Node</code> replaces an existing node the - * replaced <code>DOM_Node</code> is returned, - * otherwise <code>null</code> is returned. - * @exception DOMException - * WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a - * different document than the one that created the - * <code>DOM_NamedNodeMap</code>. - * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this - * <code>vNamedNodeMap</code> is readonly. - * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an - * <code>DOM_Attr</code> that is already an attribute of another - * <code>DOM_Element</code> object. The DOM user must explicitly clone - * <code>DOM_Attr</code> nodes to re-use them in other elements. - */ - DOM_Node setNamedItemNS(DOM_Node arg); - - /** - * Removes a node specified by local name and namespace URI. - * - * @param namespaceURI The <em>namespace URI</em> of - * the node to remove. - * @param localName The <em>local name</em> of the - * node to remove. When this <code>DOM_NamedNodeMap</code> contains the - * attributes attached to an element, as returned by the attributes - * attribute of the <code>DOM_Node</code> interface, if the removed - * attribute is known to have a default value, an attribute - * immediately appears containing the default value - * as well as the corresponding namespace URI, local name, and prefix. - * @return The node removed from the map if a node with such a local name - * and namespace URI exists. - * @exception DOMException - * NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in - * the map. - * <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>DOM_NamedNodeMap</code> - * is readonly. - */ - DOM_Node removeNamedItemNS(const DOMString &namespaceURI, - const DOMString &localName); - - //@} - - protected: - - DOM_NamedNodeMap(NamedNodeMapImpl *impl); - DOM_NamedNodeMap(NodeImpl *impl); - - friend class DOM_DocumentType; - friend class DOM_Node; - - -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/DOM_Node.cpp b/src/xercesc/dom/deprecated/DOM_Node.cpp deleted file mode 100644 index 696460383467dcaec65ce41cf1b7e3d7a3b730d5..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Node.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_Node.hpp" -#include "DOM_NodeList.hpp" -#include "DOM_NamedNodeMap.hpp" -#include "DOM_Document.hpp" - -#include "NodeImpl.hpp" -#include <assert.h> - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_Node::DOM_Node() -{ - fImpl = null; -} - - -DOM_Node::DOM_Node(NodeImpl *impl) -{ - fImpl = impl; - RefCountedImpl::addRef(fImpl); -} - - -DOM_Node::DOM_Node(const DOM_Node &other) -{ - this->fImpl = other.fImpl; - RefCountedImpl::addRef(fImpl); -} - - -DOM_Node & DOM_Node::operator = (const DOM_Node &other) -{ - if (this->fImpl != other.fImpl) - { - RefCountedImpl::removeRef(this->fImpl); - this->fImpl = other.fImpl; - RefCountedImpl::addRef(this->fImpl); - } - return *this; -} - - -DOM_Node & DOM_Node::operator = (const DOM_NullPtr * /*other*/) -{ - RefCountedImpl::removeRef(this->fImpl); - this->fImpl = 0; - return *this; -} - - - -DOM_Node::~DOM_Node() -{ - RefCountedImpl::removeRef (this->fImpl); - fImpl = 0; -} - -// -// Comparison operators. Equivalent of Java object reference == -// Null references compare ==. -// -bool DOM_Node::operator != (const DOM_Node & other) const -{ - return this->fImpl != other.fImpl; -} - - -bool DOM_Node::operator == (const DOM_Node & other) const -{ - return this->fImpl == other.fImpl; -} - -bool DOM_Node::operator != (const DOM_NullPtr * /*other*/) const -{ - return this->fImpl != 0; -} - - -bool DOM_Node::operator == (const DOM_NullPtr * /*other*/) const -{ - return this->fImpl == 0; -} - - - - -DOM_Node DOM_Node::appendChild(const DOM_Node &newChild) -{ - return DOM_Node(fImpl->appendChild(newChild.fImpl)); -} - - -DOM_Node DOM_Node::cloneNode(bool deep) const -{ - return DOM_Node(fImpl->cloneNode(deep)); -} - - -DOMString DOM_Node::getNodeName() const -{ - return fImpl->getNodeName().clone(); -} - - -DOMString DOM_Node::getNodeValue() const -{ - return fImpl->getNodeValue().clone(); -} - - -short DOM_Node::getNodeType() const -{ - return fImpl->getNodeType(); -} - - -DOM_Node DOM_Node::getParentNode() const -{ - return DOM_Node(fImpl->getParentNode()); -} - - -DOM_NodeList DOM_Node::getChildNodes() const -{ - return DOM_NodeList(fImpl); -} - - -DOM_Node DOM_Node::getFirstChild() const -{ - return DOM_Node(fImpl->getFirstChild()); -} - - -DOM_Node DOM_Node::getLastChild() const -{ - return DOM_Node(fImpl->getLastChild()); -} - - -DOM_Node DOM_Node::getPreviousSibling() const -{ - return DOM_Node(fImpl->getPreviousSibling()); -} - - -DOM_Node DOM_Node::getNextSibling() const -{ - return DOM_Node(fImpl->getNextSibling()); -} - - -void *DOM_Node::getUserData() const -{ - return fImpl->getUserData (); -} - -DOM_NamedNodeMap DOM_Node::getAttributes() const -{ - if (getNodeType() == ELEMENT_NODE) - return (fImpl->getAttributes() == null) ? DOM_NamedNodeMap(fImpl) : DOM_NamedNodeMap(fImpl->getAttributes()); - else - return DOM_NamedNodeMap(); -} - - -DOM_Document DOM_Node::getOwnerDocument() const -{ - return fImpl->getOwnerDocument(); -} - - -bool DOM_Node::hasChildNodes() const -{ - return fImpl->hasChildNodes(); -} - - -DOM_Node DOM_Node::insertBefore(const DOM_Node &newChild, const DOM_Node &refChild){ - return DOM_Node(fImpl->insertBefore(newChild.fImpl, refChild.fImpl)); -} - - -bool DOM_Node::isNull() const -{ - return fImpl == null; -} - - -DOM_Node DOM_Node::replaceChild(const DOM_Node &newChild, const DOM_Node &oldChild){ - return DOM_Node(fImpl->replaceChild(newChild.fImpl, oldChild.fImpl)); -} - - -DOM_Node DOM_Node::removeChild(const DOM_Node &oldChild){ - return DOM_Node(fImpl->removeChild(oldChild.fImpl)); -} - - -void DOM_Node::setNodeValue(const DOMString &nodeValue) -{ - fImpl->setNodeValue(nodeValue); -} - - -void DOM_Node::setUserData(void *p) -{ - fImpl->setUserData(p); -} - - -//Introduced in DOM Level 2 - -void DOM_Node::normalize() -{ - fImpl->normalize(); -} - - -bool DOM_Node::isSupported(const DOMString &feature, - const DOMString &version) const -{ - return fImpl->isSupported(feature, version); -} - -DOMString DOM_Node::getNamespaceURI() const -{ - return fImpl->getNamespaceURI().clone(); -} - -DOMString DOM_Node::getPrefix() const -{ - return fImpl->getPrefix().clone(); -} - -DOMString DOM_Node::getLocalName() const -{ - return fImpl->getLocalName().clone(); -} - -void DOM_Node::setPrefix(const DOMString &prefix) -{ - fImpl->setPrefix(prefix); -} - -bool DOM_Node::hasAttributes() const -{ - return fImpl->hasAttributes(); -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_Node.hpp b/src/xercesc/dom/deprecated/DOM_Node.hpp deleted file mode 100644 index 9100261b332a9318f2065b14eb995160f5f1c253..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Node.hpp +++ /dev/null @@ -1,593 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_Node_HEADER_GUARD_ -#define DOM_Node_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOMString.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - -class DOM_NodeList; -class DOM_NamedNodeMap; -class DOM_Document; -class NodeImpl; - -class DOM_NullPtr; // A dummy class, with no implementation, that is - // used as in overloaded functions as a way to - // pass 0 or null. - -/** - * The <code>Node</code> interface is the primary datatype for the entire - * Document Object Model. - * - * It represents a single node in the document tree. - * While all objects implementing the <code>Node</code> interface expose - * methods for dealing with children, not all objects implementing the - * <code>Node</code> interface may have children. For example, - * <code>Text</code> nodes may not have children, and adding children to such - * nodes results in a <code>DOMException</code> being raised. - * <p>The attributes <code>nodeName</code>, <code>nodeValue</code> and - * <code>attributes</code> are included as a mechanism to get at node - * information without casting down to the specific derived interface. In - * cases where there is no obvious mapping of these attributes for a specific - * <code>nodeType</code> (e.g., <code>nodeValue</code> for an Element or - * <code>attributes</code> for a Comment), this returns <code>null</code>. - * Note that the specialized interfaces may contain additional and more - * convenient mechanisms to get and set the relevant information. - */ -class DEPRECATED_DOM_EXPORT DOM_Node { - - public: - /** @name Constructors and assignment operators */ - //@{ - /** - * Default constructor for DOM_Node. The resulting object does not - * refer to an actual node; it will compare == to 0, and is similar - * to a null object reference variable in Java. It may subsequently be - * assigned to refer to an actual node. "Acutal Nodes" will always - * be of some derived type, such as Element or Attr. - * - */ - DOM_Node(); - - /** - * Copy constructor. - * - * @param other The object to be copied. - */ - DOM_Node(const DOM_Node &other); - - /** - * Assignment operator. - * - * @param other The source to be assigned. - */ - DOM_Node & operator = (const DOM_Node &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_Node & operator = (const DOM_NullPtr *val); - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_Node. The object being destroyed is the reference - * object, not the underlying node itself. - * - */ - ~DOM_Node(); - - //@} - /** @name Equality and Inequality operators. */ - //@{ - /** - * The equality operator. This compares to references to nodes, and - * returns true if they both refer to the same underlying node. It - * is exactly analogous to Java's operator == on object reference - * variables. This operator can not be used to compare the values - * of two different nodes in the document tree. - * - * @param other The object reference with which <code>this</code> object is compared - * @returns True if both <code>DOM_Node</code>s refer to the same - * actual node, or are both null; return false otherwise. - */ - bool operator == (const DOM_Node & other)const; - - /** - * Compare with a pointer. Intended only to allow a convenient - * comparison with null. - * - */ - bool operator == (const DOM_NullPtr *other) const; - - /** - * The inequality operator. See operator ==. - * - */ - bool operator != (const DOM_Node & other) const; - - /** - * Compare with a pointer. Intended only to allow a convenient - * comparison with null. - * - */ - bool operator != (const DOM_NullPtr * other) const; - - - 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, - XML_DECL_NODE = 13 - }; - - //@} - /** @name Get functions. */ - //@{ - - /** - * The name of this node, depending on its type; see the table above. - */ - DOMString getNodeName() const; - - /** - * Gets the value of this node, depending on its type. - * - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. - * @exception DOMException - * DOMSTRING_SIZE_ERR: Raised when it would return more characters than - * fit in a <code>DOMString</code> variable on the implementation - * platform. - */ - DOMString getNodeValue() const; - - /** - * An enum value representing the type of the underlying object. - */ - short getNodeType() const; - - /** - * Gets the parent of this node. - * - * All nodes, except <code>Document</code>, - * <code>DocumentFragment</code>, and <code>Attr</code> may have a parent. - * However, if a node has just been created and not yet added to the tree, - * or if it has been removed from the tree, a <code>null</code> DOM_Node - * is returned. - */ - DOM_Node getParentNode() const; - - /** - * Gets a <code>NodeList</code> that contains all children of this node. - * - * If there - * are no children, this is a <code>NodeList</code> containing no nodes. - * The content of the returned <code>NodeList</code> is "live" in the sense - * that, for instance, changes to the children of the node object that - * it was created from are immediately reflected in the nodes returned by - * the <code>NodeList</code> accessors; it is not a static snapshot of the - * content of the node. This is true for every <code>NodeList</code>, - * including the ones returned by the <code>getElementsByTagName</code> - * method. - */ - DOM_NodeList getChildNodes() const; - /** - * Gets the first child of this node. - * - * If there is no such node, this returns <code>null</code>. - */ - DOM_Node getFirstChild() const; - - /** - * Gets the last child of this node. - * - * If there is no such node, this returns <code>null</code>. - */ - DOM_Node getLastChild() const; - - /** - * Gets the node immediately preceding this node. - * - * If there is no such node, this returns <code>null</code>. - */ - DOM_Node getPreviousSibling() const; - - /** - * Gets the node immediately following this node. - * - * If there is no such node, this returns <code>null</code>. - */ - DOM_Node getNextSibling() const; - - /** - * Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it - * is an <code>Element</code>) or <code>null</code> otherwise. - */ - DOM_NamedNodeMap getAttributes() const; - - /** - * Gets the <code>DOM_Document</code> object associated with this node. - * - * This is also - * the <code>DOM_Document</code> object used to create new nodes. When this - * node is a <code>DOM_Document</code> or a <code>DOM_DocumentType</code> - * which is not used with any <code>DOM_Document</code> yet, this is - * <code>null</code>. - * - */ - DOM_Document getOwnerDocument() const; - - /** - * Return the user data pointer. - * - * User data allows application programs - * to attach extra data to DOM nodes, and can be set using the - * function <code>DOM_Node::setUserData(p)</code>. - * @return The user data pointer. - */ - void *getUserData() const; - - //@} - /** @name Cloning function. */ - //@{ - - /** - * Returns a duplicate of this node. - * - * This function serves as a generic copy constructor for nodes. - * - * The duplicate node has no parent ( - * <code>parentNode</code> returns <code>null</code>.). - * <br>Cloning an <code>Element</code> copies all attributes and their - * values, including those generated by the XML processor to represent - * defaulted attributes, but this method does not copy any text it contains - * unless it is a deep clone, since the text is contained in a child - * <code>Text</code> node. Cloning any other type of node simply returns a - * copy of this node. - * @param deep If <code>true</code>, recursively clone the subtree under the - * specified node; if <code>false</code>, clone only the node itself (and - * its attributes, if it is an <code>Element</code>). - * @return The duplicate node. - */ - DOM_Node cloneNode(bool deep) const; - - //@} - /** @name Functions to modify the DOM Node. */ - //@{ - - /** - * Inserts the node <code>newChild</code> before the existing child node - * <code>refChild</code>. - * - * If <code>refChild</code> is <code>null</code>, - * insert <code>newChild</code> at the end of the list of children. - * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object, - * all of its children are inserted, in the same order, before - * <code>refChild</code>. If the <code>newChild</code> is already in the - * tree, it is first removed. Note that a <code>DOM_Node</code> that - * has never been assigned to refer to an actual node is == null. - * @param newChild The node to insert. - * @param refChild The reference node, i.e., the node before which the new - * node must be inserted. - * @return The node being inserted. - * @exception DOMException - * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not - * allow children of the type of the <code>newChild</code> node, or if - * the node to insert is one of this node's ancestors. - * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created - * from a different document than the one that created this node. - * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the node being - * inserted is readonly. - * <br>NOT_FOUND_ERR: Raised if <code>refChild</code> is not a child of - * this node. - */ - DOM_Node insertBefore(const DOM_Node &newChild, - const DOM_Node &refChild); - - - /** - * Replaces the child node <code>oldChild</code> with <code>newChild</code> - * in the list of children, and returns the <code>oldChild</code> node. - * - * If <CODE>newChild</CODE> is a <CODE>DOM_DocumentFragment</CODE> object, - * <CODE>oldChild</CODE> is replaced by all of the <CODE>DOM_DocumentFragment</CODE> - * children, which are inserted in the same order. - * - * If the <code>newChild</code> is already in the tree, it is first removed. - * @param newChild The new node to put in the child list. - * @param oldChild The node being replaced in the list. - * @return The node replaced. - * @exception DOMException - * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not - * allow children of the type of the <code>newChild</code> node, or it - * the node to put in is one of this node's ancestors. - * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created - * from a different document than the one that created this node. - * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the new node is readonly. - * <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of - * this node. - */ - DOM_Node replaceChild(const DOM_Node &newChild, - const DOM_Node &oldChild); - /** - * Removes the child node indicated by <code>oldChild</code> from the list - * of children, and returns it. - * - * @param oldChild The node being removed. - * @return The node removed. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - * <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of - * this node. - */ - DOM_Node removeChild(const DOM_Node &oldChild); - - /** - * Adds the node <code>newChild</code> to the end of the list of children of - * this node. - * - * If the <code>newChild</code> is already in the tree, it is - * first removed. - * @param newChild The node to add.If it is a <code>DocumentFragment</code> - * object, the entire contents of the document fragment are moved into - * the child list of this node - * @return The node added. - * @exception DOMException - * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not - * allow children of the type of the <code>newChild</code> node, or if - * the node to append is one of this node's ancestors. - * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created - * from a different document than the one that created this node. - * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the node being - * appended is readonly. - */ - DOM_Node appendChild(const DOM_Node &newChild); - - //@} - /** @name Query functions. */ - //@{ - - /** - * This is a convenience method to allow easy determination of whether a - * node has any children. - * - * @return <code>true</code> if the node has any children, - * <code>false</code> if the node has no children. - */ - bool hasChildNodes() const; - - - /** - * Test whether this node is null. - * - * This C++ class, <code>DOM_Node<code> - * functions much like an object reference to an underlying Node, and - * this function tests for that reference being null. Several DOM - * APIs, <code>Node.getNextSibling()</code> for example, can return null, and - * this function is used to test for that condition. - * - * <p>Operator == provides another way to perform this null test on a - * DOM_Node. - */ - bool isNull() const; - - //@} - /** @name Set functions. */ - //@{ - - - /** - * Sets the value of the node. - * - * Any node which can have a nodeValue (@see getNodeValue) will - * also accept requests to set it to a string. The exact response to - * this varies from node to node -- Attribute, for example, stores - * its values in its children and has to replace them with a new Text - * holding the replacement value. - * - * For most types of Node, value is null and attempting to set it - * will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will - * also be thrown if the node is read-only. - */ - void setNodeValue(const DOMString &nodeValue); - - /** - * Set the user data for a node. - * - * User data allows application programs - * to attach extra data to DOM nodes, and can be retrieved using the - * function <code>DOM_Node::getUserData(p)</code>. - * <p> - * Deletion of the user data remains the responsibility of the - * application program; it will not be automatically deleted when - * the nodes themselves are reclaimed. - * - * <p> Because DOM_Node is not designed to be subclassed, userdata - * provides an alternative means for extending the the information - * kept with nodes by an application program. - * - * @param p The pointer to be kept with the node. - */ - void setUserData(void *p); - - //@} - /** @name Functions introduced in DOM Level 2. */ - //@{ - - /** - * Puts all <CODE>DOM_Text</CODE> - * nodes in the full depth of the sub-tree underneath this <CODE>DOM_Node</CODE>, - * including attribute nodes, into a "normal" form where only markup (e.g., - * tags, comments, processing instructions, CDATA sections, and entity - * references) separates <CODE>DOM_Text</CODE> - * nodes, i.e., there are neither adjacent <CODE>DOM_Text</CODE> - * nodes nor empty <CODE>DOM_Text</CODE> - * nodes. This can be used to ensure that the DOM view of a document is the - * same as if it were saved and re-loaded, and is useful when operations - * (such as XPointer lookups) that depend on a particular document tree - * structure are to be used. - * <P><B>Note:</B> In cases where the document contains <CODE>DOM_CDATASections</CODE>, - * the normalize operation alone may not be sufficient, since XPointers do - * not differentiate between <CODE>DOM_Text</CODE> - * nodes and <CODE>DOM_CDATASection</CODE> - * nodes.</P> - * - */ - void normalize(); - - /** - * Tests whether the DOM implementation implements a specific - * feature and that feature is supported by this node. - * - * @param feature The string of the feature to test. This is the same - * name as what can be passed to the method <code>hasFeature</code> on - * <code>DOM_DOMImplementation</code>. - * @param version This is the version number of the feature to test. In - * Level 2, version 1, this is the string "2.0". If the version is not - * specified, supporting any version of the feature will cause the - * method to return <code>true</code>. - * @return Returns <code>true</code> if the specified feature is supported - * on this node, <code>false</code> otherwise. - */ - bool isSupported(const DOMString &feature, - const DOMString &version) const; - - /** - * Get the <em>namespace URI</em> of - * this node, or <code>null</code> if it is unspecified. - * <p> - * This is not a computed value that is the result of a namespace lookup - * based on an examination of the namespace declarations in scope. It is - * merely the namespace URI given at creation time. - * <p> - * For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and - * <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method, - * such as <CODE>createElement</CODE> from the <CODE>DOM_Document</CODE> - * interface, this is always <CODE>null</CODE>. - * - */ - DOMString getNamespaceURI() const; - - /** - * Get the <em>namespace prefix</em> - * of this node, or <code>null</code> if it is unspecified. - * - */ - DOMString getPrefix() const; - - /** - * Returns the local part of the <em>qualified name</em> of this node. - * <p> - * For nodes created with a DOM Level 1 method, such as - * <code>createElement</code> from the <code>DOM_Document</code> interface, - * it is null. - * - */ - DOMString getLocalName() const; - - /** - * Set the <em>namespace prefix</em> of this node. - * <p> - * Note that setting this attribute, when permitted, changes - * the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified - * name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE> - * attributes of the <CODE>DOM_Element</CODE> and <CODE>DOM_Attr</CODE> - * interfaces, when applicable. - * <p> - * Note also that changing the prefix of an - * attribute, that is known to have a default value, does not make a new - * attribute with the default value and the original prefix appear, since the - * <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change. - * - * @param prefix The prefix of this node. - * @exception DOMException - * INVALID_CHARACTER_ERR: Raised if the specified prefix contains - * an illegal character. - * <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - * <br> - * NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is - * malformed, if the <CODE>namespaceURI</CODE> of this node is - * <CODE>null</CODE>, if the specified prefix is "xml" and the - * <CODE>namespaceURI</CODE> of this node is different from - * "http://www.w3.org/XML/1998/namespace", if this node is an attribute - * and the specified prefix is "xmlns" and the - * <CODE>namespaceURI</CODE> of this node is different from - * "http://www.w3.org/2000/xmlns/", or if this node is an attribute and - * the <CODE>qualifiedName</CODE> of this node is "xmlns". - */ - void setPrefix(const DOMString &prefix); - - /** - * Returns whether this node (if it is an element) has any attributes. - * @return <code>true</code> if this node has any attributes, - * <code>false</code> otherwise. - */ - bool hasAttributes() const; - - //@} - -protected: - NodeImpl *fImpl; - - DOM_Node(NodeImpl *); - - friend class DOM_Document; - friend class DocumentImpl; - friend class TreeWalkerImpl; - friend class NodeIteratorImpl; - friend class DOM_NamedNodeMap; - friend class DOM_NodeList; - friend class DOMParser; - friend class DOM_Entity; - friend class RangeImpl; - friend class CharacterDataImpl; - friend class XUtil; - -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/DOM_NodeFilter.cpp b/src/xercesc/dom/deprecated/DOM_NodeFilter.cpp deleted file mode 100644 index 16bd7c2146b638d9348cc629c4ef6c3a416e3d75..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_NodeFilter.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// DOM_NodeFilter.cpp: implementation of the DOM_NodeFilter class. -// -////////////////////////////////////////////////////////////////////// - -#include "DOM_NodeFilter.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_NodeFilter::DOM_NodeFilter() { - -} - - -DOM_NodeFilter::~DOM_NodeFilter() { - -} - -XERCES_CPP_NAMESPACE_END - - diff --git a/src/xercesc/dom/deprecated/DOM_NodeFilter.hpp b/src/xercesc/dom/deprecated/DOM_NodeFilter.hpp deleted file mode 100644 index b102d5f9061f54a38325b8e8e6114ee86854633a..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_NodeFilter.hpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// DOM_NodeFilter.h: interface for the DOM_NodeFilter class. -// -////////////////////////////////////////////////////////////////////// - -#ifndef DOM_NodeFilter_HEADER_GUARD_ -#define DOM_NodeFilter_HEADER_GUARD_ - -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class NodeFilterImpl; - - -/** - * Filters are objects that know how to "filter out" nodes. If a - * <code>DOM_NodeIterator</code> or <code>DOM_TreeWalker</code> is given a - * filter, it applies the filter before it returns the next node. - * - * If the filter says to accept the node, the iterator returns it; otherwise, the - * iterator looks for the next node and pretends that the node that was rejected - * was not there. - * - * The DOM does not provide any filters. Filter is just an interface that users can - * implement to provide their own filters. - * - * Filters do not need to know how to iterate, nor do they need to know anything - * about the data structure that is being iterated. This makes it very easy to write - * filters, since the only thing they have to know how to do is evaluate a single node. - * One filter may be used with a number of different kinds of iterators, encouraging - * code reuse. - * - */ -class DEPRECATED_DOM_EXPORT DOM_NodeFilter -{ - public: - /** @name Enumerators for Node Filter */ - //@{ - /* - * <table><tr><td>FILTER_ACCEPT</td> - * <td>Accept the node. Navigation methods defined for - * NodeIterator or TreeWalker will return this node.</td> - * </tr> - * <tr><td> - * FILTER_REJECT</td> - * <td>Reject the node. Navigation methods defined for - * NodeIterator or TreeWalker will not return this - * node. For TreeWalker, the children of this node will - * also be rejected. Iterators treat this as a synonym - * for FILTER_SKIP.</td> - * </tr> - * <tr><td>FILTER_SKIP</td> - * <td>Reject the node. Navigation methods defined for - * NodeIterator or TreeWalker will not return this - * node. For both NodeIterator and Treewalker, the - * children of this node will still be considered.</td> - * </tr> - * </table> - * - */ - enum FilterAction {FILTER_ACCEPT = 1, - FILTER_REJECT = 2, - FILTER_SKIP = 3}; - - enum ShowType { - SHOW_ALL = 0x0000FFFF, - SHOW_ELEMENT = 0x00000001, - SHOW_ATTRIBUTE = 0x00000002, - SHOW_TEXT = 0x00000004, - SHOW_CDATA_SECTION = 0x00000008, - SHOW_ENTITY_REFERENCE = 0x00000010, - SHOW_ENTITY = 0x00000020, - SHOW_PROCESSING_INSTRUCTION = 0x00000040, - SHOW_COMMENT = 0x00000080, - SHOW_DOCUMENT = 0x00000100, - SHOW_DOCUMENT_TYPE = 0x00000200, - SHOW_DOCUMENT_FRAGMENT = 0x00000400, - SHOW_NOTATION = 0x00000800 - }; - //@} - - /** @name Constructors */ - //@{ - /** - * Default constructor for DOM_NodeFilter. - */ - DOM_NodeFilter(); - //@} - - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_NodeFilter. - */ - virtual ~DOM_NodeFilter(); - //@} - - /** @name Test function. */ - //@{ - /** - * Test whether a specified node is visible in the logical view of a DOM_TreeWalker - * or DOM_NodeIterator. This function will be called by the implementation of - * DOM_TreeWalker and DOM_NodeIterator; it is not intended to be called directly from user - * code. - * - * @param node The node to check to see if it passes the filter or not. - * @return A constant to determine whether the node is accepted, rejected, or skipped. - */ - virtual short acceptNode (const DOM_Node &node) const =0; - //@} - - private: - DOM_NodeFilter(const DOM_NodeFilter &other); - DOM_NodeFilter & operator = (const DOM_NodeFilter &other); - bool operator == (const DOM_NodeFilter &other) const; - bool operator != (const DOM_NodeFilter &other) const; -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/DOM_NodeIterator.cpp b/src/xercesc/dom/deprecated/DOM_NodeIterator.cpp deleted file mode 100644 index e42d779d8ada079991c210e485bfe84659e1f829..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_NodeIterator.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_NodeIterator.hpp" -#include "NodeIteratorImpl.hpp" -#include "RefCountedImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - - -DOM_NodeIterator::DOM_NodeIterator() -{ - fImpl = 0; -} - - -DOM_NodeIterator::DOM_NodeIterator(NodeIteratorImpl *impl) -{ - fImpl = impl; - RefCountedImpl::addRef(fImpl); -} - - -DOM_NodeIterator::DOM_NodeIterator(const DOM_NodeIterator &other) -{ - this->fImpl = other.fImpl; - RefCountedImpl::addRef(fImpl); -} - - -DOM_NodeIterator & DOM_NodeIterator::operator = (const DOM_NodeIterator &other) -{ - if (this->fImpl != other.fImpl) - { - RefCountedImpl::removeRef(this->fImpl); - this->fImpl = other.fImpl; - RefCountedImpl::addRef(this->fImpl); - } - return *this; -}; - - -DOM_NodeIterator & DOM_NodeIterator::operator = (const DOM_NullPtr * /*other*/) -{ - RefCountedImpl::removeRef(this->fImpl); - this->fImpl = 0; - return *this; -}; - - - -DOM_NodeIterator::~DOM_NodeIterator() -{ - RefCountedImpl::removeRef (this->fImpl); - fImpl = 0; -}; - -// -// Comparison operators. Equivalent of Java object reference == -// Null references compare ==. -// -bool DOM_NodeIterator::operator != (const DOM_NodeIterator & other) const -{ - return this->fImpl != other.fImpl; -}; - - -bool DOM_NodeIterator::operator == (const DOM_NodeIterator & other) const -{ - return this->fImpl == other.fImpl; -}; - -bool DOM_NodeIterator::operator != (const DOM_NullPtr * /*other*/) const -{ - return this->fImpl != 0; -}; - - -bool DOM_NodeIterator::operator == (const DOM_NullPtr * /*other*/) const -{ - return this->fImpl == 0; -} - - -void DOM_NodeIterator::detach () -{ - fImpl->detach(); -} - - - -DOM_Node DOM_NodeIterator::getRoot() -{ - return fImpl->getRoot(); -} - - -unsigned long DOM_NodeIterator::getWhatToShow () -{ - return fImpl->getWhatToShow(); -} - - -DOM_NodeFilter* DOM_NodeIterator::getFilter() { - return fImpl->getFilter(); -} - -/** Get the expandEntity reference flag. */ -bool DOM_NodeIterator::getExpandEntityReferences() -{ - if (fImpl !=0) - return fImpl->getExpandEntityReferences(); - return false; -} - - -DOM_Node DOM_NodeIterator::nextNode() { - return fImpl->nextNode(); -} - - -DOM_Node DOM_NodeIterator::previousNode() { - return fImpl->previousNode(); -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_NodeIterator.hpp b/src/xercesc/dom/deprecated/DOM_NodeIterator.hpp deleted file mode 100644 index 35e1bdbf8f10c29b05c98e8757b79788fe396cf9..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_NodeIterator.hpp +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_NodeIterator_HEADER_GUARD_ -#define DOM_NodeIterator_HEADER_GUARD_ - -#include "DOM_NodeFilter.hpp" -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class NodeIteratorImpl; - -/** - * NodeIterators are used to step through a set of nodes - * e.g. the set of nodes in a NodeList, the document subtree governed by - * a particular node, the results of a query, or any other set of nodes. - * The set of nodes to be iterated is determined by the implementation - * of the NodeIterator. DOM Level 2 specifies a single NodeIterator - * implementation for document-order traversal of a document - * subtree. Instances of these iterators are created by calling - * <code>DocumentTraversal.createNodeIterator()</code>. - * - */ -class DEPRECATED_DOM_EXPORT DOM_NodeIterator -{ - public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor. - */ - DOM_NodeIterator (); - - /** - * Copy constructor. - * - * @param other The object to be copied. - */ - DOM_NodeIterator(const DOM_NodeIterator &other); - - /** - * Assignment operator. - * - * @param other The object to be copied. - */ - DOM_NodeIterator & operator = (const DOM_NodeIterator &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_NodeIterator to null. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_NodeIterator & operator = (const DOM_NullPtr *val); - //@} - - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_NodeIterator. - */ - ~DOM_NodeIterator(); - //@} - - /** @name Equality and Inequality operators. */ - //@{ - /** - * The equality operator. - * - * @param other The object reference with which <code>this</code> object is compared - * @returns True if both <code>DOM_NodeIterator</code>s refer to the same - * actual node, or are both null; return false otherwise. - */ - bool operator == (const DOM_NodeIterator & other)const; - - /** - * Compare with a pointer. Intended only to allow a convenient - * comparison with null. - */ - bool operator == (const DOM_NullPtr *other) const; - - /** - * The inequality operator. See operator ==. - */ - bool operator != (const DOM_NodeIterator & other) const; - - /** - * Compare with a pointer. Intended only to allow a convenient - * comparison with null. - * - */ - bool operator != (const DOM_NullPtr * other) const; - //@} - - /** @name Get functions. */ - //@{ - /** - * The root node of the <code>NodeIterator</code>, as specified when it - * was created. - */ - DOM_Node getRoot(); - - /** - * Return which node types are presented via the iterator. - * The available set of constants is defined in the DOM_NodeFilter interface. - * - */ - unsigned long getWhatToShow(); - - /** - * Return The filter used to screen nodes. - * - */ - DOM_NodeFilter* getFilter(); - - /** - * Return the expandEntityReferences flag. - * The value of this flag determines whether the children of entity reference - * nodes are visible to the DOM_NodeFilter. If false, they will be skipped over. - * - */ - bool getExpandEntityReferences(); - - /** - * Returns the next node in the set and advances the position of the iterator - * in the set. After a DOM_NodeIterator is created, the first call to nextNode() - * returns the first node in the set. - * - * @exception DOMException - * INVALID_STATE_ERR: Raised if this method is called after the - * <code>detach</code> method was invoked. - */ - DOM_Node nextNode(); - - /** - * Returns the previous node in the set and moves the position of the iterator - * backwards in the set. - * - * @exception DOMException - * INVALID_STATE_ERR: Raised if this method is called after the - * <code>detach</code> method was invoked. - */ - DOM_Node previousNode(); - //@} - - /** @name Detaching functions. */ - //@{ - /** - * Detaches the iterator from the set which it iterated over, releasing any - * computational resources and placing the iterator in the INVALID state. After - * <code>detach</code> has been invoked, calls to <code>nextNode</code> or - * <code>previousNode</code> will raise the exception INVALID_STATE_ERR. - * - */ - void detach(); - //@} - - protected: - DOM_NodeIterator (NodeIteratorImpl* impl); - - friend class DOM_Document; - - private: - NodeIteratorImpl* fImpl; -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/DOM_NodeList.cpp b/src/xercesc/dom/deprecated/DOM_NodeList.cpp deleted file mode 100644 index 0e970db19eca44a9e048fc8a8a898f0d8d959a7e..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_NodeList.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_NodeList.hpp" -#include "NodeListImpl.hpp" -#include "DOM_Node.hpp" -#include <assert.h> - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_NodeList::DOM_NodeList() -{ - fImpl = 0; -} - - -DOM_NodeList::DOM_NodeList(NodeListImpl *impl) -{ - fImpl = impl; - RefCountedImpl::addRef(fImpl); -} - - -DOM_NodeList::DOM_NodeList(const DOM_NodeList &other) -{ - fImpl = other.fImpl; - RefCountedImpl::addRef(fImpl); -} - - -DOM_NodeList & DOM_NodeList::operator = (const DOM_NodeList &other) -{ - if (this->fImpl != other.fImpl) - { - RefCountedImpl::removeRef(this->fImpl); - this->fImpl = other.fImpl; - RefCountedImpl::addRef(this->fImpl); - } - return *this; -} - - -DOM_NodeList & DOM_NodeList::operator = (const DOM_NullPtr * /*other*/) -{ - RefCountedImpl::removeRef(this->fImpl); - this->fImpl = 0; - return *this; -} - - -DOM_NodeList::~DOM_NodeList() -{ - RefCountedImpl::removeRef(this->fImpl); - fImpl = 0; -} - - -bool DOM_NodeList::operator == (const DOM_NodeList &other) const -{ - return this->fImpl == other.fImpl; -} - - -bool DOM_NodeList::operator != (const DOM_NodeList &other) const -{ - return this->fImpl != other.fImpl; -} - - -bool DOM_NodeList::operator == (const DOM_NullPtr * /*nullPtr*/) const -{ - return this->fImpl == 0; -} - - -bool DOM_NodeList::operator != (const DOM_NullPtr * /*nullPtr*/) const -{ - return this->fImpl != 0; -} - - - - -DOM_Node DOM_NodeList::item(unsigned int index) const -{ - return DOM_Node(fImpl->item(index)); -} - - -unsigned int DOM_NodeList::getLength() const -{ - return fImpl->getLength(); -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_NodeList.hpp b/src/xercesc/dom/deprecated/DOM_NodeList.hpp deleted file mode 100644 index d68df687ae7c011873bdeb9a4d7f5f4db4dfabe1..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_NodeList.hpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_NodeList_HEADER_GUARD_ -#define DOM_NodeList_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class NodeListImpl; - -/** - * The <code>NodeList</code> interface provides the abstraction of an ordered - * collection of nodes. NodeLists are created by DOM_Document::getElementsByTagName(), - * DOM_Node::getChildNodes(), - * - * <p>The items in the <code>NodeList</code> are accessible via an integral - * index, starting from 0. - * - * NodeLists are "live", in that any changes to the document tree are immediately - * reflected in any NodeLists that may have been created for that tree. - */ - -class DEPRECATED_DOM_EXPORT DOM_NodeList { -private: - NodeListImpl *fImpl; - -public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor for DOM_NodeList. The resulting object does not - * refer to an actual NodeList; it will compare == to 0, and is similar - * to a null object reference variable in Java. It may subsequently be - * assigned to refer to an actual NodeList. - * - */ - DOM_NodeList(); - - /** - * Copy constructor. - * - * @param other The object to be copied. - */ - DOM_NodeList(const DOM_NodeList &other); - - /** - * Assignment operator. - * - * @param other The object to be copied. - */ - DOM_NodeList & operator = (const DOM_NodeList &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_NodeList & operator = (const DOM_NullPtr *val); - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_NodeList. The object being destroyed is the reference - * object, not the underlying NodeList node itself. - * - * <p>Like most other DOM types in this implementation, memory management - * of Node Lists is automatic. Instances of DOM_NodeList function - * as references to an underlying heap based implementation object, - * and should never be explicitly new-ed or deleted in application code, but - * should appear only as local variables or function parameters. - */ - ~DOM_NodeList(); - //@} - - /** @name Comparison operators. */ - //@{ - - /** - * Equality operator. - * Compares whether two node list - * variables refer to the same underlying node list. It does - * not compare the contents of the node lists themselves. - * - * @param other The value to be compared - * @return Returns true if node list refers to same underlying node list - */ - bool operator == (const DOM_NodeList &other) const; - - /** - * Use this comparison operator to test whether a Node List reference - * is null. - * - * @param nullPtr The value to be compared, which must be 0 or null. - * @return Returns true if node list reference is null - */ - bool operator == (const DOM_NullPtr *nullPtr) const; - - /** - * Inequality operator. - * Compares whether two node list - * variables refer to the same underlying node list. It does - * not compare the contents of the node lists themselves. - * - * @param other The value to be compared - * @return Returns true if node list refers to a different underlying node list - */ - bool operator != (const DOM_NodeList &other) const; - - /** - * Use this comparison operator to test whether a Node List reference - * is not null. - * - * @param nullPtr The value to be compared, which must be 0 or null. - * @return Returns true if node list reference is not null - */ - bool operator != (const DOM_NullPtr *nullPtr) const; - //@} - - - /** @name Get functions. */ - //@{ - /** - * Returns the <code>index</code>th item in the collection. - * - * If <code>index</code> is greater than or equal to the number of nodes in - * the list, this returns <code>null</code>. - * - * @param index Index into the collection. - * @return The node at the <code>index</code>th position in the - * <code>NodeList</code>, or <code>null</code> if that is not a valid - * index. - */ - DOM_Node item(unsigned int index) const; - - /** - * Returns the number of nodes in the list. - * - * The range of valid child node indices is 0 to <code>length-1</code> inclusive. - */ - unsigned int getLength() const; - //@} - -protected: - DOM_NodeList(NodeListImpl *impl); - - friend class DOM_Document; - friend class DOM_Element; - friend class DOM_Node; - friend class DOM_Entity; - -}; - -XERCES_CPP_NAMESPACE_END - -#endif - - diff --git a/src/xercesc/dom/deprecated/DOM_Notation.cpp b/src/xercesc/dom/deprecated/DOM_Notation.cpp deleted file mode 100644 index 571c00580b2c96fd82996a3223a5ec09a32416e8..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Notation.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_Notation.hpp" -#include "NotationImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_Notation::DOM_Notation() -: DOM_Node(null) -{ -}; - - -DOM_Notation::DOM_Notation(const DOM_Notation & other) -: DOM_Node(other) -{ -}; - - -DOM_Notation::DOM_Notation(NotationImpl *impl) : - DOM_Node(impl) -{ -}; - - -DOM_Notation::~DOM_Notation() -{ -}; - - -DOM_Notation & DOM_Notation::operator = (const DOM_Notation & other) -{ - return (DOM_Notation &) DOM_Node::operator = (other); -}; - - -DOM_Notation & DOM_Notation::operator = (const DOM_NullPtr *other) -{ - return (DOM_Notation &) DOM_Node::operator = (other); -}; - - - -DOMString DOM_Notation::getPublicId() const -{ - return ((NotationImpl *)fImpl)->getPublicId(); -}; - - -DOMString DOM_Notation::getSystemId() const -{ - return ((NotationImpl *)fImpl)->getSystemId(); -}; - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_Notation.hpp b/src/xercesc/dom/deprecated/DOM_Notation.hpp deleted file mode 100644 index f866fca1afd445f6390ba63941612b822249a02c..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Notation.hpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_Notation_HEADER_GUARD_ -#define DOM_Notation_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class NotationImpl; - -/** - * This interface represents a notation declared in the DTD. A notation either - * declares, by name, the format of an unparsed entity (see section 4.7 of - * the XML 1.0 specification), or is used for formal declaration of - * Processing Instruction targets (see section 2.6 of the XML 1.0 - * specification). The <code>nodeName</code> attribute inherited from - * <code>Node</code> is set to the declared name of the notation. - * <p>The DOM Level 1 does not support editing <code>Notation</code> nodes; - * they are therefore readonly. - * <p>A <code>Notation</code> node does not have any parent. - */ -class DEPRECATED_DOM_EXPORT DOM_Notation: public DOM_Node { -public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor for DOM_Notation. The resulting object does not - * refer to an actual Notation node; it will compare == to 0, and is similar - * to a null object reference variable in Java. It may subsequently be - * assigned to refer to an actual Notation node. - * <p> - * New notation nodes are created by DOM_Document::createNotation(). - * - * - */ - DOM_Notation(); - - /** - * Copy constructor. Creates a new <code>DOM_Notation</code> that refers to the - * same underlying node as the original. See also DOM_Node::clone(), - * which will copy the actual notation node, rather than just creating a new - * reference to the original node. - * - * @param other The object to be copied. - */ - DOM_Notation(const DOM_Notation &other); - - /** - * Assignment operator. - * - * @param other The object to be copied. - */ - DOM_Notation & operator = (const DOM_Notation &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_Notation & operator = (const DOM_NullPtr *val); - - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_Notation. The object being destroyed is the reference - * object, not the underlying Notation node itself. - * - */ - ~DOM_Notation(); - - //@} - /** @name Get functions. */ - //@{ - - /** - * Get the public identifier of this notation. - * - * If the public identifier was not - * specified, this is <code>null</code>. - * @return Returns the public identifier of the notation - */ - DOMString getPublicId() const; - /** - * Get the system identifier of this notation. - * - * If the system identifier was not - * specified, this is <code>null</code>. - * @return Returns the system identifier of the notation - */ - DOMString getSystemId() const; - - - //@} - -protected: - DOM_Notation(NotationImpl *impl); - - friend class DOM_Document; - -}; - -XERCES_CPP_NAMESPACE_END - -#endif - - diff --git a/src/xercesc/dom/deprecated/DOM_ProcessingInstruction.cpp b/src/xercesc/dom/deprecated/DOM_ProcessingInstruction.cpp deleted file mode 100644 index b79f28662a5f07f24cc8fa1c3b492f6a8225d1a9..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_ProcessingInstruction.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_ProcessingInstruction.hpp" -#include "ProcessingInstructionImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_ProcessingInstruction::DOM_ProcessingInstruction() -: DOM_Node(null) -{ -}; - - -DOM_ProcessingInstruction::DOM_ProcessingInstruction( - const DOM_ProcessingInstruction & other) -: DOM_Node(other) -{ -}; - - -DOM_ProcessingInstruction::DOM_ProcessingInstruction( - ProcessingInstructionImpl *impl) -: DOM_Node(impl) -{ -}; - - -DOM_ProcessingInstruction::~DOM_ProcessingInstruction() -{ -}; - - -DOM_ProcessingInstruction & DOM_ProcessingInstruction::operator = ( - const DOM_ProcessingInstruction & other) -{ - return (DOM_ProcessingInstruction &) DOM_Node::operator = (other); -}; - - -DOM_ProcessingInstruction & DOM_ProcessingInstruction::operator = (const DOM_NullPtr *other) -{ - return (DOM_ProcessingInstruction &) DOM_Node::operator = (other); -}; - - - -DOMString DOM_ProcessingInstruction::getTarget() const -{ - return ((ProcessingInstructionImpl *)fImpl)->getTarget().clone(); -}; - - -DOMString DOM_ProcessingInstruction::getData() const -{ - return ((ProcessingInstructionImpl *)fImpl)->getData().clone(); -}; - - -void DOM_ProcessingInstruction::setData(const DOMString &data) -{ - ((ProcessingInstructionImpl *)fImpl)->setData(data.clone()); -}; - - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_ProcessingInstruction.hpp b/src/xercesc/dom/deprecated/DOM_ProcessingInstruction.hpp deleted file mode 100644 index b06dd2009bc04d5d471db4435cd13d8d42072cc5..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_ProcessingInstruction.hpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_ProcessingInstruction_HEADER_GUARD_ -#define DOM_ProcessingInstruction_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class ProcessingInstructionImpl; - -/** - * The <code>ProcessingInstruction</code> interface represents a "processing - * instruction", used in XML as a way to keep processor-specific information - * in the text of the document. - */ -class DEPRECATED_DOM_EXPORT DOM_ProcessingInstruction: public DOM_Node { -public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor for DOM_ProcessingInstruction. The resulting object - * does not refer to an actual PI node; it will compare == to 0, and is similar - * to a null object reference variable in Java. It may subsequently be - * assigned to refer to an actual PI node. - * <p> - * New Processing Instruction nodes are created by DOM_Document::createProcessingInstruction(). - * - * - */ - DOM_ProcessingInstruction(); - - /** - * Copy constructor. Creates a new <code>DOM_ProcessingInstruction</code> that refers to the - * same underlying node as the original. See also DOM_Node::clone(), - * which will copy the actual PI node, rather than just creating a new - * reference to the original node. - * - * @param other The object to be copied. - */ - DOM_ProcessingInstruction(const DOM_ProcessingInstruction &other); - - /** - * Assignment operator. - * - * @param other The object to be copied. - */ - DOM_ProcessingInstruction & operator = (const DOM_ProcessingInstruction &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_ProcessingInstruction & operator = (const DOM_NullPtr *val); - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_processingInstruction. The object being destroyed is the reference - * object, not the underlying PI node itself. - * - */ - ~DOM_ProcessingInstruction(); - - //@} - /** @name Get functions. */ - //@{ - /** - * The target of this processing instruction. - * - * XML defines this as being the - * first token following the markup that begins the processing instruction. - */ - DOMString getTarget() const; - - /** - * The content of this processing instruction. - * - * This is from the first non - * white space character after the target to the character immediately - * preceding the <code>?></code>. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. - */ - DOMString getData() const; - - //@} - /** @name Set functions. */ - //@{ - /** - * Sets the content of this processing instruction. - * - * This is from the first non - * white space character after the target to the character immediately - * preceding the <code>?></code>. - * @param data The string containing the processing instruction - */ - void setData(const DOMString &data); - //@} - -protected: - DOM_ProcessingInstruction(ProcessingInstructionImpl *impl); - - friend class DOM_Document; - -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/DOM_Range.cpp b/src/xercesc/dom/deprecated/DOM_Range.cpp deleted file mode 100644 index 12b1c8a86231c33cc8d2ac95b2fc5979d973b720..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Range.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - - - -#include "DOM_Range.hpp" -#include "DocumentImpl.hpp" -#include "RangeImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_Range::DOM_Range() -:fImpl(0) -{ -} - -DOM_Range::DOM_Range(RangeImpl* impl) -{ - fImpl = impl; - RefCountedImpl::addRef(fImpl); -} - -DOM_Range::DOM_Range(const DOM_Range& other) -{ - fImpl = other.fImpl; - RefCountedImpl::addRef(fImpl); -} - -DOM_Range::~DOM_Range() -{ - RefCountedImpl::removeRef (this->fImpl); - fImpl = 0; -}; - -DOM_Range & DOM_Range::operator = (const DOM_Range &other) -{ - if (this->fImpl != other.fImpl) - { - RefCountedImpl::removeRef(this->fImpl); - this->fImpl = other.fImpl; - RefCountedImpl::addRef(this->fImpl); - } - return *this; -}; - - -DOM_Range & DOM_Range::operator = (const DOM_NullPtr * /*other*/) -{ - RefCountedImpl::removeRef(this->fImpl); - this->fImpl = 0; - return *this; -}; - -bool DOM_Range::operator != (const DOM_Range & other) const -{ - return this->fImpl != other.fImpl; -}; - - -bool DOM_Range::operator == (const DOM_Range & other) const -{ - return this->fImpl == other.fImpl; -}; - -bool DOM_Range::operator != (const DOM_NullPtr * /*other*/) const -{ - return this->fImpl != 0; -}; - - -bool DOM_Range::operator == (const DOM_NullPtr * /*other*/) const -{ - return this->fImpl == 0; -} - -//getter functions - -DOM_Node DOM_Range::getStartContainer() const -{ - return ((RangeImpl *)fImpl)->getStartContainer(); -} -unsigned int DOM_Range::getStartOffset() const -{ - return ((RangeImpl *)fImpl)->getStartOffset(); -} -DOM_Node DOM_Range::getEndContainer() const -{ - return ((RangeImpl *)fImpl)->getEndContainer(); -} -unsigned int DOM_Range::getEndOffset() const -{ - return ((RangeImpl *)fImpl)->getEndOffset(); -} -const DOM_Node DOM_Range::getCommonAncestorContainer() const -{ - return ((RangeImpl *)fImpl)->getCommonAncestorContainer(); -} - -//setter functions - -void DOM_Range::setStart(const DOM_Node& parent, unsigned int offset) -{ - this->fImpl->setStart(parent, offset); -} - -void DOM_Range::setEnd(const DOM_Node& parent, unsigned int offset) -{ - this->fImpl->setEnd(parent, offset); -} - -void DOM_Range::setStartBefore(const DOM_Node& refNode) -{ - this->fImpl->setStartBefore(refNode); -} - -void DOM_Range::setStartAfter(const DOM_Node& refNode) -{ - this->fImpl->setStartAfter(refNode); -} - -void DOM_Range::setEndBefore(const DOM_Node& refNode) -{ - this->fImpl->setEndBefore(refNode); -} - -void DOM_Range::setEndAfter(const DOM_Node& refNode) -{ - this->fImpl->setEndAfter(refNode); -} - -//misc functions -void DOM_Range::collapse(bool toStart) -{ - this->fImpl->collapse(toStart); -} - -bool DOM_Range::getCollapsed() const -{ - return ((RangeImpl *)fImpl)->getCollapsed(); -} - -void DOM_Range::selectNode(const DOM_Node& node) -{ - ((RangeImpl *)fImpl)->selectNode(node); -} -void DOM_Range::selectNodeContents(const DOM_Node& node) -{ - ((RangeImpl *)fImpl)->selectNodeContents(node); -} - -//Functions related to comparing ange Boundrary-Points -short DOM_Range::compareBoundaryPoints(CompareHow how, const DOM_Range& range) const -{ - return ((RangeImpl *)fImpl)->compareBoundaryPoints(how, range.fImpl); -} - -void DOM_Range::deleteContents() -{ - ((RangeImpl *)fImpl)->deleteContents(); -} - -DOM_DocumentFragment DOM_Range::extractContents() -{ - return ((RangeImpl *)fImpl)->extractContents(); -} - -DOM_DocumentFragment DOM_Range::cloneContents() const -{ - return ((RangeImpl *)fImpl)->cloneContents(); -} - -void DOM_Range::insertNode(DOM_Node& node) -{ - ((RangeImpl *)fImpl)->insertNode(node); -} - -//Misc functions -void DOM_Range::surroundContents(DOM_Node& node) -{ - ((RangeImpl *)fImpl)->surroundContents(node); -} - -DOM_Range DOM_Range::cloneRange() const -{ - return DOM_Range( ((RangeImpl *)fImpl)->cloneRange() ); -} - -DOMString DOM_Range::toString() const -{ - return ((RangeImpl *)fImpl)->toString(); -} - -void DOM_Range::detach() -{ - ((RangeImpl *)fImpl)->detach(); -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_Range.hpp b/src/xercesc/dom/deprecated/DOM_Range.hpp deleted file mode 100644 index 7d5539bdc1aaba09ad22c6237ed550328a455efe..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Range.hpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_Range_HEADER_GUARD_ -#define DOM_Range_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_Node.hpp" -#include "DOMString.hpp" -#include "DOM_DocumentFragment.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class RangeImpl; - -//class RangeImpl; - -class DEPRECATED_DOM_EXPORT DOM_Range { -public: - - enum CompareHow { - START_TO_START = 0, - START_TO_END = 1, - END_TO_END = 2, - END_TO_START = 3 - }; - - //c'tor & d'tor - DOM_Range(); - DOM_Range(const DOM_Range& other); - ~DOM_Range(); - - - DOM_Range & operator = (const DOM_Range &other); - DOM_Range & operator = (const DOM_NullPtr *other); - bool operator != (const DOM_Range & other) const; - bool operator == (const DOM_Range & other) const; - bool operator != (const DOM_NullPtr * other) const; - bool operator == (const DOM_NullPtr * other) const; - - //getter functions - DOM_Node getStartContainer() const; - unsigned int getStartOffset() const; - DOM_Node getEndContainer() const; - unsigned int getEndOffset() const; - bool getCollapsed() const; - const DOM_Node getCommonAncestorContainer() const; - - //setter functions - void setStart(const DOM_Node &parent, unsigned int offset); - void setEnd(const DOM_Node &parent, unsigned int offset); - - void setStartBefore(const DOM_Node &refNode); - void setStartAfter(const DOM_Node &refNode); - void setEndBefore(const DOM_Node &refNode); - void setEndAfter(const DOM_Node &refNode); - - //misc functions - void collapse(bool toStart); - void selectNode(const DOM_Node &node); - void selectNodeContents(const DOM_Node &node); - - //Functions related to comparing range Boundrary-Points - short compareBoundaryPoints(CompareHow how, const DOM_Range& range) const; - void deleteContents(); - DOM_DocumentFragment extractContents(); - DOM_DocumentFragment cloneContents() const; - void insertNode(DOM_Node& node); - //Misc functions - void surroundContents(DOM_Node &node); - DOM_Range cloneRange() const; - DOMString toString() const; - void detach(); - - - - -protected: - - DOM_Range(RangeImpl *); - RangeImpl *fImpl; - - friend class DOM_Document; -}; - - - - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/DOM_RangeException.cpp b/src/xercesc/dom/deprecated/DOM_RangeException.cpp deleted file mode 100644 index 3a6d426e2ead891fb11810585d6cfc30065359be..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_RangeException.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_RangeException.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - - -DOM_RangeException::DOM_RangeException() -: DOM_DOMException() -{ - code = (RangeExceptionCode) 0; -}; - - -DOM_RangeException::DOM_RangeException(RangeExceptionCode exCode, const DOMString &message) -: DOM_DOMException(exCode, message) -{ - code = exCode; -}; - - -DOM_RangeException::DOM_RangeException(const DOM_RangeException &other) -: DOM_DOMException(other) -{ - code = other.code; -}; - - -DOM_RangeException::~DOM_RangeException() -{ -}; - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_RangeException.hpp b/src/xercesc/dom/deprecated/DOM_RangeException.hpp deleted file mode 100644 index 4f6470a752285103b1e4259844ccfe84293c81a5..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_RangeException.hpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_RangeException_HEADER_GUARD_ -#define DOM_RangeException_HEADER_GUARD_ - -#include "DOM_DOMException.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -/** - * Encapsulate range related DOM error or warning. DOM level 2 implementation. - * - * <p> The DOM will create and throw an instance of DOM_RangeException - * when an error condition in range is detected. Exceptions can occur - * when an application directly manipulates the range elements in DOM document - * tree that is produced by the parser. - * - * <p>Unlike the other classes in the C++ DOM API, DOM_RangeException - * is NOT a reference to an underlying implementation class, and - * does not provide automatic memory management. Code that catches - * a DOM Range exception is responsible for deleting it, or otherwise - * arranging for its disposal. - * - */ -class DEPRECATED_DOM_EXPORT DOM_RangeException : public DOM_DOMException { -public: - /** @name Enumerators for DOM Range Exceptions */ - //@{ - enum RangeExceptionCode { - BAD_BOUNDARYPOINTS_ERR = 1, - INVALID_NODE_TYPE_ERR = 2 - }; - //@} -public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor for DOM_RangeException. - * - */ - DOM_RangeException(); - - /** - * Constructor which takes an error code and a message. - * - * @param code The error code which indicates the exception - * @param message The string containing the error message - */ - DOM_RangeException(RangeExceptionCode code, const DOMString &message); - - /** - * Copy constructor. - * - * @param other The object to be copied. - */ - DOM_RangeException(const DOM_RangeException &other); - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_RangeException. Applications are responsible - * for deleting DOM_RangeException objects that they catch after they - * have completed their exception processing. - * - */ - virtual ~DOM_RangeException(); - //@} - - /** @name Public variables. */ - //@{ - /** - * A code value, from the set defined by the RangeExceptionCode enum, - * indicating the type of error that occured. - */ - RangeExceptionCode code; - - //@} - -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/DOM_Text.cpp b/src/xercesc/dom/deprecated/DOM_Text.cpp deleted file mode 100644 index d111abaec983cac7fbad97a316bfa464c8faddd4..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Text.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_Text.hpp" -#include "TextImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_Text::DOM_Text() -: DOM_CharacterData(null) -{ -}; - - -DOM_Text::DOM_Text(const DOM_Text & other) -: DOM_CharacterData(other) -{ -}; - - -DOM_Text::DOM_Text(TextImpl *impl) : - DOM_CharacterData(impl) -{ -}; - - -DOM_Text::~DOM_Text() -{ -}; - - -DOM_Text & DOM_Text::operator = (const DOM_Text & other) -{ - return (DOM_Text &) DOM_CharacterData::operator = (other); -}; - - -DOM_Text & DOM_Text::operator = (const DOM_NullPtr *other) -{ - return (DOM_Text &) DOM_Node::operator = (other); -}; - - -DOM_Text DOM_Text::splitText(unsigned int offset) -{ - return DOM_Text(((TextImpl *)fImpl)->splitText(offset)); -}; - - -bool DOM_Text::isIgnorableWhitespace() -{ - return ((TextImpl *)fImpl)->isIgnorableWhitespace(); -}; - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_Text.hpp b/src/xercesc/dom/deprecated/DOM_Text.hpp deleted file mode 100644 index dbf45f9e902b06fcaf26ac3317d1bc777f54c0d1..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_Text.hpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_Text_HEADER_GUARD_ -#define DOM_Text_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_CharacterData.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class TextImpl; - - -/** - * The <code>Text</code> interface represents the textual content (termed - * character data in XML) of an <code>Element</code> or <code>Attr</code>. - * If there is no markup inside an element's content, the text is contained - * in a single object implementing the <code>Text</code> interface that is - * the only child of the element. If there is markup, it is parsed into a - * list of elements and <code>Text</code> nodes that form the list of - * children of the element. - * <p>When a document is first made available via the DOM, there is only one - * <code>Text</code> node for each block of text. Users may create adjacent - * <code>Text</code> nodes that represent the contents of a given element - * without any intervening markup, but should be aware that there is no way - * to represent the separations between these nodes in XML, so they - * will not (in general) persist between DOM editing sessions. The - * <code>normalize()</code> method on <code>Element</code> merges any such - * adjacent <code>Text</code> objects into a single node for each block of - * text; this is recommended before employing operations that depend on a - * particular document structure, such as navigation with - * <code>XPointers.</code> - */ -class DEPRECATED_DOM_EXPORT DOM_Text: public DOM_CharacterData { - - public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor for DOM_Text. The resulting object does not - * refer to an actual Text node; it will compare == to 0, and is similar - * to a null object reference variable in Java. It may subsequently be - * assigned to refer to an actual comment node. - * - */ - DOM_Text(); - - /** - * Copy constructor. Creates a new <code>DOM_Text</code> that refers to the - * same underlying node as the original. See also DOM_Node::clone(), - * which will copy the actual Text node, rather than just creating a new - * reference to the original node. - * - * @param other The object to be copied. - */ - DOM_Text(const DOM_Text &other); - - /** - * Assignment operator. - * - * @param other The object to be copied. - */ - DOM_Text & operator = (const DOM_Text &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_Text & operator = (const DOM_NullPtr *val); - - //@} - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_Text. The object being destroyed is the reference - * object, not the underlying Comment node itself. - * - */ - ~DOM_Text(); - - //@} - /** @name Functions to modify the Text node. */ - //@{ - - /** - * Breaks this node into two nodes at the specified - * offset, keeping both in the tree as siblings. - * - * This node then only - * contains all the content up to the <code>offset</code> point. And a new - * node of the same nodeType, which is inserted as the next sibling of this - * node, contains all the content at and after the <code>offset</code> - * point. When the <code>offset</code> is equal to the lenght of this node, - * the new node has no data. - * @param offset The offset at which to split, starting from 0. - * @return The new <code>Text</code> node. - * @exception DOMException - * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater - * than the number of characters in <code>data</code>. - * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - */ - DOM_Text splitText(unsigned int offset); - - //@} - /** @name Non-standard (not defined by the DOM specification) functions. */ - //@{ - - /** - * - * Return true if this node contains ignorable whitespaces only. - * @return True if this node contains ignorable whitespaces only. - */ - bool isIgnorableWhitespace(); - - //@} - -protected: - DOM_Text(TextImpl *); - - friend class DOM_Document; - friend class RangeImpl; - - - -}; - -XERCES_CPP_NAMESPACE_END - -#endif - - diff --git a/src/xercesc/dom/deprecated/DOM_TreeWalker.cpp b/src/xercesc/dom/deprecated/DOM_TreeWalker.cpp deleted file mode 100644 index 38138259df50b503bd5a1919316057635fc851d0..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_TreeWalker.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_TreeWalker.hpp" -#include "RefCountedImpl.hpp" -#include "TreeWalkerImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_TreeWalker::DOM_TreeWalker() -{ - fImpl = 0; -} - - -DOM_TreeWalker::DOM_TreeWalker(TreeWalkerImpl *impl) -{ - fImpl = impl; - RefCountedImpl::addRef(fImpl); -} - - -DOM_TreeWalker::DOM_TreeWalker(const DOM_TreeWalker &other) -{ - this->fImpl = other.fImpl; - RefCountedImpl::addRef(fImpl); -} - - -DOM_TreeWalker & DOM_TreeWalker::operator = (const DOM_TreeWalker &other) -{ - if (this->fImpl != other.fImpl) - { - RefCountedImpl::removeRef(this->fImpl); - this->fImpl = other.fImpl; - RefCountedImpl::addRef(this->fImpl); - } - return *this; -}; - - -DOM_TreeWalker & DOM_TreeWalker::operator = (const DOM_NullPtr * /*other*/) -{ - RefCountedImpl::removeRef(this->fImpl); - this->fImpl = 0; - return *this; -}; - - - -DOM_TreeWalker::~DOM_TreeWalker() -{ - RefCountedImpl::removeRef (this->fImpl); - fImpl = 0; -}; - -// -// Comparison operators. Equivalent of Java object reference == -// Null references compare ==. -// -bool DOM_TreeWalker::operator != (const DOM_TreeWalker & other) const -{ - return this->fImpl != other.fImpl; -}; - - -bool DOM_TreeWalker::operator == (const DOM_TreeWalker & other) const -{ - return this->fImpl == other.fImpl; -}; - -bool DOM_TreeWalker::operator != (const DOM_NullPtr * /*other*/) const -{ - return this->fImpl != 0; -}; - - -bool DOM_TreeWalker::operator == (const DOM_NullPtr * /*other*/) const -{ - return this->fImpl == 0; -}; - - - -DOM_Node DOM_TreeWalker::getRoot() { - return fImpl->getRoot(); -} - - -unsigned long DOM_TreeWalker::getWhatToShow() { - return fImpl->getWhatToShow(); -} - - -DOM_NodeFilter* DOM_TreeWalker::getFilter() { - return fImpl->getFilter(); -} - - -DOM_Node DOM_TreeWalker::getCurrentNode() { - return fImpl->getCurrentNode(); -} - - -void DOM_TreeWalker::setCurrentNode(DOM_Node currentNode) { - fImpl->setCurrentNode(currentNode); -} - - -DOM_Node DOM_TreeWalker::parentNode() { - return fImpl->parentNode(); -} - - -DOM_Node DOM_TreeWalker::firstChild() { - return fImpl->firstChild(); -} - - -DOM_Node DOM_TreeWalker::lastChild() { - return fImpl->lastChild(); -} - - -DOM_Node DOM_TreeWalker::previousSibling() { - return fImpl->previousSibling(); -} - - -DOM_Node DOM_TreeWalker::nextSibling() { - return fImpl->nextSibling(); -} - - -DOM_Node DOM_TreeWalker::previousNode() { - return fImpl->previousNode(); -} - - -DOM_Node DOM_TreeWalker::nextNode() { - return fImpl->nextNode(); -} - -XERCES_CPP_NAMESPACE_END - - diff --git a/src/xercesc/dom/deprecated/DOM_TreeWalker.hpp b/src/xercesc/dom/deprecated/DOM_TreeWalker.hpp deleted file mode 100644 index d6045269397fa2f647a3b1c66b716a2d909186f7..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_TreeWalker.hpp +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef DOM_TreeWalker_HEADER_GUARD_ -#define DOM_TreeWalker_HEADER_GUARD_ - -#include "DOM_Node.hpp" -#include "DOM_NodeFilter.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class TreeWalkerImpl; - - -/** - * <code>DOM_TreeWalker</code> objects are used to navigate a document tree or - * subtree using the view of the document defined by its <code>whatToShow</code> - * flags and any filters that are defined for the <code>DOM_TreeWalker</code>. Any - * function which performs navigation using a <code>DOM_TreeWalker</code> will - * automatically support any view defined by a <code>DOM_TreeWalker</code>. - * - * Omitting nodes from the logical view of a subtree can result in a structure that is - * substantially different from the same subtree in the complete, unfiltered document. Nodes - * that are siblings in the DOM_TreeWalker view may be children of different, widely separated - * nodes in the original view. For instance, consider a Filter that skips all nodes except for - * Text nodes and the root node of a document. In the logical view that results, all text - * nodes will be siblings and appear as direct children of the root node, no matter how - * deeply nested the structure of the original document. - * - */ -class DEPRECATED_DOM_EXPORT DOM_TreeWalker { - public: - /** @name Constructors and assignment operator */ - //@{ - /** - * Default constructor. - */ - DOM_TreeWalker(); - - /** - * Copy constructor. - * - * @param other The object to be copied. - */ - DOM_TreeWalker(const DOM_TreeWalker &other); - - /** - * Assignment operator. - * - * @param other The object to be copied. - */ - DOM_TreeWalker & operator = (const DOM_TreeWalker &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_NodeIterator to null. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_TreeWalker & operator = (const DOM_NullPtr *val); - //@} - - /** @name Destructor. */ - //@{ - /** - * Destructor for DOM_TreeWalker. - */ - ~DOM_TreeWalker(); - //@} - - /** @name Equality and Inequality operators. */ - //@{ - /** - * The equality operator. - * - * @param other The object reference with which <code>this</code> object is compared - * @returns True if both <code>DOM_TreeWalker</code>s refer to the same - * actual node, or are both null; return false otherwise. - */ - bool operator == (const DOM_TreeWalker & other)const; - - /** - * Compare with a pointer. Intended only to allow a convenient - * comparison with null. - */ - bool operator == (const DOM_NullPtr *other) const; - - /** - * The inequality operator. See operator ==. - */ - bool operator != (const DOM_TreeWalker & other) const; - - /** - * Compare with a pointer. Intended only to allow a convenient - * comparison with null. - * - */ - bool operator != (const DOM_NullPtr * other) const; - //@} - - /** @name Get functions. */ - //@{ - /** - * The <code>root</code> node of the <code>TreeWalker</code>, as specified - * when it was created. - */ - DOM_Node getRoot(); - - /** - * Return which node types are presented via the DOM_TreeWalker. - * These constants are defined in the DOM_NodeFilter interface. - * - */ - unsigned long getWhatToShow(); - - /** - * Return The filter used to screen nodes. - * - */ - DOM_NodeFilter* getFilter(); - - /** - * Return the expandEntityReferences flag. - * The value of this flag determines whether the children of entity reference - * nodes are visible to the DOM_TreeWalker. If false, they will be skipped over. - * - */ - bool getExpandEntityReferences(); - - /** - * Return the node at which the DOM_TreeWalker is currently positioned. - * - */ - DOM_Node getCurrentNode(); - - /** - * Moves to and returns the closest visible ancestor node of the current node. - * If the search for parentNode attempts to step upward from the DOM_TreeWalker's root - * node, or if it fails to find a visible ancestor node, this method retains the - * current position and returns null. - * - */ - DOM_Node parentNode(); - - /** - * Moves the <code>DOM_TreeWalker</code> to the first child of the current node, - * and returns the new node. If the current node has no children, returns - * <code>null</code>, and retains the current node. - * - */ - DOM_Node firstChild(); - - /** - * Moves the <code>DOM_TreeWalker</code> to the last child of the current node, and - * returns the new node. If the current node has no children, returns - * <code>null</code>, and retains the current node. - * - */ - DOM_Node lastChild(); - - /** - * Moves the <code>DOM_TreeWalker</code> to the previous sibling of the current - * node, and returns the new node. If the current node has no previous sibling, - * returns <code>null</code>, and retains the current node. - * - */ - DOM_Node previousSibling(); - - /** - * Moves the <code>DOM_TreeWalker</code> to the next sibling of the current node, - * and returns the new node. If the current node has no next sibling, returns - * <code>null</code>, and retains the current node. - * - */ - DOM_Node nextSibling(); - - /** - * Moves the <code>DOM_TreeWalker</code> to the previous visible node in document - * order relative to the current node, and returns the new node. If the current - * node has no previous node, - * or if the search for previousNode attempts to step upward from the DOM_TreeWalker's - * root node, returns <code>null</code>, and retains the current node. - * - */ - DOM_Node previousNode(); - - /** - * Moves the <code>DOM_TreeWalker</code> to the next visible node in document order - * relative to the current node, and returns the new node. If the current node has - * no next node, - * or if the search for nextNode attempts to step upward from the DOM_TreeWalker's - * root node, returns <code>null</code>, and retains the current node. - * - */ - DOM_Node nextNode(); - //@} - - /** @name Set functions. */ - //@{ - /** - * Set the node at which the DOM_TreeWalker is currently positioned. - * - */ - void setCurrentNode(DOM_Node currentNode); - //@} - - - protected: - DOM_TreeWalker(TreeWalkerImpl* impl); - - friend class DOM_Document; - - private: - TreeWalkerImpl* fImpl; -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/DOM_XMLDecl.cpp b/src/xercesc/dom/deprecated/DOM_XMLDecl.cpp deleted file mode 100644 index 2cff9178d1957fcd56c84a23921f5d5babbf10d0..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_XMLDecl.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - - -#include "DOM_XMLDecl.hpp" -#include "XMLDeclImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DOM_XMLDecl::DOM_XMLDecl() : - DOM_Node(null) -{ -}; - - -DOM_XMLDecl::DOM_XMLDecl(const DOM_XMLDecl &other) -: DOM_Node(other) -{ -}; - -DOM_XMLDecl::DOM_XMLDecl(XMLDeclImpl *impl) : - DOM_Node(impl) -{ -}; - -DOM_XMLDecl::~DOM_XMLDecl() -{ -}; - -DOM_XMLDecl & DOM_XMLDecl::operator = (const DOM_XMLDecl &other) -{ - return (DOM_XMLDecl &) DOM_Node::operator = (other); -}; - - -DOM_XMLDecl & DOM_XMLDecl::operator = (const DOM_NullPtr *other) -{ - return (DOM_XMLDecl &) DOM_Node::operator = (other); -}; - -DOMString DOM_XMLDecl::getVersion() const -{ - return DOMString( ((XMLDeclImpl*)fImpl)->getVersion()); -} - -DOMString DOM_XMLDecl::getEncoding() const -{ - return DOMString( ((XMLDeclImpl*)fImpl)->getEncoding()); -} - -DOMString DOM_XMLDecl::getStandalone() const -{ - return DOMString( ((XMLDeclImpl*)fImpl)->getStandalone()); -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DOM_XMLDecl.hpp b/src/xercesc/dom/deprecated/DOM_XMLDecl.hpp deleted file mode 100644 index e98c70432c8a28dca97dcc75f328a228c8cb0ba2..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DOM_XMLDecl.hpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - * -*/ - -#ifndef DOM_XMLDecl_HEADER_GUARD_ -#define DOM_XMLDecl_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class XMLDeclImpl; -/** -* Class to refer to XML Declaration nodes in the DOM. -* -*/ -class DEPRECATED_DOM_EXPORT DOM_XMLDecl: public DOM_Node { - -public: - /** @name Constructors and assignment operators */ - //@{ - /** - * The default constructor for DOM_XMLDecl creates a null - * DOM_XMLDecl object that refers to a declaration node with - * version= 1.0, encoding=utf-8 and standalone=no - * - */ - DOM_XMLDecl(); - - /** - * Copy constructor. Creates a new <code>DOM_XMLDecl</code> that refers to the - * same underlying actual xmlDecl node as the original. - * - * @param other The object to be copied - */ - DOM_XMLDecl(const DOM_XMLDecl &other); - /** - * Assignment operator - * - * @param other The object to be copied - */ - DOM_XMLDecl & operator = (const DOM_XMLDecl &other); - - /** - * Assignment operator. This overloaded variant is provided for - * the sole purpose of setting a DOM_Node reference variable to - * zero. Nulling out a reference variable in this way will decrement - * the reference count on the underlying Node object that the variable - * formerly referenced. This effect is normally obtained when reference - * variable goes out of scope, but zeroing them can be useful for - * global instances, or for local instances that will remain in scope - * for an extended time, when the storage belonging to the underlying - * node needs to be reclaimed. - * - * @param val Only a value of 0, or null, is allowed. - */ - DOM_XMLDecl & operator = (const DOM_NullPtr *val); - - - - //@} - /** @name Destructor */ - //@{ - - /** - * Destructor. The object being destroyed is the reference - * object, not the underlying Document itself. - * - * <p>The reference counting memory management will - * delete the underlying document itself if this - * DOM_XMLDecl is the last remaining to refer to the Document, - * and if there are no remaining references to any of the nodes - * within the document tree. If other live references do remain, - * the underlying document itself remains also. - * - */ - ~DOM_XMLDecl(); - - //@} - - //@{ - - /** - * To get the version string of the xmlDeclaration statement - */ - DOMString getVersion() const; - - /** - * To get the encoding string of the xmlDeclaration statement - */ - DOMString getEncoding() const; - - /** - * To get the standalone string of the xmlDeclaration statement - */ - DOMString getStandalone() const; - - //@} - -protected: - DOM_XMLDecl( XMLDeclImpl *impl); - - friend class DOM_Document; - -}; - - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/DStringPool.cpp b/src/xercesc/dom/deprecated/DStringPool.cpp deleted file mode 100644 index ea139e7dda0f10c5aafab23458f000949a066f37..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DStringPool.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// file DStringPool.cpp -// - -#include "DStringPool.hpp" -#include <xercesc/util/XMLRegisterCleanup.hpp> -#include <xercesc/util/XMLString.hpp> -#include <xercesc/util/PlatformUtils.hpp> - -XERCES_CPP_NAMESPACE_BEGIN - - -// -// DStringPoolEntry - one of these structs is allocated for each -// DOMString in the pool. Each slot in the -// hash table array itself is a pointer to the head -// of a singly-linked list of these structs. -// -struct DStringPoolEntry : public XMemory -{ - DStringPoolEntry *fNext; - DOMString fString; -}; - - - -DStringPool::DStringPool(int hashTableSize, - MemoryManager* const manager) -{ - fHashTableSize = hashTableSize; - fHashTable = (DStringPoolEntry**) manager->allocate - ( - hashTableSize * sizeof(DStringPoolEntry*) - );//new DStringPoolEntry *[hashTableSize]; - fMemoryManager = manager; - for (int i=0; i<fHashTableSize; i++) - fHashTable[i] = 0; -}; - - -// Destructor. Iterate through the pool, deleting each of the -// DSTringPoolEntry structs, then delete the hash -// array itself. -// -DStringPool::~DStringPool() -{ - for (int slot=0; slot<fHashTableSize; slot++) - { - DStringPoolEntry *spe; - DStringPoolEntry *nextSPE; - for (spe=fHashTable[slot]; spe != 0; spe = nextSPE ) - { - // spe->string = 0; - nextSPE = spe->fNext; - delete spe; // Note that this will invoke the destructor - // on spe->fString. - } - } - fMemoryManager->deallocate(fHashTable);//delete [] fHashTable; - fHashTable = 0; -}; - - -const DOMString &DStringPool::getPooledString(const XMLCh *in) -{ - DStringPoolEntry **pspe; - DStringPoolEntry *spe; - - int inHash = XMLString::hash(in, fHashTableSize, fMemoryManager); - pspe = &fHashTable[inHash]; - while (*pspe != 0) - { - if ((*pspe)->fString.equals(in)) - return (*pspe)->fString; - pspe = &((*pspe)->fNext); - } - *pspe = spe = new (fMemoryManager) DStringPoolEntry; - spe->fNext = 0; - spe->fString = DOMString(in); - return spe->fString; -}; - - -const DOMString &DStringPool::getPooledString(const DOMString &in) -{ - DStringPoolEntry **pspe; - DStringPoolEntry *spe; - - const XMLCh *inCharData = in.rawBuffer(); - int inLength = in.length(); - int inHash = XMLString::hashN(inCharData, inLength, fHashTableSize, fMemoryManager); - - pspe = &fHashTable[inHash]; - while (*pspe != 0) - { - if ((*pspe)->fString.equals(in)) - return (*pspe)->fString; - pspe = &((*pspe)->fNext); - } - *pspe = spe = new (fMemoryManager) DStringPoolEntry; - spe->fNext = 0; - spe->fString = DOMString(in); - return spe->fString; -}; - - - -// -// getLiteralString -// -// This is a static function that is somewhat separate from the rest -// of the string pool. It is used to manage the one-time creation of -// static strings that are reused freqently within the DOM implementation. -// This is primarily things like the default names for the various -// node types ("#text" and the like). -// -const DOMString &DStringPool::getStaticString(const char *in - , DOMString **loc - , XMLRegisterCleanup::XMLCleanupFn fn - , XMLRegisterCleanup &clnObj) -{ - if (*loc == 0) - { - DOMString *t = new DOMString(in); // This is one of the very few - // places that a DOMString variable - // is heap allocated. Normal usage - // is to create local instances and - // pass them around by value. - if (XMLPlatformUtils::compareAndSwap((void **)loc, t, 0) != 0) - delete t; - else - { - // Register this string for deletion. Doing each string individually - // may be a little heavyweight, but will work for the time being - // for arranging the deletion of eveything on Termination of XML. - clnObj.registerCleanup(fn); - } - } - return **loc; -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DStringPool.hpp b/src/xercesc/dom/deprecated/DStringPool.hpp deleted file mode 100644 index 2b5d53e4fecb7bd1003ab0ea923656885ad9f387..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DStringPool.hpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - - -// -// file DStringPool.hpp -// - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -#ifndef DStringPool_HEADER_GUARD_ -#define DStringPool_HEADER_GUARD_ - -#include "DOMString.hpp" -#include <xercesc/util/XMLRegisterCleanup.hpp> -#include <xercesc/util/PlatformUtils.hpp> - -XERCES_CPP_NAMESPACE_BEGIN - - -struct DStringPoolEntry; - -// -// DStringPool is a hash table of DOMStrings. -// Each DOM Document maintains a DStringPool containing a DOMString -// for each Element tag name and Attribute Name that has been added -// to the document. When creating additional elements or attributes, -// if the name has been seen before, the already existing string -// will be reused. -// -class DStringPool : public XMemory -{ -public: - DStringPool(int hashTableSize, - MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - ~DStringPool(); - - const DOMString &getPooledString(const DOMString &in); - const DOMString &getPooledString(const XMLCh *in); - - static const DOMString &getStaticString(const char *in - , DOMString **loc - , XMLRegisterCleanup::XMLCleanupFn fn - , XMLRegisterCleanup &clnObj); - -private: - DStringPool(const DStringPool &other); // Copy constructor and assignment - DStringPool& operator = (const DStringPool &other); // of DStringPool are not supported. - - DStringPoolEntry **fHashTable; - int fHashTableSize; - MemoryManager* fMemoryManager; -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/DeepNodeListImpl.cpp b/src/xercesc/dom/deprecated/DeepNodeListImpl.cpp deleted file mode 100644 index 42ad4189ab9a56c8d821f7773a0d8aaa283f31e7..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DeepNodeListImpl.cpp +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DeepNodeListImpl.hpp" -#include "NodeVector.hpp" -#include "NodeImpl.hpp" -#include "ElementImpl.hpp" -#include "DStringPool.hpp" -#include "DocumentImpl.hpp" -#include <limits.h> - -XERCES_CPP_NAMESPACE_BEGIN - - -static DOMString *kAstr = 0; -static XMLRegisterCleanup kAstrCleanup; - -DeepNodeListImpl::DeepNodeListImpl(NodeImpl *rootNod, const DOMString &tagNam) -{ - changes = 0; - this->rootNode = rootNod; - this->tagName = tagNam; - MemoryManager* manager= rootNod->getDocument()->getMemoryManager(); - nodes=new (manager) NodeVector(manager); - matchAll = tagName.equals(DStringPool::getStaticString("*" - , &kAstr - , reinitDeepNodeListImpl - , kAstrCleanup)); - this->namespaceURI = null; //DOM Level 2 - this->matchAllURI = false; //DOM Level 2 - this->matchURIandTagname = false; //DOM Level 2 -}; - - -//DOM Level 2 -DeepNodeListImpl::DeepNodeListImpl(NodeImpl *rootNod, - const DOMString &fNamespaceURI, const DOMString &localName) -{ - changes = 0; - this->rootNode = rootNod; - this->tagName = localName; - MemoryManager* manager = rootNod->getDocument()->getMemoryManager(); - nodes=new (manager) NodeVector(manager); - matchAll = tagName.equals(DStringPool::getStaticString("*" - , &kAstr - , reinitDeepNodeListImpl - , kAstrCleanup)); - - this->namespaceURI = fNamespaceURI; - this->matchAllURI = fNamespaceURI.equals(DStringPool::getStaticString("*" - , &kAstr - , reinitDeepNodeListImpl - , kAstrCleanup)); - - this->matchURIandTagname = true; -}; - - -DeepNodeListImpl::~DeepNodeListImpl() -{ - delete nodes; -}; - - -unsigned int DeepNodeListImpl::getLength() -{ - // Preload all matching elements. (Stops when we run out of subtree!) - item(INT_MAX); - return nodes->size(); -}; - - - -// Start from the first child and count forward, 0-based. index>length-1 -// should return null. -// -// Attempts to do only work actually requested, cache work already -// done, and to flush that cache when the tree has changed. -// -// LIMITATION: ????? Unable to tell relevant tree-changes from -// irrelevant ones. Doing so in a really useful manner would seem -// to involve a tree-walk in its own right, or maintaining our data -// in a parallel tree. -NodeImpl *DeepNodeListImpl::item(unsigned int index) -{ - NodeImpl *thisNode; - - if(rootNode->changes() != changes) - { - nodes->reset(); // Tree changed. Do it all from scratch! - changes = rootNode->changes(); - } - - if(index< nodes->size()) // In the cache - return nodes->elementAt((int) index); - else // Not yet seen - { - if(nodes->size()==0) // Pick up where we left off - thisNode=rootNode; // (Which may be the beginning) - else - thisNode=nodes->lastElement(); - - while(thisNode!=null && index >= nodes->size() && thisNode!=null) - { - thisNode=nextMatchingElementAfter(thisNode); - if(thisNode!=null) - nodes->addElement(thisNode); - } - return thisNode; // Either what we want, or null (not avail.) - } -}; - - - -/* Iterative tree-walker. When you have a Parent link, there's often no -need to resort to recursion. NOTE THAT only Element nodes are matched -since we're specifically supporting getElementsByTagName(). -*/ - -NodeImpl *DeepNodeListImpl::nextMatchingElementAfter(NodeImpl *current) -{ - NodeImpl *next; - while (current != null) - { - // Look down to first child. - if (current->hasChildNodes()) - { - current = current->getFirstChild(); - } - // Look right to sibling (but not from root!) - else - { - if (current != rootNode && null != (next = current->getNextSibling())) - { - current = next; - } - // Look up and right (but not past root!) - else - { - next = null; - for (; current != rootNode; // Stop when we return to starting point - current = current->getParentNode()) - { - next = current->getNextSibling(); - if (next != null) - break; - } - current = next; - } - } - - // Have we found an Element with the right tagName? - // ("*" matches anything.) - if (current != null && current != rootNode && current->isElementImpl()) { - if (!matchURIandTagname) { //DOM Level 1 - if (matchAll || ((ElementImpl *)current)->getTagName().equals(tagName)) - return current; - } else { //DOM Level 2 - if (!matchAllURI && !(current -> getNamespaceURI().equals(namespaceURI))) - continue; - if (matchAll || current -> getLocalName().equals(tagName)) - return current; - } - } - - // Otherwise continue walking the tree - } - // Fell out of tree-walk; no more instances found - return null; -}; - - -// -// unreferenced() The RefCountedImpl base class calls back to this function -// when the ref count goes to zero. -// -// -void DeepNodeListImpl::unreferenced() -{ -// delete this; - DeepNodeListImpl* ptr = this; - delete ptr; -}; - -// ----------------------------------------------------------------------- -// Notification that lazy data has been deleted -// ----------------------------------------------------------------------- -void DeepNodeListImpl::reinitDeepNodeListImpl() { - delete kAstr; - kAstr = 0; -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DeepNodeListImpl.hpp b/src/xercesc/dom/deprecated/DeepNodeListImpl.hpp deleted file mode 100644 index 9fe68323ea5ebdc95ae0fcd01d969d259c392e52..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DeepNodeListImpl.hpp +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef DeepNodeListImpl_HEADER_GUARD_ -#define DeepNodeListImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -#include <xercesc/util/XercesDefs.hpp> -#include "NodeListImpl.hpp" -#include "DOMString.hpp" -#include "NodeImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class NodeImpl; -class NodeVector; - - -class DEPRECATED_DOM_EXPORT DeepNodeListImpl: public NodeListImpl { -private: - NodeImpl *rootNode; - DOMString tagName; - bool matchAll; - int changes; - NodeVector *nodes; - - //DOM Level 2 - DOMString namespaceURI; - bool matchAllURI; - bool matchURIandTagname; //match both namespaceURI and tagName - -public: - DeepNodeListImpl(NodeImpl *rootNode, const DOMString &tagName); - DeepNodeListImpl(NodeImpl *rootNode, //DOM Level 2 - const DOMString &namespaceURI, const DOMString &localName); - virtual ~DeepNodeListImpl(); - virtual unsigned int getLength(); - virtual NodeImpl *item(unsigned int index); - - // ----------------------------------------------------------------------- - // Notification that lazy data has been deleted - // ----------------------------------------------------------------------- - static void reinitDeepNodeListImpl(); - -private: - virtual NodeImpl *nextMatchingElementAfter(NodeImpl *current); - virtual void unreferenced(); -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/DocumentFragmentImpl.cpp b/src/xercesc/dom/deprecated/DocumentFragmentImpl.cpp deleted file mode 100644 index 5dcd01000a5d2376d404f43cbe554e685fd31a1f..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DocumentFragmentImpl.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DocumentFragmentImpl.hpp" -#include "DOM_Node.hpp" -#include "DOM_DOMException.hpp" -#include "DStringPool.hpp" -#include "DocumentImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - - -static DOMString *nam = 0; // Will be lazily initialized to "#document-fragment" -static XMLRegisterCleanup namCleanup; - -DocumentFragmentImpl::DocumentFragmentImpl(DocumentImpl *masterDoc) - : ParentNode(masterDoc) -{ -}; - - -DocumentFragmentImpl::DocumentFragmentImpl(const DocumentFragmentImpl &other, - bool deep) - : ParentNode(other) -{ - if (deep) - cloneChildren(other); -}; - - -DocumentFragmentImpl::~DocumentFragmentImpl() -{ -}; - - - -NodeImpl *DocumentFragmentImpl::cloneNode(bool deep) -{ - return new (getOwnerDocument()->getMemoryManager()) DocumentFragmentImpl(*this, deep); -}; - - -DOMString DocumentFragmentImpl::getNodeName() { - return DStringPool::getStaticString("#document-fragment" - , &nam - , reinitDocumentFragmentImpl - , namCleanup); -} - - -short DocumentFragmentImpl::getNodeType() { - return DOM_Node::DOCUMENT_FRAGMENT_NODE; -}; - - -bool DocumentFragmentImpl::isDocumentFragmentImpl() -{ - return true; -}; - - -// ----------------------------------------------------------------------- -// Notification that lazy data has been deleted -// ----------------------------------------------------------------------- -void DocumentFragmentImpl::reinitDocumentFragmentImpl() { - delete nam; - nam = 0; -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DocumentFragmentImpl.hpp b/src/xercesc/dom/deprecated/DocumentFragmentImpl.hpp deleted file mode 100644 index a67e095a88e40d584ad11e1e2c4bca7a99459ce7..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DocumentFragmentImpl.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef DocumentFragmentImpl_HEADER_GUARD_ -#define DocumentFragmentImpl_HEADER_GUARD_ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -#include <xercesc/util/XercesDefs.hpp> -#include "ParentNode.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DEPRECATED_DOM_EXPORT DocumentFragmentImpl: public ParentNode { -protected: - DocumentFragmentImpl(DocumentImpl *); - -private: - DocumentFragmentImpl(const DocumentFragmentImpl &other, bool deep); - friend class DocumentImpl; - -public: - virtual ~DocumentFragmentImpl(); - virtual NodeImpl *cloneNode(bool deep); - virtual DOMString getNodeName(); - virtual short getNodeType(); - virtual bool isDocumentFragmentImpl(); - - // ----------------------------------------------------------------------- - // Notification that lazy data has been deleted - // ----------------------------------------------------------------------- - static void reinitDocumentFragmentImpl(); -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/DocumentImpl.cpp b/src/xercesc/dom/deprecated/DocumentImpl.cpp deleted file mode 100644 index 1cb81f2846232fc6e2eadebed4b81ec433f6450c..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DocumentImpl.cpp +++ /dev/null @@ -1,844 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// file DocumentImpl.cpp -// - -#include "DocumentImpl.hpp" -#include "DOM_DOMException.hpp" -#include "DOM_Node.hpp" - -#include "DocumentTypeImpl.hpp" -#include "ElementImpl.hpp" -#include "ElementNSImpl.hpp" -#include "AttrImpl.hpp" -#include "AttrNSImpl.hpp" -#include "CDATASectionImpl.hpp" -#include "CommentImpl.hpp" -#include "DocumentFragmentImpl.hpp" -#include "EntityImpl.hpp" -#include "EntityReferenceImpl.hpp" -#include "NotationImpl.hpp" -#include "ProcessingInstructionImpl.hpp" -#include "TextImpl.hpp" -#include "DOM_DOMImplementation.hpp" -#include "DeepNodeListImpl.hpp" -#include "NamedNodeMapImpl.hpp" -#include "DStringPool.hpp" -#include <xercesc/internal/XMLReader.hpp> -#include "TreeWalkerImpl.hpp" -#include "NodeIteratorImpl.hpp" -#include "NodeIDMap.hpp" -#include "DOM_Document.hpp" -#include <xercesc/util/HashPtr.hpp> -#include "RangeImpl.hpp" -#include "DOM_Document.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -static DOMString *nam = 0; // will be lazily initialized to "#document" -static XMLRegisterCleanup namCleanup; - -DocumentImpl::DocumentImpl(MemoryManager* const manager) - : ParentNode(this) - , docType(0) - , docElement(0) - , namePool(0) - , fNodeIDMap(0) - , iterators(0) - , treeWalkers(0) - , userData(0) - , ranges(0) - , fChanges(0) - , errorChecking(true) - , fMemoryManager(manager) -{ - namePool = new (fMemoryManager) DStringPool(257, fMemoryManager); -}; - - -//DOM Level 2 -DocumentImpl::DocumentImpl(const DOMString &fNamespaceURI, - const DOMString &qualifiedName, - DocumentTypeImpl *doctype, - MemoryManager* const manager) - : ParentNode(this) - , docType(0) - , docElement(0) - , namePool(0) - , fNodeIDMap(0) - , iterators(0) - , treeWalkers(0) - , userData(0) - , ranges(0) - , fChanges(0) - , errorChecking(true) - , fMemoryManager(manager) -{ - setDocumentType(doctype); - namePool = new (fMemoryManager) DStringPool(257, fMemoryManager); - appendChild(createElementNS(fNamespaceURI, qualifiedName)); //root element -} - -void DocumentImpl::setDocumentType(DocumentTypeImpl *doctype) -{ - if (!doctype) - return; - - if (doctype->getOwnerDocument() != null) - throw DOM_DOMException( //one doctype can belong to only one DocumentImpl - DOM_DOMException::WRONG_DOCUMENT_ERR, null); - - doctype->setOwnerDocument(this); - doctype->getEntities()->ownerNode->setOwnerDocument(this); - doctype->getNotations()->ownerNode->setOwnerDocument(this); - doctype -> referenced(); // Warning, tricky! An external (DOM_Node) reference - // to a node normally bumps the reference count to its - // document also. But this could not happen when the - // user created the DOM_DocumentType because there was - // no document yet. Now we have the document, and - // the docs ref count must be got back in sync. - - - appendChild(doctype); - -} - -DocumentImpl::~DocumentImpl() -{ - if (iterators != 0L) { - // The data in the vector is pointers owned by smart pointers, and will be cleaned up when they go away. - delete iterators; - } - - if (treeWalkers != 0L) { - // The data in the vector is pointers owned by smart pointers, and will be cleaned up when they go away. - delete treeWalkers; - } - - if (ranges != 0L) { - delete ranges; - ranges = 0; - } - - if (userData) { - // make sure we won't access userData any further - hasUserData(false); - delete userData; - } - - delete namePool; - // Do not delete docType and docElement pointers here. - // These are also normal child nodes of the document, - // and refcounting will take them out in the usual way. - - delete fNodeIDMap; -}; - - -NodeImpl *DocumentImpl::cloneNode(bool deep) { - - // clone the node itself - DocumentImpl *newdoc = new (fMemoryManager) DocumentImpl(fMemoryManager); - - // then the children by _importing_ them - if (deep) { - for (ChildNode *n = firstChild; n != null; n = n->nextSibling) { - newdoc->appendChild(newdoc->importNode(n, true)); - } - } - newdoc->setErrorChecking(errorChecking); - return newdoc; -}; - - -DOMString DocumentImpl::getNodeName() { - return DStringPool::getStaticString("#document" - , &nam - , reinitDocumentImpl - , namCleanup); -} - - -short DocumentImpl::getNodeType() { - return DOM_Node::DOCUMENT_NODE; -}; - - -// even though ownerDocument refers to this in this implementation -// the DOM Level 2 spec says it must be null, so make it appear so -DocumentImpl * DocumentImpl::getOwnerDocument() { - return null; -} - - -bool DocumentImpl::isDocumentImpl() { - return true; -}; - - -AttrImpl *DocumentImpl::createAttribute(const DOMString &nam) -{ - if (errorChecking && !isXMLName(nam)) { - throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR,null); - } - return new (fMemoryManager) AttrImpl(this,nam); -}; - - - -CDATASectionImpl *DocumentImpl::createCDATASection(const DOMString &data) { - return new (fMemoryManager) CDATASectionImpl(this,data); -}; - - - -CommentImpl *DocumentImpl::createComment(const DOMString &data) -{ - return new (fMemoryManager) CommentImpl(this,data); -}; - - - -DocumentFragmentImpl *DocumentImpl::createDocumentFragment() -{ - return new (fMemoryManager) DocumentFragmentImpl(this); -}; - - - -DocumentTypeImpl *DocumentImpl::createDocumentType(const DOMString &nam) -{ - if (errorChecking && !isXMLName(nam)) { - throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR, null); - } - return new (fMemoryManager) DocumentTypeImpl(this, nam); -}; - - - -DocumentTypeImpl * - DocumentImpl::createDocumentType(const DOMString &qualifiedName, - const DOMString &publicId, - const DOMString &systemId) -{ - if (errorChecking && !isXMLName(qualifiedName)) { - throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR, null); - } - return new (fMemoryManager) DocumentTypeImpl(this, qualifiedName, publicId, systemId); -}; - - - -ElementImpl *DocumentImpl::createElement(const DOMString &tagName) -{ - if (errorChecking && !isXMLName(tagName)) { - throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR,null); - } - DOMString pooledTagName = this->namePool->getPooledString(tagName); - return new (fMemoryManager) ElementImpl(this,pooledTagName); -}; - - -ElementImpl *DocumentImpl::createElement(const XMLCh *tagName) -{ - DOMString pooledTagName = this->namePool->getPooledString(tagName); - return new (fMemoryManager) ElementImpl(this,pooledTagName); -}; - - - - -EntityImpl *DocumentImpl::createEntity(const DOMString &nam) -{ - if (errorChecking && !isXMLName(nam)) { - throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR, null); - } - return new (fMemoryManager) EntityImpl(this, nam); -}; - - - -EntityReferenceImpl *DocumentImpl::createEntityReference(const DOMString &nam) -{ - if (errorChecking && !isXMLName(nam)) { - throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR, null); - } - return new (fMemoryManager) EntityReferenceImpl(this, nam); -}; - - - -NotationImpl *DocumentImpl::createNotation(const DOMString &nam) -{ - if (errorChecking && !isXMLName(nam)) { - throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR, null); - } - return new (fMemoryManager) NotationImpl(this, nam); -}; - - - -ProcessingInstructionImpl *DocumentImpl::createProcessingInstruction( - const DOMString &target, const DOMString &data) -{ - if (errorChecking && !isXMLName(target)) { - throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR,null); - } - return new (fMemoryManager) ProcessingInstructionImpl(this,target,data); -}; - - - - -TextImpl *DocumentImpl::createTextNode(const DOMString &data) -{ - return new (fMemoryManager) TextImpl(this,data); -}; - - -NodeIteratorImpl* DocumentImpl::createNodeIterator (DOM_Node root, - unsigned long whatToShow, - DOM_NodeFilter* filter, - bool entityReferenceExpansion, - MemoryManager* const manager) -{ - // Create the node iterator implementation object. - // Add it to the vector of iterators that must be synchronized when a node is deleted. - // The vector of iterators is kept in the "owner document" if there is one. If there isn't one, I assume that root is the - // owner document. - - NodeIteratorImpl* iter = new (manager) NodeIteratorImpl(root, whatToShow, filter, entityReferenceExpansion); - DOM_Document doc = root.getOwnerDocument(); - DocumentImpl* impl; - - if (! doc.isNull()) { - impl = (DocumentImpl *) doc.fImpl; - } - else - impl = (DocumentImpl *) root.fImpl; - - if (impl->iterators == 0L) { - impl->iterators = new (manager) NodeIterators(1, false, manager); - impl->iterators->addElement(iter); - } - - return iter; -} - - -TreeWalkerImpl* DocumentImpl::createTreeWalker (DOM_Node root, unsigned long whatToShow, - DOM_NodeFilter* filter, - bool entityReferenceExpansion, - MemoryManager* const manager) -{ - // See notes for createNodeIterator... - - TreeWalkerImpl* twi = new (manager) TreeWalkerImpl(root, whatToShow, filter, entityReferenceExpansion); - DOM_Document doc = root.getOwnerDocument(); - DocumentImpl* impl; - - if (! doc.isNull()) { - impl = (DocumentImpl *) doc.fImpl; - } - else - impl = (DocumentImpl *) root.fImpl; - - if (impl->treeWalkers == 0L) { - impl->treeWalkers = new (manager) TreeWalkers(1, false, manager); - impl->treeWalkers->addElement(twi); - } - - return twi; -} - - - - -DocumentTypeImpl *DocumentImpl::getDoctype() -{ - return docType; -}; - - - -ElementImpl *DocumentImpl::getDocumentElement() -{ - return docElement; -}; - - - -DeepNodeListImpl *DocumentImpl::getElementsByTagName(const DOMString &tagname) -{ - return new (fMemoryManager) DeepNodeListImpl(this,tagname); -}; - - - -NodeImpl *DocumentImpl::insertBefore(NodeImpl *newChild, NodeImpl *refChild) -{ - // Only one such child permitted - if (errorChecking && - ((newChild->isElementImpl() && docElement!=null) || - (newChild->isDocumentTypeImpl() && docType!=null))) { - throw DOM_DOMException(DOM_DOMException::HIERARCHY_REQUEST_ERR,null); - } - ParentNode::insertBefore(newChild,refChild); - - // If insert succeeded, cache the kid appropriately - if(newChild->isElementImpl()) - docElement=(ElementImpl *)newChild; - else if(newChild->isDocumentTypeImpl()) - docType=(DocumentTypeImpl *)newChild; - - return newChild; -}; - - - -bool DocumentImpl::isXMLName(const DOMString &s) -{ - return XMLChar1_0::isValidName(s.rawBuffer(),s.length()); -}; - - -// referenced(). Override this function here in class DocumentImpl because -// we don't want the action taken in NodeImpl, which is -// to add a reference to the node's owning document. -// -void DocumentImpl::referenced() -{ - // Intentionally empty. -}; - - - -NodeImpl *DocumentImpl::removeChild(NodeImpl *oldChild) -{ - ParentNode::removeChild(oldChild); - - // If remove succeeded, un-cache the kid appropriately - if(oldChild->isElementImpl()) - docElement=null; - else if(oldChild->isDocumentTypeImpl()) - docType=null; - - return oldChild; -}; - - -// -// unreferenced() will be called whenever the refernce count on -// this document goes from 1 to 0. In all cases, when this -// happens to a document node (which is the case here), it -// is time to actually delete the document. -// -// See also NodeImpl::referenced() and unreferenced(), which -// update document node ref counts based on references coming -// or going to nodes owned by the document. -// -void DocumentImpl::unreferenced() -{ - deleteIf(this); -}; - - -//Introduced in DOM Level 2 - -NodeImpl *DocumentImpl::importNode(NodeImpl *source, bool deep) -{ - NodeImpl *newnode=null; - bool oldErrorCheckingFlag = errorChecking; - - switch (source->getNodeType()) - { - case DOM_Node::ELEMENT_NODE : - { - ElementImpl *newelement; - if (source->getLocalName() == null) - newelement = createElement(source->getNodeName()); - else - newelement = createElementNS(source->getNamespaceURI(), - source->getNodeName()); - NamedNodeMapImpl *srcattr=source->getAttributes(); - if (srcattr!=null) - for(unsigned int i=0;i<srcattr->getLength();++i) - { - AttrImpl *attr = (AttrImpl *) srcattr->item(i); - AttrImpl * pOldAttr = null; - if (attr -> getSpecified()) - { // not a default attribute - AttrImpl *nattr = (AttrImpl *) importNode(attr, true); - if (attr -> getLocalName() == null) - pOldAttr = newelement->setAttributeNode(nattr); - else - pOldAttr = newelement->setAttributeNodeNS(nattr); - - if (pOldAttr) - { - if (pOldAttr->nodeRefCount == 0) - NodeImpl::deleteIf(pOldAttr); - } - } - } - - newnode=newelement; - } - break; - case DOM_Node::ATTRIBUTE_NODE : - { - if (source->getLocalName() == null) - newnode = createAttribute(source->getNodeName()); - else - newnode = createAttributeNS(source->getNamespaceURI(), - source->getNodeName()); - // if source is an AttrImpl from this very same implementation - // avoid creating the child nodes if possible -// if (source instanceof AttrImpl) { - AttrImpl *attr = (AttrImpl *) source; - if (attr->hasStringValue()) { - AttrImpl *newattr = (AttrImpl *) newnode; - newattr->setValue(attr->getValue()); - deep = false; - } - else { - deep = true; - } -// } -// else { -// // Kids carry value -// deep = true; -// } - } - break; - case DOM_Node::TEXT_NODE : - newnode = createTextNode(source->getNodeValue()); - break; - case DOM_Node::CDATA_SECTION_NODE : - newnode = createCDATASection(source->getNodeValue()); - break; - case DOM_Node::ENTITY_REFERENCE_NODE : - { - EntityReferenceImpl* newentityRef = createEntityReference(source->getNodeName()); - newnode=newentityRef; - errorChecking = false; - newentityRef->setReadOnly(false, true); //allow deep import temporarily - } - break; - case DOM_Node::ENTITY_NODE : - { - EntityImpl *srcentity=(EntityImpl *)source; - EntityImpl *newentity = createEntity(source->getNodeName()); - newentity->setPublicId(srcentity->getPublicId()); - newentity->setSystemId(srcentity->getSystemId()); - newentity->setNotationName(srcentity->getNotationName()); - // Kids carry additional value - newnode=newentity; - newentity->setReadOnly(false, true);// allow deep import temporarily - } - break; - case DOM_Node::PROCESSING_INSTRUCTION_NODE : - newnode = createProcessingInstruction(source->getNodeName(), - source->getNodeValue()); - break; - case DOM_Node::COMMENT_NODE : - newnode = createComment(source->getNodeValue()); - break; - case DOM_Node::DOCUMENT_TYPE_NODE : - { - DocumentTypeImpl *srcdoctype = (DocumentTypeImpl *)source; - DocumentTypeImpl *newdoctype = (DocumentTypeImpl *) - createDocumentType(srcdoctype->getNodeName(), - srcdoctype->getPublicId(), - srcdoctype->getSystemId()); - // Values are on NamedNodeMaps - NamedNodeMapImpl *smap = srcdoctype->getEntities(); - NamedNodeMapImpl *tmap = newdoctype->getEntities(); - if(smap != null) { - for(unsigned int i = 0; i < smap->getLength(); i++) { - tmap->setNamedItem(importNode(smap->item(i), true)); - } - } - smap = srcdoctype->getNotations(); - tmap = newdoctype->getNotations(); - if (smap != null) { - for(unsigned int i = 0; i < smap->getLength(); i++) { - tmap->setNamedItem(importNode(smap->item(i), true)); - } - } - // NOTE: At this time, the DOM definition of DocumentType - // doesn't cover Elements and their Attributes. domimpl's - // extentions in that area will not be preserved, even if - // copying from domimpl to domimpl. We could special-case - // that here. Arguably we should. Consider. ????? - newnode = newdoctype; - } - break; - case DOM_Node::DOCUMENT_FRAGMENT_NODE : - newnode = createDocumentFragment(); - // No name, kids carry value - break; - case DOM_Node::NOTATION_NODE : - { - NotationImpl *srcnotation=(NotationImpl *)source; - NotationImpl *newnotation = createNotation(source->getNodeName()); - newnotation->setPublicId(srcnotation->getPublicId()); - newnotation->setSystemId(srcnotation->getSystemId()); - // Kids carry additional value - newnode=newnotation; - // No name, no value - break; - } - - case DOM_Node::DOCUMENT_NODE : // Document can't be child of Document - default: // Unknown node type - throw DOM_DOMException(DOM_DOMException::NOT_SUPPORTED_ERR, null); - } - - // If deep, replicate and attach the kids. - if (deep) - for (NodeImpl *srckid = source->getFirstChild(); - srckid != null; - srckid = srckid->getNextSibling()) { - newnode->appendChild(importNode(srckid, true)); - } - if (newnode->getNodeType() == DOM_Node::ENTITY_REFERENCE_NODE - || newnode->getNodeType() == DOM_Node::ENTITY_NODE) { - ((EntityReferenceImpl*)newnode)->setReadOnly(true, true); - errorChecking = oldErrorCheckingFlag; - } - - return newnode; -}; - - -ElementImpl *DocumentImpl::createElementNS(const DOMString &fNamespaceURI, - const DOMString &qualifiedName) -{ - if (errorChecking && !isXMLName(qualifiedName)) { - throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR,null); - } - //DOMString pooledTagName = this->namePool->getPooledString(qualifiedName); - return new (fMemoryManager) ElementNSImpl(this, fNamespaceURI, qualifiedName); -} - - -AttrImpl *DocumentImpl::createAttributeNS(const DOMString &fNamespaceURI, - const DOMString &qualifiedName) -{ - if (!isXMLName(qualifiedName)) { - throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR,null); - } - return new (fMemoryManager) AttrNSImpl(this, fNamespaceURI, qualifiedName); -} - - -DeepNodeListImpl *DocumentImpl::getElementsByTagNameNS(const DOMString &fNamespaceURI, - const DOMString &fLocalName) -{ - return new (fMemoryManager) DeepNodeListImpl(this, fNamespaceURI, fLocalName); -} - - -ElementImpl *DocumentImpl::getElementById(const DOMString &elementId) -{ - if (fNodeIDMap == 0) - return null; - - AttrImpl *theAttr = fNodeIDMap->find(elementId); - if (theAttr == null) - return null; - - return theAttr->getOwnerElement(); -} - - -//Return the index > 0 of ':' in the given qualified name qName="prefix:localName". -//Return 0 if there is no ':', or -1 if qName is malformed such as ":abcd". -int DocumentImpl::indexofQualifiedName(const DOMString & qName) -{ - //Check if s = prefix:localName, name or malformed - const XMLCh *qNameP = qName.rawBuffer(); - int qNameLen = qName.length(); //note: qName[qNameLen] may not be 0 - int index = -1, count = 0; - for (int i = 0; i < qNameLen; ++i) - if (*qNameP++ == chColon) { - index = i; - ++count; //number of ':' found - } - if (qNameLen == 0 || count > 1 || index == 0 || index == qNameLen-1) - return -1; - return count == 0 ? 0 : index; -} - - -XMLDeclImpl* DocumentImpl::createXMLDecl(const DOMString& version, const DOMString& encoding, const DOMString& standalone) -{ - return new (fMemoryManager) XMLDeclImpl(this, version, encoding, standalone); -} - -RangeImpl* DocumentImpl::createRange() -{ - - RangeImpl* range = new (fMemoryManager) RangeImpl(DOM_Document(this)); - - if (ranges == 0L) { - ranges = new (fMemoryManager) RangeImpls(1, false, fMemoryManager); - } - ranges->addElement(range); - return range; -} - -RangeImpls* DocumentImpl::getRanges() -{ - return ranges; -} - -void DocumentImpl::removeRange(RangeImpl* range) -{ - if (ranges != null) { - unsigned int sz = ranges->size(); - if (sz !=0) { - for (unsigned int i =0; i<sz; i++) { - if (ranges->elementAt(i) == range) { - ranges->removeElementAt(i); - delete range; - break; - } - } - } - } -} - -/** Uses the kidOK lookup table to check whether the proposed - tree structure is legal. - - ????? It feels like there must be a more efficient solution, - but for the life of me I can't think what it would be. -*/ -bool DocumentImpl::isKidOK(NodeImpl *parent, NodeImpl *child) -{ - static int kidOK[14]; - - if (kidOK[DOM_Node::DOCUMENT_NODE] == 0) - { - kidOK[DOM_Node::DOCUMENT_NODE] = - 1 << DOM_Node::ELEMENT_NODE | - 1 << DOM_Node::PROCESSING_INSTRUCTION_NODE | - 1 << DOM_Node::COMMENT_NODE | - 1 << DOM_Node::DOCUMENT_TYPE_NODE | - 1 << DOM_Node::XML_DECL_NODE; - - kidOK[DOM_Node::DOCUMENT_FRAGMENT_NODE] = - kidOK[DOM_Node::ENTITY_NODE] = - kidOK[DOM_Node::ENTITY_REFERENCE_NODE] = - kidOK[DOM_Node::ELEMENT_NODE] = - 1 << DOM_Node::ELEMENT_NODE | - 1 << DOM_Node::PROCESSING_INSTRUCTION_NODE | - 1 << DOM_Node::COMMENT_NODE | - 1 << DOM_Node::TEXT_NODE | - 1 << DOM_Node::CDATA_SECTION_NODE | - 1 << DOM_Node::ENTITY_REFERENCE_NODE | - 1 << DOM_Node::XML_DECL_NODE; - - kidOK[DOM_Node::ATTRIBUTE_NODE] = - 1 << DOM_Node::TEXT_NODE | - 1 << DOM_Node::ENTITY_REFERENCE_NODE; - - kidOK[DOM_Node::PROCESSING_INSTRUCTION_NODE] = - kidOK[DOM_Node::COMMENT_NODE] = - kidOK[DOM_Node::TEXT_NODE] = - kidOK[DOM_Node::CDATA_SECTION_NODE] = - kidOK[DOM_Node::NOTATION_NODE] = - 0; - }; - int p=parent->getNodeType(); - int ch = child->getNodeType(); - return (kidOK[p] & 1<<ch) != 0; -} - -void DocumentImpl::setUserData(NodeImpl* n, void* data) -{ - if (!userData && data) - userData = new (fMemoryManager) RefHashTableOf<void> - ( - 29 - , false - , new (fMemoryManager) HashPtr() - , fMemoryManager - ); - if (userData) - { - if (!data) - userData->removeKey((void*)n); - else - userData->put((void*)n,data); - } -} - -void* DocumentImpl::getUserData(NodeImpl* n) -{ - if (userData) - return userData->get((void*)n); - else - return null; -} - -void* DocumentImpl::getUserData() -{ - return (hasUserData()) ? getUserData(this) : null; -} - -void DocumentImpl::setUserData(void* val) -{ - setUserData(this, val); - if (val) - hasUserData(true); - else - hasUserData(false); -}; - -/** - * Denotes that this node has changed. - */ -void DocumentImpl::changed() { - fChanges++; -} - -/** - * Returns the number of changes to this node. - */ -int DocumentImpl::changes() { - return fChanges; -} - -// ----------------------------------------------------------------------- -// Notification that lazy data has been deleted -// ----------------------------------------------------------------------- -void DocumentImpl::reinitDocumentImpl() { - delete nam; - nam = 0; -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DocumentImpl.hpp b/src/xercesc/dom/deprecated/DocumentImpl.hpp deleted file mode 100644 index 2d656c0745bc6f1dba232850bc2e091340a9372e..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DocumentImpl.hpp +++ /dev/null @@ -1,250 +0,0 @@ -#ifndef DocumentImpl_HEADER_GUARD_ -#define DocumentImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -#include <xercesc/util/XercesDefs.hpp> -#include "ParentNode.hpp" -#include "DOM_Node.hpp" -#include "DOM_Element.hpp" -#include "xercesc/util/RefVectorOf.hpp" -#include "xercesc/util/RefHashTableOf.hpp" -#include "XMLDeclImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DocumentTypeImpl; -class ElementImpl; -class AttrImpl; -class CDATASectionImpl; -class CommentImpl; -class DeepNodeListImpl; -class DocumentFragmentImpl; -class DocumentTypeImpl; -class DStringPool; -class EntityImpl; -class EntityReferenceImpl; -class NotationImpl; -class ProcessingInstructionImpl; -class TextImpl; -class NodeIteratorImpl; -class TreeWalkerImpl; -class DOM_NodeFilter; -class NodeFilterImpl; -class DOM_DOMImplementation; -class DOMString; -class NodeIDMap; -class RangeImpl; - -typedef RefVectorOf<NodeIteratorImpl> NodeIterators; -typedef RefVectorOf<TreeWalkerImpl> TreeWalkers; -typedef RefVectorOf<RangeImpl> RangeImpls; - - -class DEPRECATED_DOM_EXPORT DocumentImpl: public ParentNode { -private: - // ----------------------------------------------------------------------- - // Private data types - // ----------------------------------------------------------------------- - - void setDocumentType(DocumentTypeImpl *doctype); - - DocumentTypeImpl *docType; - ElementImpl *docElement; - DStringPool *namePool; - NodeIDMap *fNodeIDMap; // for use by GetElementsById(). - - NodeIterators *iterators; - TreeWalkers *treeWalkers; - RefHashTableOf<void> *userData; - RangeImpls *ranges; - - /** - * Number of alterations made to this document since its creation. - * Serves as a "dirty bit" so that live objects such as NodeList can - * recognize when an alteration has been made and discard its cached - * state information. - * <p> - * Any method that alters the tree structure MUST cause or be - * accompanied by a call to changed(), to inform it that any outstanding - * NodeLists may have to be updated. - * <p> - * (Required because NodeList is simultaneously "live" and integer- - * indexed -- a bad decision in the DOM's design.) - * <p> - * Note that changes which do not affect the tree's structure -- changing - * the node's name, for example -- do _not_ have to call changed(). - * <p> - * Alternative implementation would be to use a cryptographic - * Digest value rather than a count. This would have the advantage that - * "harmless" changes (those producing equal() trees) would not force - * NodeList to resynchronize. Disadvantage is that it's slightly more prone - * to "false negatives", though that's the difference between "wildly - * unlikely" and "absurdly unlikely". IF we start maintaining digests, - * we should consider taking advantage of them. - * - * Note: This used to be done a node basis, so that we knew what - * subtree changed. But since only DeepNodeList really use this today, - * the gain appears to be really small compared to the cost of having - * an int on every (parent) node plus having to walk up the tree all the - * way to the root to mark the branch as changed everytime a node is - * changed. - * So we now have a single counter global to the document. It means that - * some objects may flush their cache more often than necessary, but this - * makes nodes smaller and only the document needs to be marked as changed. - */ - int fChanges; - - /** Bypass error checking. */ - bool errorChecking; - - MemoryManager *fMemoryManager; - - friend class NodeIteratorImpl; - friend class TreeWalkerImpl; - friend class RangeImpl; - friend class DOMParser; - -public: - DocumentImpl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - DocumentImpl(const DOMString &namespaceURI, //DOM Level 2 - const DOMString &qualifiedName, - DocumentTypeImpl *doctype, - MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - virtual ~DocumentImpl(); - virtual bool isDocumentImpl(); // RTTI replacement function - - virtual NodeImpl *cloneNode(bool deep); - virtual DOMString getNodeName(); - virtual short getNodeType(); - virtual DocumentImpl * getOwnerDocument(); - virtual AttrImpl *createAttribute(const DOMString &name); - virtual CDATASectionImpl *createCDATASection(const DOMString &data); - virtual CommentImpl *createComment(const DOMString &data); - virtual DocumentFragmentImpl *createDocumentFragment(); - virtual DocumentTypeImpl *createDocumentType(const DOMString &name); - virtual DocumentTypeImpl *createDocumentType(const DOMString &qName, - const DOMString &publicId, - const DOMString &systemId); - virtual ElementImpl *createElement(const DOMString & tagName); - virtual ElementImpl *createElement(const XMLCh *tagName); - virtual EntityImpl *createEntity(const DOMString & name); - virtual EntityReferenceImpl *createEntityReference(const DOMString & name); - virtual NotationImpl *createNotation(const DOMString & name); - virtual ProcessingInstructionImpl *createProcessingInstruction(const DOMString & target, const DOMString & data); - virtual TextImpl *createTextNode(const DOMString & data); - virtual DocumentTypeImpl *getDoctype(); - virtual ElementImpl *getDocumentElement(); - virtual DeepNodeListImpl *getElementsByTagName(const DOMString & tagname); - virtual NodeImpl *insertBefore(NodeImpl *newChild, NodeImpl *refChild); - bool isXMLName(const DOMString & s); - virtual void referenced(); - virtual NodeImpl *removeChild(NodeImpl *oldChild); - virtual void unreferenced(); - static NodeIteratorImpl* createNodeIterator(DOM_Node root, unsigned long whatToShow, DOM_NodeFilter* filter, bool entityReferenceExpansion, - MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - static TreeWalkerImpl* createTreeWalker(DOM_Node root, unsigned long whatToShow, DOM_NodeFilter* filter, bool entityReferenceExpansion, - MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - virtual XMLDeclImpl* createXMLDecl(const DOMString& version, const DOMString& encoding, const DOMString& standalone); - virtual void* getUserData(); - virtual void setUserData(void* value); - virtual RangeImpl* createRange(); - virtual RangeImpls* getRanges(); //non-standard api - virtual void removeRange(RangeImpl* range); //non-standard api - - - // helper functions to prevent storing userdata pointers on every node. - virtual void setUserData(NodeImpl* n, void* data); - virtual void* getUserData(NodeImpl* n); - - //Introduced in DOM Level 2 - virtual NodeImpl *importNode(NodeImpl *source, bool deep); - virtual ElementImpl *createElementNS(const DOMString &namespaceURI, - const DOMString &qualifiedName); - virtual AttrImpl *createAttributeNS(const DOMString &namespaceURI, - const DOMString &qualifiedName); - virtual DeepNodeListImpl *getElementsByTagNameNS(const DOMString &namespaceURI, - const DOMString &localName); - virtual ElementImpl *getElementById(const DOMString &elementId); - - //Return the index > 0 of ':' in the given qualified name qName="prefix:localName". - //Return 0 if there is no ':', or -1 if qName is malformed such as ":abcd". - static int indexofQualifiedName(const DOMString & qName); - static bool isKidOK(NodeImpl *parent, NodeImpl *child); - - inline NodeIDMap * getNodeIDMap() {return fNodeIDMap;}; - - virtual void changed(); - virtual int changes(); - - /** - * Sets whether the DOM implementation performs error checking - * upon operations. Turning off error checking only affects - * the following DOM checks: - * <ul> - * <li>Checking strings to make sure that all characters are - * legal XML characters - * <li>Hierarchy checking such as allowed children, checks for - * cycles, etc. - * </ul> - * <p> - * Turning off error checking does <em>not</em> turn off the - * following checks: - * <ul> - * <li>Read only checks - * <li>Checks related to DOM events - * </ul> - */ - inline void setErrorChecking(bool check) { - errorChecking = check; - } - - /** - * Returns true if the DOM implementation performs error checking. - */ - inline bool getErrorChecking() { - return errorChecking; - } - - inline MemoryManager* getMemoryManager() const { - return fMemoryManager; - } - - // ----------------------------------------------------------------------- - // Notification that lazy data has been deleted - // ----------------------------------------------------------------------- - static void reinitDocumentImpl(); - -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/DocumentTypeImpl.cpp b/src/xercesc/dom/deprecated/DocumentTypeImpl.cpp deleted file mode 100644 index bef08b275bf7efd2c91be0d7fb841aa668aaca61..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DocumentTypeImpl.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DocumentTypeImpl.hpp" -#include "DOM_Node.hpp" -#include "NamedNodeMapImpl.hpp" -#include "DOM_DOMException.hpp" -#include "DocumentImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -DocumentTypeImpl::DocumentTypeImpl(DocumentImpl *ownerDoc, - const DOMString &dtName) - : ParentNode(ownerDoc), - publicId(null), systemId(null), internalSubset(null) //DOM Level 2 - , intSubsetReading(false) -{ - name = dtName.clone(); - entities = new NamedNodeMapImpl(this); - notations = new NamedNodeMapImpl(this); - elements = new NamedNodeMapImpl(this); - -}; - - -//Introduced in DOM Level 2 -DocumentTypeImpl::DocumentTypeImpl(DocumentImpl *ownerDoc, - const DOMString &qualifiedName, - const DOMString &pubId, - const DOMString &sysId) - : ParentNode(ownerDoc), - publicId(pubId), systemId(sysId), internalSubset(null) - , intSubsetReading(false) -{ - name = qualifiedName.clone(); - if (DocumentImpl::indexofQualifiedName(qualifiedName) < 0) - throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - - entities = new NamedNodeMapImpl(this); - notations= new NamedNodeMapImpl(this); - elements = new NamedNodeMapImpl(this); -}; - - -DocumentTypeImpl::DocumentTypeImpl(const DocumentTypeImpl &other, bool deep) - : ParentNode(other) -{ - name = other.name.clone(); - if (deep) - cloneChildren(other); - entities = other.entities->cloneMap(this); - notations= other.notations->cloneMap(this); - elements = other.elements->cloneMap(this); - - //DOM Level 2 - publicId = other.publicId.clone(); - systemId = other.systemId.clone(); - internalSubset = other.internalSubset.clone(); - intSubsetReading = other.intSubsetReading; -}; - - -DocumentTypeImpl::~DocumentTypeImpl() -{ - if (entities != null) - { - entities->removeAll(); - NamedNodeMapImpl::removeRef(entities); - } - - if (notations != null) - { - notations->removeAll(); - NamedNodeMapImpl::removeRef(notations); - } - if (elements != null) - { - elements->removeAll(); - NamedNodeMapImpl::removeRef(elements); - } -}; - - -NodeImpl *DocumentTypeImpl::cloneNode(bool deep) -{ - return new DocumentTypeImpl(*this, deep); -}; - -/** - * NON-DOM - * set the ownerDocument of this node and its children - */ -void DocumentTypeImpl::setOwnerDocument(DocumentImpl *doc) { - ParentNode::setOwnerDocument(doc); - entities->setOwnerDocument(doc); - notations->setOwnerDocument(doc); - // elements->setOwnerDocument(doc); -} - -DOMString DocumentTypeImpl::getNodeName() -{ - return name; -}; - - -short DocumentTypeImpl::getNodeType() { - return DOM_Node::DOCUMENT_TYPE_NODE; -}; - - -NamedNodeMapImpl *DocumentTypeImpl::getEntities() -{ - return entities; -}; - -NamedNodeMapImpl *DocumentTypeImpl::getElements() -{ - return elements; -}; - -DOMString DocumentTypeImpl::getName() -{ - return name; -}; - - -NamedNodeMapImpl *DocumentTypeImpl::getNotations() -{ - return notations; -}; - - -bool DocumentTypeImpl::isDocumentTypeImpl() -{ - return true; -}; - - -void DocumentTypeImpl::setReadOnly(bool readOnl, bool deep) -{ - ParentNode::setReadOnly(readOnl,deep); - entities->setReadOnly(readOnl,true); - notations->setReadOnly(readOnl,true); -}; - - -//Introduced in DOM Level 2 - -DOMString DocumentTypeImpl::getPublicId() -{ - return publicId; -} - - -DOMString DocumentTypeImpl::getSystemId() -{ - return systemId; -} - - -DOMString DocumentTypeImpl::getInternalSubset() -{ - return internalSubset; -} - -bool DocumentTypeImpl::isIntSubsetReading() -{ - return intSubsetReading; -} - - -//set functions - -void DocumentTypeImpl::setPublicId(const DOMString& value) -{ - if (value == 0) - return; - publicId = value.clone(); -} - -void DocumentTypeImpl::setSystemId(const DOMString& value) -{ - if (value == 0) - return; - systemId = value.clone(); -} - -void DocumentTypeImpl::setInternalSubset(const DOMString &value) -{ - if (value == 0) - return; - internalSubset = value.clone(); -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DocumentTypeImpl.hpp b/src/xercesc/dom/deprecated/DocumentTypeImpl.hpp deleted file mode 100644 index 572bf93f67332790749d06ab76b1492a17b845d1..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DocumentTypeImpl.hpp +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef DocumentTypeImpl_HEADER_GUARD_ -#define DocumentTypeImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - - -#include <xercesc/util/XercesDefs.hpp> -#include "ParentNode.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class NamedNodeMapImpl; - -class DEPRECATED_DOM_EXPORT DocumentTypeImpl: public ParentNode { -private: - DOMString name; - NamedNodeMapImpl *entities; - NamedNodeMapImpl *notations; - NamedNodeMapImpl *elements; - DOMString publicId; - DOMString systemId; - DOMString internalSubset; - - bool intSubsetReading; - - virtual void setPublicId(const DOMString& value); - virtual void setSystemId(const DOMString& value); - virtual void setInternalSubset(const DOMString &value); - bool isIntSubsetReading(); - - friend class DOMParser; - -public: - DocumentTypeImpl(DocumentImpl *, const DOMString &); - DocumentTypeImpl(DocumentImpl *, - const DOMString &qualifiedName, //DOM Level 2 - const DOMString &publicId, const DOMString &systemId); - DocumentTypeImpl(const DocumentTypeImpl &other, bool deep=false); - virtual ~DocumentTypeImpl(); - virtual bool isDocumentTypeImpl(); - - virtual NodeImpl * cloneNode(bool deep); - virtual void setOwnerDocument(DocumentImpl *doc); - virtual DOMString getNodeName(); - virtual short getNodeType(); - virtual NamedNodeMapImpl * getEntities(); - virtual DOMString getName(); - virtual NamedNodeMapImpl * getNotations(); - virtual NamedNodeMapImpl * getElements(); - virtual void setReadOnly(bool readOnly, bool deep); - - //Introduced in DOM Level 2 - - virtual DOMString getPublicId(); - virtual DOMString getSystemId(); - virtual DOMString getInternalSubset(); -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/DomMemDebug.cpp b/src/xercesc/dom/deprecated/DomMemDebug.cpp deleted file mode 100644 index 27ca5c8aead11d48fc8f7ab40e86607879172c38..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DomMemDebug.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - - -#include "DomMemDebug.hpp" -#include "DOMString.hpp" -#include "NodeImpl.hpp" -#include "NamedNodeMapImpl.hpp" -#include <stdio.h> - -XERCES_CPP_NAMESPACE_BEGIN - - -DomMemDebug::DomMemDebug() -{ - liveStringHandles = DOMString::gLiveStringHandleCount; - totalStringHandles = DOMString::gTotalStringHandleCount; - liveStringBuffers = DOMString::gLiveStringDataCount; - totalStringBuffers = DOMString::gTotalStringDataCount; - liveNodeImpls = NodeImpl::gLiveNodeImpls; - totalNodeImpls = NodeImpl::gTotalNodeImpls; - liveNamedNodeMaps = NamedNodeMapImpl::gLiveNamedNodeMaps; - totalNamedNodeMaps = NamedNodeMapImpl::gTotalNamedNodeMaps; -}; - - -DomMemDebug::~DomMemDebug() -{ -}; - - -bool DomMemDebug::operator == (const DomMemDebug &other) -{ - bool r = - liveStringHandles == other.liveStringHandles && - liveStringBuffers == other.liveStringBuffers && - liveNodeImpls == other.liveNodeImpls && - liveNamedNodeMaps == other.liveNamedNodeMaps; - return r; -}; - - -bool DomMemDebug::operator != (const DomMemDebug &other) -{ - return ! operator == (other); -}; - - -void DomMemDebug::operator = (const DomMemDebug &other) -{ - liveStringHandles = other.liveStringHandles; - totalStringHandles = other.totalStringHandles; - liveStringBuffers = other.liveStringBuffers; - totalStringBuffers = other.totalStringBuffers; - liveNodeImpls = other.liveNodeImpls; - totalNodeImpls = other.totalNodeImpls; - liveNamedNodeMaps = other.liveNamedNodeMaps; - totalNamedNodeMaps = other.totalNamedNodeMaps; -}; - -void DomMemDebug::print() -{ - printf("DOM reference counted memory alloction statistics:\n" - " live string handles: %d\n" - " total string handles: %d\n" - " live string buffers: %d\n" - " total string buffers: %d\n" - " live nodeImpls: %d\n" - " total nodeImpls: %d\n" - " live NamedNodeMaps: %d\n" - " total NamedNodeMaps: %d\n", - liveStringHandles , - totalStringHandles, - liveStringBuffers , - totalStringBuffers , - liveNodeImpls , - totalNodeImpls , - liveNamedNodeMaps , - totalNamedNodeMaps); -}; - - -void DomMemDebug::printDifference(const DomMemDebug &other) -{ - int d; - - d = liveStringHandles - other.liveStringHandles; - if (d != 0) - printf(" %d StringHandles.", d); - - d = liveStringBuffers - other.liveStringBuffers; - if (d != 0) - printf(" %d StringBuffers.", d); - - d = liveNodeImpls - other.liveNodeImpls; - if (d != 0) - printf(" %d NodeImpls.", d); - - d = liveNamedNodeMaps - other.liveNamedNodeMaps; - if (d != 0) - printf(" %d NamedNodeMaps.", d); - - printf("\n"); -}; - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/DomMemDebug.hpp b/src/xercesc/dom/deprecated/DomMemDebug.hpp deleted file mode 100644 index bd529e1117fd4fd5a1c535911c89e28e86a70e1f..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/DomMemDebug.hpp +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef DomMemDebug_HEADER_GUARD_ -#define DomMemDebug_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include <xercesc/util/XercesDefs.hpp> - -XERCES_CPP_NAMESPACE_BEGIN - - -// -// This class aids in debugging memory management problems with the -// reference counted DOM classes - DOMStrings, Nodes (including subclasses), -// and NamedNodeMaps. -// -// Usage Example: -// DomMemDebug initialState; // Captures allocation totals -// ... // Test code performs DOM -// ... // operations here. -// -// DomMemDebug exitState; // Captures post-test state. -// ExitState.printDifference(initialState); // Display leaks. -// -class DEPRECATED_DOM_EXPORT DomMemDebug -{ -public: - int liveStringHandles; - int totalStringHandles; - int liveStringBuffers; - int totalStringBuffers; - int liveNodeImpls; - int totalNodeImpls; - int liveNamedNodeMaps; - int totalNamedNodeMaps; - -public: - DomMemDebug(); - ~DomMemDebug(); - - void print(); - void printDifference(const DomMemDebug &other); - bool operator == (const DomMemDebug &other); - bool operator != (const DomMemDebug &other); - void operator = (const DomMemDebug &other); -}; - - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/ElementDefinitionImpl.cpp b/src/xercesc/dom/deprecated/ElementDefinitionImpl.cpp deleted file mode 100644 index 1ca12221f6523e3514f9ba5503a2ad84851be357..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/ElementDefinitionImpl.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "ElementDefinitionImpl.hpp" -#include "DocumentImpl.hpp" -#include "NamedNodeMapImpl.hpp" -#include "NodeImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - - -ElementDefinitionImpl::ElementDefinitionImpl(DocumentImpl *ownerDoc, - const DOMString &nam) - : NodeImpl(ownerDoc) -{ - name = nam.clone(); - attributes = 0; -}; - - -ElementDefinitionImpl::ElementDefinitionImpl( - const ElementDefinitionImpl& other, - bool /*deep*/) - : NodeImpl(other) -{ - name = other.name.clone(); - // NamedNodeMap must be explicitly replicated to avoid sharing - attributes = 0; - if (other.attributes) - attributes = other.attributes->cloneMap(this); -}; - - -ElementDefinitionImpl::~ElementDefinitionImpl() -{ -}; - - -NodeImpl *ElementDefinitionImpl::cloneNode(bool deep) -{ - return new (getOwnerDocument()->getMemoryManager()) ElementDefinitionImpl(*this, deep); -}; - - -DOMString ElementDefinitionImpl::getNodeName() { - return name; -}; - - -short ElementDefinitionImpl::getNodeType() { - return (short)-1; -}; - - -NamedNodeMapImpl *ElementDefinitionImpl::getAttributes() { - return attributes; -}; - - -XERCES_CPP_NAMESPACE_END - - diff --git a/src/xercesc/dom/deprecated/ElementDefinitionImpl.hpp b/src/xercesc/dom/deprecated/ElementDefinitionImpl.hpp deleted file mode 100644 index 8ea7237e70e24e3781daf49a90ab6bf43a2c2796..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/ElementDefinitionImpl.hpp +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef ElementDefinitionImpl_HEADER_GUARD_ -#define ElementDefinitionImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - -#include "NodeImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DEPRECATED_DOM_EXPORT ElementDefinitionImpl: public NodeImpl { -private: - DOMString name; - NamedNodeMapImpl *attributes; - -public: - ElementDefinitionImpl(DocumentImpl *ownerDocument, const DOMString &name); - ElementDefinitionImpl(const ElementDefinitionImpl& other, bool deep=false); - - virtual ~ElementDefinitionImpl(); - virtual NodeImpl *cloneNode(bool deep); - virtual DOMString getNodeName(); - virtual short getNodeType(); - virtual NamedNodeMapImpl *getAttributes(); -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/ElementImpl.cpp b/src/xercesc/dom/deprecated/ElementImpl.cpp deleted file mode 100644 index 5f66f9f60ebd26f583bede07b01823d263282ed9..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/ElementImpl.cpp +++ /dev/null @@ -1,505 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DeepNodeListImpl.hpp" -#include "DocumentImpl.hpp" -#include "DocumentTypeImpl.hpp" -#include "DOM_DOMException.hpp" -#include "DStringPool.hpp" -#include "ElementImpl.hpp" -#include "ElementDefinitionImpl.hpp" -#include "NamedNodeMapImpl.hpp" -#include "NodeVector.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -static DOMString *gEmptyString = 0; -static XMLRegisterCleanup emptyStringCleanup; - -ElementImpl::ElementImpl(DocumentImpl *ownerDoc, const DOMString &eName) - : ParentNode(ownerDoc) -{ - name = eName.clone(); - attributes = null; - setupDefaultAttributes(); -}; - - -ElementImpl::ElementImpl(const ElementImpl &other, bool deep) - : ParentNode(other) -{ - name = other.name.clone(); - attributes = null; - setupDefaultAttributes(); - if (deep) - cloneChildren(other); - if (other.attributes != null) - { - if (attributes) - { - attributes->removeAll(); - NamedNodeMapImpl::removeRef(attributes); - } - attributes = other.attributes->cloneAttrMap(this); - } -}; - - -ElementImpl::~ElementImpl() -{ - if (attributes) - { - attributes->removeAll(); - NamedNodeMapImpl::removeRef(attributes); - } -}; - - -NodeImpl *ElementImpl::cloneNode(bool deep) -{ - return new (getOwnerDocument()->getMemoryManager()) ElementImpl(*this, deep); -}; - - -/** - * NON-DOM - * set the ownerDocument of this node, its children, and its attributes - */ -void ElementImpl::setOwnerDocument(DocumentImpl *doc) { - ParentNode::setOwnerDocument(doc); - if (attributes != null) - attributes->setOwnerDocument(doc); -} - - -DOMString ElementImpl::getNodeName() { - return name; -}; - - -short ElementImpl::getNodeType() { - return DOM_Node::ELEMENT_NODE; -}; - - -DOMString ElementImpl::getAttribute(const DOMString &nam) -{ - AttrImpl * attr=null; - - if (attributes != null) - attr=(AttrImpl *)(attributes->getNamedItem(nam)); - - return (attr==null) ? DStringPool::getStaticString("" - , &gEmptyString - , reinitElementImpl - , emptyStringCleanup) : attr->getValue(); -}; - - - -AttrImpl *ElementImpl::getAttributeNode(const DOMString &nam) -{ - return (attributes == 0) ? null : (AttrImpl *)(attributes->getNamedItem(nam)); -}; - - -NamedNodeMapImpl *ElementImpl::getAttributes() -{ - return attributes; -}; - - - -DeepNodeListImpl *ElementImpl::getElementsByTagName(const DOMString &tagname) -{ - return new (getOwnerDocument()->getMemoryManager()) DeepNodeListImpl(this,tagname); -}; - - -DOMString ElementImpl::getTagName() -{ - return name; -} - - -bool ElementImpl::isElementImpl() -{ - return true; -}; - - -void ElementImpl::removeAttribute(const DOMString &nam) -{ - if (getOwnerDocument()->getErrorChecking() && isReadOnly()) { - throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - } - if (attributes != null) - { - AttrImpl *att = (AttrImpl *) attributes->getNamedItem(nam); - // Remove it - if (att != null) - { - attributes->removeNamedItem(nam); - if (att->nodeRefCount == 0) - NodeImpl::deleteIf(att); - } - } -}; - - - -AttrImpl *ElementImpl::removeAttributeNode(AttrImpl *oldAttr) -{ - if (getOwnerDocument()->getErrorChecking() && isReadOnly()) { - throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - } - if (attributes != null) - { - AttrImpl *found = (AttrImpl *) attributes->getNamedItem(oldAttr->getName()); - - // If it is in fact the right object, remove it. - - if (found == oldAttr) - attributes->removeNamedItem(oldAttr->getName()); - else - throw DOM_DOMException(DOM_DOMException::NOT_FOUND_ERR, null); - - return found; - - } - return null; // just to keep the compiler happy -}; - - - -AttrImpl *ElementImpl::setAttribute(const DOMString &nam, const DOMString &val) -{ - if (getOwnerDocument()->getErrorChecking() && isReadOnly()) { - throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - } - AttrImpl* newAttr = (AttrImpl*)getAttributeNode(nam); - if (!newAttr) - { - if (attributes == 0) { - attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, null); - } - newAttr = (AttrImpl*)ownerDocument->createAttribute(nam); - attributes->setNamedItem(newAttr); - } - - newAttr->setNodeValue(val); // Note that setNodeValue on attribute - // nodes takes care of deleting - // any previously existing children. - return newAttr; -}; - - - -AttrImpl * ElementImpl::setAttributeNode(AttrImpl *newAttr) -{ - if (getOwnerDocument()->getErrorChecking() && isReadOnly()) { - throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - } - if (!(newAttr->isAttrImpl())) - throw DOM_DOMException(DOM_DOMException::WRONG_DOCUMENT_ERR, null); - if (attributes == 0) { - attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, null); - } - AttrImpl *oldAttr = - (AttrImpl *) attributes->getNamedItem(newAttr->getName()); - // This will throw INUSE if necessary - attributes->setNamedItem(newAttr); - - // Attr node reference counting note: - // If oldAttr's refcount is zero at this point, here's what happens... - // - // oldAttr is returned from this function to DOM_Attr::setAttributeNode, - // which wraps a DOM_Attr around the returned pointer and sends it - // up to application code, incrementing the reference count in the process. - // When the app DOM_Attr's destructor runs, the reference count is - // decremented back to zero and oldAttr will be deleted at that time. - - return oldAttr; -}; - - -void ElementImpl::setReadOnly(bool readOnl, bool deep) -{ - ParentNode::setReadOnly(readOnl,deep); - if (attributes != null) - attributes->setReadOnly(readOnl,true); -}; - - -//Introduced in DOM Level 2 -DOMString ElementImpl::getAttributeNS(const DOMString &fNamespaceURI, - const DOMString &fLocalName) -{ - AttrImpl * attr= (attributes != null) ? - (AttrImpl *)(attributes->getNamedItemNS(fNamespaceURI, fLocalName)) - : null; - return (attr==null) ? DOMString(null) : attr->getValue(); -} - - -AttrImpl *ElementImpl::setAttributeNS(const DOMString &fNamespaceURI, - const DOMString &qualifiedName, const DOMString &fValue) -{ - if (getOwnerDocument()->getErrorChecking() && isReadOnly()) { - throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - } - AttrImpl *newAttr = - (AttrImpl *) ownerDocument->createAttributeNS(fNamespaceURI, - qualifiedName); - newAttr->setNodeValue(fValue); - if (attributes == 0) { - attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, null); - } - AttrImpl *oldAttr = (AttrImpl *)attributes->setNamedItem(newAttr); - - if (oldAttr) { - if (oldAttr->nodeRefCount == 0) - NodeImpl::deleteIf(oldAttr); - } - return newAttr; -} - - -void ElementImpl::removeAttributeNS(const DOMString &fNamespaceURI, - const DOMString &fLocalName) -{ - if (getOwnerDocument()->getErrorChecking() && isReadOnly()) { - throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - } - if (attributes != null) - { - AttrImpl *att = - (AttrImpl *) attributes->getNamedItemNS(fNamespaceURI, fLocalName); - // Remove it - if (att != null) { - attributes->removeNamedItemNS(fNamespaceURI, fLocalName); - if (att->nodeRefCount == 0) - NodeImpl::deleteIf(att); - } - } -} - - -AttrImpl *ElementImpl::getAttributeNodeNS(const DOMString &fNamespaceURI, - const DOMString &fLocalName) -{ - return (attributes == 0) ? null : (AttrImpl *)(attributes->getNamedItemNS(fNamespaceURI, fLocalName)); -} - - -AttrImpl *ElementImpl::setAttributeNodeNS(AttrImpl *newAttr) -{ - if (getOwnerDocument()->getErrorChecking()) { - if (isReadOnly()) { - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - } - if (newAttr->getOwnerDocument() != this->getOwnerDocument()) { - throw DOM_DOMException(DOM_DOMException::WRONG_DOCUMENT_ERR, null); - } - } - if (attributes == 0) { - attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, null); - } - AttrImpl *oldAttr = (AttrImpl *) attributes->getNamedItemNS(newAttr->getNamespaceURI(), newAttr->getLocalName()); - - // This will throw INUSE if necessary - attributes->setNamedItemNS(newAttr); - - // Attr node reference counting note: - // If oldAttr's refcount is zero at this point, here's what happens... - // - // oldAttr is returned from this function to DOM_Attr::setAttributeNode, - // which wraps a DOM_Attr around the returned pointer and sends it - // up to application code, incrementing the reference count in the process. - // When the app DOM_Attr's destructor runs, the reference count is - // decremented back to zero and oldAttr will be deleted at that time. - - return oldAttr; -} - - -DeepNodeListImpl *ElementImpl::getElementsByTagNameNS(const DOMString &fNamespaceURI, - const DOMString &fLocalName) -{ - return new (getOwnerDocument()->getMemoryManager())DeepNodeListImpl(this,fNamespaceURI, fLocalName); -} - -bool ElementImpl::hasAttributes() -{ - return (attributes != null && attributes->getLength() != 0); -}; - -bool ElementImpl::hasAttribute(const DOMString &name) -{ - return (getAttributeNode(name) != null); -}; - -bool ElementImpl::hasAttributeNS(const DOMString &namespaceURI, - const DOMString &localName) -{ - return (getAttributeNodeNS(namespaceURI, localName) != null); -}; - - -// DOM_NamedNodeMap UTILITIES -NamedNodeMapImpl *ElementImpl::NNM_cloneMap(NodeImpl *nnm_ownerNode) -{ - return (getAttributes() == null) ? null : nnm_ownerNode->getAttributes()->cloneMap(nnm_ownerNode); -} - -int ElementImpl::NNM_findNamePoint(const DOMString &nnm_name) -{ - return (getAttributes() == null) ? -1 : getAttributes()->findNamePoint(nnm_name); -} - -unsigned int ElementImpl::NNM_getLength() -{ - return (getAttributes() == null) ? 0 : getAttributes()->getLength(); -} - -NodeImpl *ElementImpl::NNM_getNamedItem(const DOMString &nnm_name) -{ - return (getAttributes() == null) ? null : getAttributes()->getNamedItem(nnm_name); -} - -NodeImpl *ElementImpl::NNM_item(unsigned int nnm_index) -{ - return (getAttributes() == null) ? null : getAttributes()->item(nnm_index); -} - -void ElementImpl::NNM_removeAll() -{ - if (getAttributes() != null) - getAttributes()->removeAll(); -} - -NodeImpl *ElementImpl::NNM_removeNamedItem(const DOMString &nnm_name) -{ - if (getAttributes() == null) - throw DOM_DOMException(DOM_DOMException::NOT_FOUND_ERR, null); - else - return getAttributes()->removeNamedItem(nnm_name); - return null; -} - -NodeImpl *ElementImpl::NNM_setNamedItem(NodeImpl *nnm_arg) -{ - if (getAttributes() == null) { - attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this); - } - return attributes->setNamedItem(nnm_arg); -} - -void ElementImpl::NNM_setReadOnly(bool nnm_readOnly, bool nnm_deep) -{ - if (getAttributes() != null) - getAttributes()->setReadOnly(nnm_readOnly, nnm_deep); -} - -int ElementImpl::NNM_findNamePoint(const DOMString &nnm_namespaceURI, const DOMString &nnm_localName) -{ - return (getAttributes() == null) ? -1 : getAttributes()->findNamePoint(nnm_namespaceURI, nnm_localName); -} - -NodeImpl *ElementImpl::NNM_getNamedItemNS(const DOMString &nnm_namespaceURI, const DOMString &nnm_localName) -{ - return (getAttributes() == null) ? null : getAttributes()->getNamedItemNS(nnm_namespaceURI, nnm_localName); -} - -NodeImpl *ElementImpl::NNM_setNamedItemNS(NodeImpl *nnm_arg) -{ - if (getAttributes() == null) { - attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this); - } - return getAttributes()->setNamedItemNS(nnm_arg); -} - -NodeImpl *ElementImpl::NNM_removeNamedItemNS(const DOMString &nnm_namespaceURI, const DOMString &nnm_localName) -{ - if (getAttributes() == null) - throw DOM_DOMException(DOM_DOMException::NOT_FOUND_ERR, null); - else - return getAttributes()->removeNamedItemNS(nnm_namespaceURI, nnm_localName); - return null; -} - -void ElementImpl::NNM_setOwnerDocument(DocumentImpl *nnm_doc) -{ - if (getAttributes() != null) - getAttributes()->setOwnerDocument(nnm_doc); -} - - -// util functions for default attributes -// returns the default attribute map for this node from the owner document -AttrMapImpl *ElementImpl::getDefaultAttributes() -{ - if ((ownerNode == null) || (getOwnerDocument() == null)) - return null; - - DocumentImpl *tmpdoc = getOwnerDocument(); - if (tmpdoc->getDoctype() == null) - return null; - - NodeImpl *eldef = tmpdoc->getDoctype()->getElements()->getNamedItem(getNodeName()); - return (eldef == null) ? null : (AttrMapImpl *)(eldef->getAttributes()); -} - -// resets all attributes for this node to their default values -void ElementImpl::setupDefaultAttributes() -{ - if ((ownerNode == null) || (getOwnerDocument() == null) || (getOwnerDocument()->getDoctype() == null)) - return; - - if (attributes != 0) - delete attributes; - - AttrMapImpl* defAttrs = getDefaultAttributes(); - if (defAttrs) { - attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, defAttrs); - } -} - -// ----------------------------------------------------------------------- -// Notification that lazy data has been deleted -// ----------------------------------------------------------------------- -void ElementImpl::reinitElementImpl() { - - delete gEmptyString; - gEmptyString = 0; - -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/ElementImpl.hpp b/src/xercesc/dom/deprecated/ElementImpl.hpp deleted file mode 100644 index f197c0af3310c9d0fb1e8e49d6f99c17fcbfdbe7..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/ElementImpl.hpp +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef ElementImpl_HEADER_GUARD_ -#define ElementImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - -#include <xercesc/util/XercesDefs.hpp> -#include "AttrImpl.hpp" -#include "AttrMapImpl.hpp" -#include "ParentNode.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DeepNodeListImpl; - -class DEPRECATED_DOM_EXPORT ElementImpl: public ParentNode { -protected: - DOMString name; - AttrMapImpl *attributes; - -public: - ElementImpl(DocumentImpl *ownerDoc, const DOMString &name); - ElementImpl(const ElementImpl &other, bool deep=false); - virtual ~ElementImpl(); - - virtual bool isElementImpl(); - virtual NodeImpl * cloneNode(bool deep); - virtual DOMString getNodeName(); - virtual short getNodeType(); - virtual DOMString getAttribute(const DOMString &name); - virtual AttrImpl *getAttributeNode(const DOMString &name); - virtual NamedNodeMapImpl * getAttributes(); - virtual DeepNodeListImpl * getElementsByTagName(const DOMString &tagname); - virtual DOMString getTagName(); - virtual void removeAttribute(const DOMString &name); - virtual AttrImpl * removeAttributeNode(AttrImpl * oldAttr); - virtual AttrImpl *setAttribute(const DOMString &name, const DOMString &value); - virtual AttrImpl *setAttributeNode(AttrImpl *newAttr); - virtual void setReadOnly(bool readOnly, bool deep); - - //Introduced in DOM Level 2 - virtual DOMString getAttributeNS(const DOMString &namespaceURI, - const DOMString &localName); - virtual AttrImpl *setAttributeNS(const DOMString &namespaceURI, - const DOMString &qualifiedName, const DOMString &value); - virtual void removeAttributeNS(const DOMString &namespaceURI, - const DOMString &localName); - virtual AttrImpl *getAttributeNodeNS(const DOMString &namespaceURI, - const DOMString &localName); - virtual AttrImpl *setAttributeNodeNS(AttrImpl *newAttr); - virtual DeepNodeListImpl *getElementsByTagNameNS(const DOMString &namespaceURI, - const DOMString &localName); - - virtual void setOwnerDocument(DocumentImpl *doc); - virtual bool hasAttributes(); - virtual bool hasAttribute(const DOMString &name); - virtual bool hasAttributeNS(const DOMString &namespaceURI, const DOMString &localName); - - //Utils for the DOM_NamedNodeMap wrapper class - //All NamedNodeMap utils begin with NNM - virtual NamedNodeMapImpl *NNM_cloneMap(NodeImpl *nnm_ownerNode); - virtual int NNM_findNamePoint(const DOMString &nnm_name); - virtual unsigned int NNM_getLength(); - virtual NodeImpl *NNM_getNamedItem(const DOMString &nnm_name); - virtual NodeImpl *NNM_item(unsigned int nnm_index); - virtual void NNM_removeAll(); - virtual NodeImpl *NNM_removeNamedItem(const DOMString &nnm_name); - virtual NodeImpl *NNM_setNamedItem(NodeImpl *nnm_arg); - virtual void NNM_setReadOnly(bool nnm_readOnly, bool nnm_deep); - //Introduced in DOM Level 2 - virtual int NNM_findNamePoint(const DOMString &nnm_namespaceURI, const DOMString &nnm_localName); - virtual NodeImpl *NNM_getNamedItemNS(const DOMString &nnm_namespaceURI, const DOMString &nnm_localName); - virtual NodeImpl *NNM_setNamedItemNS(NodeImpl *nnm_arg); - virtual NodeImpl *NNM_removeNamedItemNS(const DOMString &nnm_namespaceURI, const DOMString &nnm_localName); - virtual void NNM_setOwnerDocument(DocumentImpl *nnm_doc); - - // default attribute helper functions - virtual AttrMapImpl *getDefaultAttributes(); - virtual void setupDefaultAttributes(); - - // ----------------------------------------------------------------------- - // Notification that lazy data has been deleted - // ----------------------------------------------------------------------- - static void reinitElementImpl(); -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/ElementNSImpl.cpp b/src/xercesc/dom/deprecated/ElementNSImpl.cpp deleted file mode 100644 index 8bfa268dcf346e76d12222ea6ee06471b03ed9b4..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/ElementNSImpl.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include <xercesc/util/XMLUniDefs.hpp> -#include "ElementNSImpl.hpp" -#include "DocumentImpl.hpp" -#include "DOM_DOMException.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -ElementNSImpl::ElementNSImpl(DocumentImpl *ownerDoc, const DOMString &nam) : - ElementImpl(ownerDoc, nam) -{ - this->namespaceURI=null; //DOM Level 2 - this->localName=null; //DOM Level 2 -} - -//Introduced in DOM Level 2 -ElementNSImpl::ElementNSImpl(DocumentImpl *ownerDoc, - const DOMString &fNamespaceURI, - const DOMString &qualifiedName) : - ElementImpl(ownerDoc, qualifiedName) -{ - this->name = qualifiedName.clone(); - - int index = DocumentImpl::indexofQualifiedName(qualifiedName); - DOMString prefix; - if (index < 0) - throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - if (index == 0) { //qualifiedName contains no ':' - prefix = null; - this -> localName = this -> name; - } else { //0 < index < this->name.length()-1 - prefix = this->name.substringData(0, index); - this -> localName = - this->name.substringData(index+1, this->name.length()-index-1); - } - - const DOMString& URI = - mapPrefix(prefix, fNamespaceURI, DOM_Node::ELEMENT_NODE); - this -> namespaceURI = URI == null ? DOMString(null) : URI.clone(); -}; - -ElementNSImpl::ElementNSImpl(const ElementNSImpl &other, bool deep) : - ElementImpl(other, deep) -{ - this->namespaceURI = other.namespaceURI.clone(); //DOM Level 2 - this->localName = other.localName.clone(); //DOM Level 2 -}; - -NodeImpl * ElementNSImpl::cloneNode(bool deep) { - return new (getOwnerDocument()->getMemoryManager()) ElementNSImpl(*this, deep); -} - -DOMString ElementNSImpl::getNamespaceURI() -{ - return namespaceURI; -} - -DOMString ElementNSImpl::getPrefix() -{ - int index = DocumentImpl::indexofQualifiedName(name); - if (index == 0) - return null; - else - return name.substringData(0, index); -} - -DOMString ElementNSImpl::getLocalName() -{ - return localName; -} - -void ElementNSImpl::setPrefix(const DOMString &prefix) -{ - DOMString xml = NodeImpl::getXmlString(); - DOMString xmlURI = NodeImpl::getXmlURIString(); - - if (ownerDocument->getErrorChecking()) { - if (isReadOnly()) { - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - } - if (prefix != null && !((DocumentImpl *)this->getOwnerDocument())->isXMLName(prefix)) { - throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR, - null); - } - if (namespaceURI == null) { - throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - } - } - if (prefix == null || prefix.length() == 0) { - name = localName; - return; - } - if (ownerDocument->getErrorChecking() && - (prefix.equals(xml) && !namespaceURI.equals(xmlURI))) { - throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - } - const XMLCh *p = prefix.rawBuffer(); - for (int i = prefix.length(); --i >= 0;) - if (*p++ == chColon) //prefix is malformed - throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - - name = prefix + chColon + localName; //nodeName is changed too -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/ElementNSImpl.hpp b/src/xercesc/dom/deprecated/ElementNSImpl.hpp deleted file mode 100644 index 2a067337de6a8a1e787dc2e4f9be96c3cb8e54d6..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/ElementNSImpl.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef ElementNSImpl_HEADER_GUARD_ -#define ElementNSImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - -#include "ElementImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DEPRECATED_DOM_EXPORT ElementNSImpl: public ElementImpl { -protected: - //Introduced in DOM Level 2 - DOMString namespaceURI; //namespace URI of this node - DOMString localName; //local part of qualified name - - -public: - ElementNSImpl(DocumentImpl *ownerDoc, const DOMString &name); - ElementNSImpl(DocumentImpl *ownerDoc, //DOM Level 2 - const DOMString &namespaceURI, const DOMString &qualifiedName); - ElementNSImpl(const ElementNSImpl &other, bool deep=false); - - virtual NodeImpl * cloneNode(bool deep); - //Introduced in DOM Level 2 - virtual DOMString getNamespaceURI(); - virtual DOMString getPrefix(); - virtual DOMString getLocalName(); - virtual void setPrefix(const DOMString &prefix); -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/EntityImpl.cpp b/src/xercesc/dom/deprecated/EntityImpl.cpp deleted file mode 100644 index 1f1a11b046077d22ceaf2a1425b917f74163ba64..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/EntityImpl.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DOM_DOMException.hpp" -#include "DOM_Node.hpp" -#include "EntityImpl.hpp" -#include "DocumentImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -EntityImpl::EntityImpl(DocumentImpl *ownerDoc, const DOMString &eName) - : ParentNode(ownerDoc) -{ - name = eName.clone(); - setReadOnly(true, true); -} - - -EntityImpl::EntityImpl(const EntityImpl &other, bool deep) - : ParentNode(other) -{ - name = other.name.clone(); - if (deep) - cloneChildren(other); - publicId = other.publicId.clone(); - systemId = other.systemId.clone(); - notationName = other.notationName.clone(); - - setReadOnly(true, true); -} - - -EntityImpl::~EntityImpl() { -} - - -NodeImpl *EntityImpl::cloneNode(bool deep) -{ - return new (getOwnerDocument()->getMemoryManager()) EntityImpl(*this, deep); -} - - -DOMString EntityImpl::getNodeName() { - return name; -} - - -short EntityImpl::getNodeType() { - return DOM_Node::ENTITY_NODE; -} - - -DOMString EntityImpl::getNotationName() -{ - return notationName; -} - - -DOMString EntityImpl::getPublicId() { - return publicId; -} - - -DOMString EntityImpl::getSystemId() -{ - return systemId; -} - - -void EntityImpl::setNotationName(const DOMString &arg) -{ - notationName = arg; -} - - -void EntityImpl::setPublicId(const DOMString &arg) -{ - publicId = arg; -} - - -void EntityImpl::setSystemId(const DOMString &arg) -{ - systemId = arg; -} - -void EntityImpl::setEntityRef(EntityReferenceImpl* refEntity) -{ - if (firstChild != 0) - return; - - if (!refEntity) - return; - - setReadOnly(false, true); - this->cloneChildren(*refEntity); - setReadOnly(true, true); -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/EntityImpl.hpp b/src/xercesc/dom/deprecated/EntityImpl.hpp deleted file mode 100644 index ae0e998ce41701f4ef7a3b1a0b4d49d4c52f2cad..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/EntityImpl.hpp +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef EntityImpl_HEADER_GUARD_ -#define EntityImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -#include <xercesc/util/XercesDefs.hpp> -#include "ParentNode.hpp" -#include "EntityReferenceImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DEPRECATED_DOM_EXPORT EntityImpl: public ParentNode { -private: - DOMString name; - DOMString publicId; - DOMString systemId; - DOMString notationName; - - void setEntityRef(EntityReferenceImpl*); - - friend class DOMParser; - -public: - EntityImpl(DocumentImpl*, const DOMString &eName); - EntityImpl(const EntityImpl &other, bool deep=false); - virtual ~EntityImpl(); - - virtual NodeImpl* cloneNode(bool deep); - virtual DOMString getNodeName(); - virtual short getNodeType(); - virtual DOMString getPublicId(); - virtual DOMString getSystemId(); - virtual DOMString getNotationName(); - virtual void setNotationName(const DOMString &arg); - virtual void setPublicId(const DOMString &arg); - virtual void setSystemId(const DOMString &arg); -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/EntityReferenceImpl.cpp b/src/xercesc/dom/deprecated/EntityReferenceImpl.cpp deleted file mode 100644 index b228182376f82193fb05a4a15435b73ef0ee11ea..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/EntityReferenceImpl.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -/** -* EntityReference models the XML &entityname; syntax, when used for -* entities defined by the DOM. Entities hardcoded into XML, such as -* character entities, should instead have been translated into text -* by the code which generated the DOM tree. -* <P> -* An XML processor has the alternative of fully expanding Entities -* into the normal document tree. If it does so, no EntityReference nodes -* will appear. -* <P> -* Similarly, non-validating XML processors are not required to read -* or process entity declarations made in the external subset or -* declared in external parameter entities. Hence, some applications -* may not make the replacement value available for Parsed Entities -* of these types. -* <P> -* EntityReference behaves as a read-only node, and the children of -* the EntityReference (which reflect those of the Entity, and should -* also be read-only) give its replacement value, if any. They are -* supposed to automagically stay in synch if the DocumentType is -* updated with new values for the Entity. -* <P> -* The defined behavior makes efficient storage difficult for the DOM -* implementor. We can't just look aside to the Entity's definition -* in the DocumentType since those nodes have the wrong parent (unless -* we can come up with a clever "imaginary parent" mechanism). We -* must at least appear to clone those children... which raises the -* issue of keeping the reference synchronized with its parent. -* This leads me back to the "cached image of centrally defined data" -* solution, much as I dislike it. -* <P> -* For now I have decided, since REC-DOM-Level-1-19980818 doesn't -* cover this in much detail, that synchronization doesn't have to be -* considered while the user is deep in the tree. That is, if you're -* looking within one of the EntityReferennce's children and the Entity -* changes, you won't be informed; instead, you will continue to access -* the same object -- which may or may not still be part of the tree. -* This is the same behavior that obtains elsewhere in the DOM if the -* subtree you're looking at is deleted from its parent, so it's -* acceptable here. (If it really bothers folks, we could set things -* up so deleted subtrees are walked and marked invalid, but that's -* not part of the DOM's defined behavior.) -* <P> -* As a result, only the EntityReference itself has to be aware of -* changes in the Entity. And it can take advantage of the same -* structure-change-monitoring code I implemented to support -* DeepNodeList. -* -* @author Rania Y. Khalaf -* @author Joseph Kesselman -* @since PR-DOM-Level-1-19980818. -*/ - -#include "DocumentImpl.hpp" -#include "DocumentTypeImpl.hpp" -#include "EntityImpl.hpp" -#include "EntityReferenceImpl.hpp" -#include "DOM_DOMException.hpp" -#include "DOM_Node.hpp" -#include "NamedNodeMapImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -EntityReferenceImpl::EntityReferenceImpl(DocumentImpl *ownerDoc, - const DOMString &entityName) - : ParentNode(ownerDoc) -{ - name = entityName.clone(); - // EntityReference behaves as a read-only node, since its contents - // reflect the Entity it refers to -- but see setNodeName(). - - //retrieve the corresponding entity content - if (ownerDoc) { - if (ownerDoc->getDoctype()) { - if (ownerDoc->getDoctype()->getEntities()) { - EntityImpl* entity = (EntityImpl*)ownerDoc->getDoctype()->getEntities()->getNamedItem(entityName); - if (entity) { - cloneChildren(*entity); - } - } - } - } - - setReadOnly(true, true); -} - - - -EntityReferenceImpl::EntityReferenceImpl(const EntityReferenceImpl &other, - bool deep) - : ParentNode(other) -{ - name = other.name.clone(); - if (deep) - cloneChildren(other); - setReadOnly(true, true); -} - - - -EntityReferenceImpl::~EntityReferenceImpl() -{ -} - - -NodeImpl *EntityReferenceImpl::cloneNode(bool deep) -{ - return new (getOwnerDocument()->getMemoryManager()) EntityReferenceImpl(*this, deep); -} - - -DOMString EntityReferenceImpl::getNodeName() -{ - return name; -}; - - -short EntityReferenceImpl::getNodeType() { - return DOM_Node::ENTITY_REFERENCE_NODE; -}; - - -bool EntityReferenceImpl::isEntityReference() -{ - return true; -} - - -/** -* EntityRef is already, and must be, a read-only node. Attempts to change -* that will throw a NO_MODIFICATION_ALLOWED_ERR DOMException. -* <P> -* If you want to alter its contents, edit the Entity definition. -* -* @param readOnly boolean -*/ -void EntityReferenceImpl::setReadOnly(bool readOnl,bool deep) -{ - if(getOwnerDocument()->getErrorChecking() && readOnl==false) - throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR,null); - ParentNode::setReadOnly(readOnl,deep); -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/EntityReferenceImpl.hpp b/src/xercesc/dom/deprecated/EntityReferenceImpl.hpp deleted file mode 100644 index 553d3df493d6093d42e03b62064ee058a55528da..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/EntityReferenceImpl.hpp +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef EntityReferenceImpl_HEADER_GUARD_ -#define EntityReferenceImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -#include <xercesc/util/XercesDefs.hpp> -#include "ParentNode.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DEPRECATED_DOM_EXPORT EntityReferenceImpl: public ParentNode -{ -private: - DOMString name; - -public: - EntityReferenceImpl(DocumentImpl *ownerDoc, const DOMString &entityName); - EntityReferenceImpl(const EntityReferenceImpl &other, bool deep=false); - virtual ~EntityReferenceImpl(); - virtual NodeImpl * cloneNode(bool deep); - virtual DOMString getNodeName(); - virtual short getNodeType(); - virtual bool isEntityReference(); - virtual void setReadOnly(bool readOnly,bool deep); -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/MemDebug.hpp b/src/xercesc/dom/deprecated/MemDebug.hpp deleted file mode 100644 index 66170dc2b4151527872698764e4275318d20d813..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/MemDebug.hpp +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef MemDebug_HEADER_GUARD_ -#define MemDebug_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include <xercesc/util/XercesDefs.hpp> - -XERCES_CPP_NAMESPACE_BEGIN - - -class DomMemDebug -{ -public: - int liveStringHandles; - int totalStringHandles; - int liveStringBuffers; - int totalStringBuffers; - int liveNodeImpls; - int totalNodeImpls; - int liveNamedNodeMaps; - int totalNamedNodeMaps; - -public: - DOMMemDebug(); - ~DOMMemDebug(); - - void print(); - void printDifference(const DOMMemDebug &other); - bool operator == (const DOMMemDebug &other); - bool operator != (const DOMMemDebug &other); - bool operator = (const DOMMemDebug &other); -}; - -XERCES_CPP_NAMESPACE_END - -#endif // MemDebug_HEADER_GUARD_ diff --git a/src/xercesc/dom/deprecated/NameNodeFilter.hpp b/src/xercesc/dom/deprecated/NameNodeFilter.hpp deleted file mode 100644 index 7d191bb4d277681c2a3931b991c7a7e0552025b3..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NameNodeFilter.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -#ifndef DOM_NameNodeFilter_HEADER_GUARD_ -#define DOM_NameNodeFilter_HEADER_GUARD_ - - -#include "DOM_NodeFilter.hpp" -#include "NodeFilterImpl.hpp" -#include "DOMString.hpp" -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DEPRECATED_DOM_EXPORT NameNodeFilter : public NodeFilterImpl -{ - public: - NameNodeFilter(); - virtual ~NameNodeFilter(); - - // The name to compare with the node name. If null, all node names - // are successfully matched. - void setName(DOMString name); - - // Return the name to compare with node name. - DOMString getName(); - - // If match is true, the node name is accepted when it matches. - // If match is false, the node name is accepted when does not match. - void setMatch(bool match) ; - - // Return match value. - bool getMatch(); - - virtual DOM_NodeFilter::FilterAction acceptNode(DOM_Node n); - - private: - DOMString fName; - bool fMatch; - -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/NamedNodeMapImpl.cpp b/src/xercesc/dom/deprecated/NamedNodeMapImpl.cpp deleted file mode 100644 index dbe8b9acc341138c51c040af677c10d50a4819d0..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NamedNodeMapImpl.cpp +++ /dev/null @@ -1,430 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "NamedNodeMapImpl.hpp" -#include "NodeVector.hpp" -#include "AttrImpl.hpp" -#include "DOM_DOMException.hpp" -#include "DocumentImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -int NamedNodeMapImpl::gLiveNamedNodeMaps = 0; -int NamedNodeMapImpl::gTotalNamedNodeMaps = 0; - -NamedNodeMapImpl::NamedNodeMapImpl(NodeImpl *ownerNod) -{ - this->ownerNode=ownerNod; - this->nodes = null; - this->readOnly = false; - this->refCount = 1; - gLiveNamedNodeMaps++; - gTotalNamedNodeMaps++; -}; - - - -NamedNodeMapImpl::~NamedNodeMapImpl() -{ - if (nodes) - { - // It is the responsibility of whoever was using the named node - // map to do any cleanup on the nodes contained in the map - // before deleting it. - delete nodes; - nodes = 0; - } - gLiveNamedNodeMaps--; -}; - - -void NamedNodeMapImpl::addRef(NamedNodeMapImpl *This) -{ - if (This) - ++This->refCount; -}; - - -NamedNodeMapImpl *NamedNodeMapImpl::cloneMap(NodeImpl *ownerNod) -{ - MemoryManager* manager = ownerNod->getDocument()->getMemoryManager(); - NamedNodeMapImpl *newmap = new (manager) NamedNodeMapImpl(ownerNod); - - if (nodes != null) - { - newmap->nodes = new (manager) NodeVector(nodes->size(), manager); - for (unsigned int i = 0; i < nodes->size(); ++i) - { - NodeImpl *n = nodes->elementAt(i)->cloneNode(true); - n->isSpecified(nodes->elementAt(i)->isSpecified()); - n->ownerNode = ownerNod; - n->isOwned(true); - newmap->nodes->addElement(n); - } - } - - return newmap; -}; - - -// -// removeAll - This function removes all elements from a named node map. -// It is called from the destructors for Elements and DocumentTypes, -// to remove the contents when the owning Element or DocType goes -// away. The empty NamedNodeMap may persist if the user code -// has a reference to it. -// -// AH Revist - the empty map should be made read-only, since -// adding it was logically part of the [Element, DocumentType] -// that has been deleted, and adding anything new to it would -// be meaningless, and almost certainly an error. -// -void NamedNodeMapImpl::removeAll() -{ - if (nodes) - { - - for (int i=nodes->size()-1; i>=0; i--) - { - NodeImpl *n = nodes->elementAt(i); - n->ownerNode = ownerNode->getOwnerDocument(); - n->isOwned(false); - if (n->nodeRefCount == 0) - NodeImpl::deleteIf(n); - } - delete nodes; - nodes = null; - } -} - - - -int NamedNodeMapImpl::findNamePoint(const DOMString &name) -{ - - // Binary search - int i=0; - if(nodes!=null) - { - int first=0,last=nodes->size()-1; - - while(first<=last) - { - i=(first+last)/2; - int test = name.compareString(nodes->elementAt(i)->getNodeName()); - if(test==0) - return i; // Name found - else if(test<0) - last=i-1; - else - first=i+1; - } - if(first>i) i=first; - } - /******************** - // Linear search - int i = 0; - if (nodes != null) - for (i = 0; i < nodes.size(); ++i) - { - int test = name.compareTo(((NodeImpl *) (nodes.elementAt(i))).getNodeName()); - if (test == 0) - return i; - else - if (test < 0) - { - break; // Found insertpoint - } - } - - *******************/ - return -1 - i; // not-found has to be encoded. -}; - - - -unsigned int NamedNodeMapImpl::getLength() -{ - return (nodes != null) ? nodes->size() : 0; -}; - - - -NodeImpl * NamedNodeMapImpl::getNamedItem(const DOMString &name) -{ - int i=findNamePoint(name); - return (i<0) ? null : (NodeImpl *)(nodes->elementAt(i)); -}; - - - -NodeImpl * NamedNodeMapImpl::item(unsigned int index) -{ - return (nodes != null && index < nodes->size()) ? - (NodeImpl *) (nodes->elementAt(index)) : null; -}; - - -// -// removeNamedItem() - Remove the named item, and return it. -// The caller must arrange for deletion of the -// returned item if its refcount has gone to zero - -// we can't do it here because the caller would -// never see the returned node. -// -NodeImpl * NamedNodeMapImpl::removeNamedItem(const DOMString &name) -{ - if (readOnly) - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - int i=findNamePoint(name); - NodeImpl *n = null; - - if(i<0) - throw DOM_DOMException(DOM_DOMException::NOT_FOUND_ERR, null); - - n = (NodeImpl *) (nodes->elementAt(i)); - nodes->removeElementAt(i); - n->ownerNode = ownerNode->getOwnerDocument(); - n->isOwned(false); - return n; -}; - - - -void NamedNodeMapImpl::removeRef(NamedNodeMapImpl *This) -{ - if (This && --This->refCount == 0) - delete This; -}; - -// -// setNamedItem() Put the item into the NamedNodeList by name. -// If an item with the same name already was -// in the list, replace it. Return the old -// item, if there was one. -// Caller is responsible for arranging for -// deletion of the old item if its ref count is -// zero. -// -NodeImpl * NamedNodeMapImpl::setNamedItem(NodeImpl * arg) -{ - if(arg->getOwnerDocument() != ownerNode->getOwnerDocument()) - throw DOM_DOMException(DOM_DOMException::WRONG_DOCUMENT_ERR,null); - if (readOnly) - throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - if ((arg->getNodeType() == DOM_Node::ATTRIBUTE_NODE) && arg->isOwned() && (arg->ownerNode != ownerNode)) - throw DOM_DOMException(DOM_DOMException::INUSE_ATTRIBUTE_ERR,null); - - arg->ownerNode = ownerNode; - arg->isOwned(true); - int i=findNamePoint(arg->getNodeName()); - NodeImpl * previous=null; - if(i>=0) - { - previous = nodes->elementAt(i); - nodes->setElementAt(arg,i); - } - else - { - i=-1-i; // Insert point (may be end of list) - if(null==nodes) { - MemoryManager* manager = ownerNode->getDocument()->getMemoryManager(); - nodes=new (manager) NodeVector(manager); - } - nodes->insertElementAt(arg,i); - } - if (previous != null) { - previous->ownerNode = ownerNode->getOwnerDocument(); - previous->isOwned(false); - } - - return previous; -}; - - -void NamedNodeMapImpl::setReadOnly(bool readOnl, bool deep) -{ - this->readOnly=readOnl; - if(deep && nodes!=null) - { - //Enumeration e=nodes->elements(); - //while(e->hasMoreElements()) - // ((NodeImpl)e->nextElement())->setReadOnly(readOnl,deep); - int sz = nodes->size(); - for (int i=0; i<sz; ++i) { - nodes->elementAt(i)->setReadOnly(readOnl, deep); - } - } -}; - - -//Introduced in DOM Level 2 - -int NamedNodeMapImpl::findNamePoint(const DOMString &namespaceURI, - const DOMString &localName) -{ - if (nodes == null) - return -1; - // This is a linear search through the same nodes Vector. - // The Vector is sorted on the DOM Level 1 nodename. - // The DOM Level 2 NS keys are namespaceURI and Localname, - // so we must linear search thru it. - // In addition, to get this to work with nodes without any namespace - // (namespaceURI and localNames are both null) we then use the nodeName - // as a secondary key. - int i, len = nodes -> size(); - for (i = 0; i < len; ++i) { - NodeImpl *node = nodes -> elementAt(i); - if (! node -> getNamespaceURI().equals(namespaceURI)) //URI not match - continue; - DOMString nNamespaceURI = node->getNamespaceURI(); - DOMString nLocalName = node->getLocalName(); - if (namespaceURI == null) { - if (nNamespaceURI == null - && - (localName.equals(nLocalName) - || - (nLocalName == null && localName.equals(node->getNodeName())))) - return i; - } else { - if (namespaceURI.equals(nNamespaceURI) - && - localName.equals(nLocalName)) - return i; - } - } - return -1; //not found -} - - -NodeImpl *NamedNodeMapImpl::getNamedItemNS(const DOMString &namespaceURI, - const DOMString &localName) -{ - int i = findNamePoint(namespaceURI, localName); - return i < 0 ? null : nodes -> elementAt(i); -} - - -// -// setNamedItemNS() Put the item into the NamedNodeList by name. -// If an item with the same name already was -// in the list, replace it. Return the old -// item, if there was one. -// Caller is responsible for arranging for -// deletion of the old item if its ref count is -// zero. -// -NodeImpl * NamedNodeMapImpl::setNamedItemNS(NodeImpl *arg) -{ - if (arg->getOwnerDocument() != ownerNode->getOwnerDocument()) - throw DOM_DOMException(DOM_DOMException::WRONG_DOCUMENT_ERR,null); - if (readOnly) - throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - if (arg->isOwned()) - throw DOM_DOMException(DOM_DOMException::INUSE_ATTRIBUTE_ERR,null); - - arg->ownerNode = ownerNode; - arg->isOwned(true); - int i=findNamePoint(arg->getNamespaceURI(), arg->getLocalName()); - NodeImpl *previous=null; - if(i>=0) { - previous = nodes->elementAt(i); - nodes->setElementAt(arg,i); - } else { - i=findNamePoint(arg->getNodeName()); // Insert point (may be end of list) - if (i<0) - i = -1 - i; - if(null==nodes) { - MemoryManager* manager = ownerNode->getDocument()->getMemoryManager(); - nodes=new (manager) NodeVector(manager); - } - nodes->insertElementAt(arg,i); - } - if (previous != null) { - previous->ownerNode = ownerNode->getOwnerDocument(); - previous->isOwned(false); - } - - return previous; -}; - - -// removeNamedItemNS() - Remove the named item, and return it. -// The caller must arrange for deletion of the -// returned item if its refcount has gone to zero - -// we can't do it here because the caller would -// never see the returned node. -NodeImpl *NamedNodeMapImpl::removeNamedItemNS(const DOMString &namespaceURI, - const DOMString &localName) -{ - if (readOnly) - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - int i = findNamePoint(namespaceURI, localName); - if (i < 0) - throw DOM_DOMException(DOM_DOMException::NOT_FOUND_ERR, null); - - NodeImpl * n = nodes -> elementAt(i); - nodes -> removeElementAt(i); //remove n from nodes - n->ownerNode = ownerNode->getOwnerDocument(); - n->isOwned(false); - return n; -} - -/** - * NON-DOM - * set the ownerDocument of this node, its children, and its attributes - */ -void NamedNodeMapImpl::setOwnerDocument(DocumentImpl *doc) { - if (nodes != null) { - for (unsigned int i = 0; i < nodes->size(); i++) { - item(i)->setOwnerDocument(doc); - } - } -} - - -void NamedNodeMapImpl::cloneContent(NamedNodeMapImpl *srcmap) { - if ((srcmap != null) && (srcmap->nodes != null) && (srcmap->nodes->size() > 0)) - { - if (nodes != null) { - delete nodes; - } - - MemoryManager* manager = ownerNode->getDocument()->getMemoryManager(); - nodes = new (manager) NodeVector(srcmap->nodes->size(), manager); - for (unsigned int i = 0; i < srcmap->nodes->size(); i++) - { - NodeImpl *n = srcmap->nodes->elementAt(i); - NodeImpl *clone = n->cloneNode(true); - clone->isSpecified(n->isSpecified()); - clone->ownerNode = ownerNode; - clone->isOwned(true); - nodes->addElement(clone); -// n = null; -// clone = null; - } - } -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/NamedNodeMapImpl.hpp b/src/xercesc/dom/deprecated/NamedNodeMapImpl.hpp deleted file mode 100644 index 4604970785c11facca613d275cf58122016e3120..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NamedNodeMapImpl.hpp +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef NamedNodeMapImpl_HEADER_GUARD_ -#define NamedNodeMapImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -#include <xercesc/util/XMemory.hpp> -#include "NodeImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class NodeVector; -class DocumentImpl; -class NodeImpl; - -class DEPRECATED_DOM_EXPORT NamedNodeMapImpl: public XMemory { -protected: - NodeVector *nodes; - NodeImpl *ownerNode; // the node this map belongs to - bool readOnly; - int refCount; - static int gLiveNamedNodeMaps; - static int gTotalNamedNodeMaps; - - - friend class DOM_NamedNodeMap; - friend class DomMemDebug; - friend class ElementImpl; - friend class DocumentImpl; - - virtual void cloneContent(NamedNodeMapImpl *srcmap); - -public: - NamedNodeMapImpl(NodeImpl *ownerNode); - - virtual ~NamedNodeMapImpl(); - virtual NamedNodeMapImpl *cloneMap(NodeImpl *ownerNode); - static void addRef(NamedNodeMapImpl *); - virtual int findNamePoint(const DOMString &name); - virtual unsigned int getLength(); - virtual NodeImpl *getNamedItem(const DOMString &name); - virtual NodeImpl *item(unsigned int index); - virtual void removeAll(); - virtual NodeImpl *removeNamedItem(const DOMString &name); - static void removeRef(NamedNodeMapImpl *); - virtual NodeImpl *setNamedItem(NodeImpl *arg); - virtual void setReadOnly(bool readOnly, bool deep); - - //Introduced in DOM Level 2 - virtual int findNamePoint(const DOMString &namespaceURI, - const DOMString &localName); - virtual NodeImpl *getNamedItemNS(const DOMString &namespaceURI, - const DOMString &localName); - virtual NodeImpl *setNamedItemNS(NodeImpl *arg); - virtual NodeImpl *removeNamedItemNS(const DOMString &namespaceURI, - const DOMString &localName); - - virtual void setOwnerDocument(DocumentImpl *doc); -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/NodeIDMap.cpp b/src/xercesc/dom/deprecated/NodeIDMap.cpp deleted file mode 100644 index 1e2f63b93ea8e40661700b26a540e2ec5d46f241..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NodeIDMap.cpp +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - -#include "DOMString.hpp" -#include "AttrImpl.hpp" -#include "NodeIDMap.hpp" -#include <xercesc/util/XMLString.hpp> -#include <xercesc/util/RuntimeException.hpp> -#include <stdio.h> - -XERCES_CPP_NAMESPACE_BEGIN - - -static const int gPrimes[] = {997, 9973, 99991, 999983, 0 }; // To do - add a few more. - -static const float gMaxFill = 0.8f; // The maximum fraction of the total - // table entries to consume before exanding. - -NodeIDMap::NodeIDMap(int initialSize, - MemoryManager* const manager) -: fMemoryManager(manager) -{ - for (fSizeIndex = 0; gPrimes[fSizeIndex] < initialSize; fSizeIndex++) - { - if (gPrimes[fSizeIndex] == 0) - { - // We need a bigger size than the largest available one. - // Big trouble. - fSizeIndex--; - ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::NodeIDMap_GrowErr, fMemoryManager); - } - } - - fSize = gPrimes[fSizeIndex]; - fNumEntries = 0; - fMaxEntries = (unsigned long)(float(fSize) * gMaxFill); - - fTable = (AttrImpl**) manager->allocate(fSize * sizeof(AttrImpl*));// new AttrImpl *[fSize]; - unsigned int i; - for (i=0; i<fSize; i++) - fTable[i] = 0; -}; - - -NodeIDMap::~NodeIDMap() -{ - // delete[] fTable; - fMemoryManager->deallocate(fTable);//fTable = 0; -}; - - - -void NodeIDMap::add(AttrImpl *attr) -{ - // - // If the table is getting too full, grow it. We arbitrarily limit - // the table to 80 full, which should limit the average number of - // rehashes to a reasonable value. - // - if (fNumEntries >= fMaxEntries) - growTable(); - fNumEntries++; - - // - // Hash the value string from the ID attribute being added to the table - // 0 < Initial hash value < table size. - // An initial hash of zero would cause the rehash to fail. - // - DOMString id=attr->getValue(); - unsigned int initalHash = XMLString::hashN(id.rawBuffer(), id.length(), fSize-1, fMemoryManager); - initalHash++; - unsigned int currentHash = initalHash; - - // - // Loop looking for an empty slot for this ID. - // Don't even bother checking to see if the ID is already there - - // the table is only filled by the parser from valid documents, which - // can not have duplicates. Behavior of invalid docs is not defined. - // - while (true) - { - AttrImpl *tableSlot = fTable[currentHash]; - if (tableSlot == 0 || - tableSlot == (AttrImpl *)-1) - break; - currentHash += initalHash; // rehash - if (currentHash >= fSize) - currentHash = currentHash % fSize; - } - - // - // We've found our slot. Stick the pointer to the attr into it. - // - fTable[currentHash] = attr; - -}; - - -void NodeIDMap::remove(AttrImpl *attr) -{ - // - // Hash the value string from the ID attribute being added to the table - // 0 < Initial hash value < table size. - // An initial hash of zero would cause the rehash to fail. - // - DOMString id=attr->getValue(); - unsigned int initalHash = XMLString::hashN(id.rawBuffer(), id.length(), fSize-1, fMemoryManager); - initalHash++; - unsigned int currentHash = initalHash; - - // - // Loop looking for a slot pointing to an attr with this id. - // - while (true) - { - AttrImpl *tableSlot = fTable[currentHash]; - if (tableSlot == 0) - { - // There is no matching entry in the table - return; - } - - if (tableSlot == attr) - { - // Found the attribute. Set the slot to -1 to indicate - // that it was once used, meaning that lookups, while never - // matching here, can not stop either, but must rehash again - // and continue searching. - fTable[currentHash] = (AttrImpl *)-1; - return; - } - - currentHash += initalHash; // rehash. - if (currentHash >= fSize) - currentHash = currentHash % fSize; - } - -}; - - -AttrImpl *NodeIDMap::find(const DOMString &id) -{ - // - // Get the hashcode for the supplied string. - // - unsigned int initalHash = XMLString::hashN(id.rawBuffer(), id.length(), fSize-1, fMemoryManager); - initalHash++; - unsigned int currentHash = initalHash; - - // - // Loop looking for a slot pointing to an attr with this id. - // - while (true) - { - AttrImpl *tableSlot = fTable[currentHash]; - if (tableSlot == 0) - { - // There is no matching entry in the table - return 0; - } - - - if ((tableSlot != (AttrImpl *)-1) && tableSlot->getValue().equals(id)) - return tableSlot; - - currentHash += initalHash; // rehash - if (currentHash >= fSize) - currentHash = currentHash % fSize; - } - return 0; // Never gets here, but keeps some compilers happy. -}; - - -// -// Grow the table to the next larger size. -// It has gotten too full for efficient operation. -// (We never fill it all the way) -// -void NodeIDMap::growTable() -{ - AttrImpl **oldTable = fTable; - unsigned int oldSize = fSize; - - // - // Figure the new table size. - // -#if defined(XERCES_DEBUG) - fprintf(stderr, "growing...\n"); -#endif - fSizeIndex++; - fSize = gPrimes[fSizeIndex]; - if (fSize == 0) - { - // We need to grow bigger than the largest available size. - // Big trouble. - fSizeIndex--; - ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::NodeIDMap_GrowErr, fMemoryManager); - } - - // - // Allocate the new table. - // - fTable = (AttrImpl**) fMemoryManager->allocate(fSize * sizeof(AttrImpl*));//new AttrImpl *[fSize]; - unsigned int i; - for (i=0; i<fSize; i++) - fTable[i] = 0; - - fMaxEntries = (unsigned long)(float(fSize) * gMaxFill); - - // - // Move entries over from the old table to the new one. - // - for (i=0; i<oldSize; i++) - { - if ((oldTable[i] != 0) && (oldTable[i] != (AttrImpl *)-1)) - add(oldTable[i]); - } - - fMemoryManager->deallocate(oldTable);//delete [] oldTable; - -}; - - -XERCES_CPP_NAMESPACE_END - - diff --git a/src/xercesc/dom/deprecated/NodeIDMap.hpp b/src/xercesc/dom/deprecated/NodeIDMap.hpp deleted file mode 100644 index 318f7af4b5efd41183cbf82b8782d497802b2196..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NodeIDMap.hpp +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef NodeIDMap_HEADER_GUARD_ -#define NodeIDMap_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - - - -// -// Class NodeIDMap is a hash table that is used in the implementation of -// of DOM_Document::getElementsByID(). -// -// Why Yet Another HashTable implementation? Becuase it can be significantly -// smaller when tuned for this exact usage, and the generic RefHashTableOf -// from the xerces utils project is not a paricularly good fit. -// -#include <xercesc/util/PlatformUtils.hpp> - -XERCES_CPP_NAMESPACE_BEGIN - - -class AttrImpl; -class DOMString; - - -class NodeIDMap : public XMemory { -public: - - // Create a new hash table, sized to hold "initialSize" - NodeIDMap(int initialSize, - MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - // Entries. It will automatically grow if need be. - - virtual ~NodeIDMap(); - -private: - NodeIDMap(const NodeIDMap &other); // No copy, assignement, comparison. - NodeIDMap &operator = (const NodeIDMap &other); - bool operator == (const NodeIDMap &other); - -public: - void add(AttrImpl *attr); // Add the specified attribute to the table. - void remove(AttrImpl *other); // Remove the specified attribute. - // Does nothing if the node is not in the table. - AttrImpl *find(const DOMString &ID); // Find the attribute node in the table with this ID - -private: - void growTable(); - -private: - AttrImpl **fTable; - unsigned int fSizeIndex; // Index of the current table size in the - // array of possible table sizes. - unsigned int fSize; // The current size of the table array - // (number of slots, not bytes.) - unsigned int fNumEntries; // The number of entries used. - unsigned int fMaxEntries; // The max number of entries to use before - // growing the table. - MemoryManager* fMemoryManager; - -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/NodeImpl.cpp b/src/xercesc/dom/deprecated/NodeImpl.cpp deleted file mode 100644 index e723c322402b757675bd55128ed0d7f4be987469..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NodeImpl.cpp +++ /dev/null @@ -1,500 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// This class doesn't support having any children, and implements the behavior -// of an empty NodeList as far getChildNodes is concerned. -// The ParentNode subclass overrides this behavior. - -#include "NodeImpl.hpp" -#include "AttrImpl.hpp" -#include "DOM_DOMException.hpp" -#include "DOM_Node.hpp" -#include "DOM_DOMImplementation.hpp" -#include "DOMString.hpp" -#include "DStringPool.hpp" -#include "DocumentImpl.hpp" -#include "NodeIDMap.hpp" -#include "stdio.h" -#include "TextImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -static DOMString *s_xml = null; -static DOMString *s_xmlURI = null; -static DOMString *s_xmlns = null; -static DOMString *s_xmlnsURI = null; - -static XMLRegisterCleanup nodeImplCleanup; - -const unsigned short NodeImpl::READONLY = 0x1<<0; -const unsigned short NodeImpl::SYNCDATA = 0x1<<1; -const unsigned short NodeImpl::SYNCCHILDREN = 0x1<<2; -const unsigned short NodeImpl::OWNED = 0x1<<3; -const unsigned short NodeImpl::FIRSTCHILD = 0x1<<4; -const unsigned short NodeImpl::SPECIFIED = 0x1<<5; -const unsigned short NodeImpl::IGNORABLEWS = 0x1<<6; -const unsigned short NodeImpl::SETVALUE = 0x1<<7; -const unsigned short NodeImpl::ID_ATTR = 0x1<<8; -const unsigned short NodeImpl::USERDATA = 0x1<<9; -const unsigned short NodeImpl::HASSTRING = 0x1<<10; - - -int NodeImpl::gLiveNodeImpls = 0; // Counters for debug & tuning. -int NodeImpl::gTotalNodeImpls= 0; - - -NodeImpl::NodeImpl(DocumentImpl *ownerDoc) -{ - this->flags = 0; - // as long as we do not have any owner, ownerNode is our ownerDocument - this->ownerNode = ownerDoc; - - this->nodeRefCount = 0; - NodeImpl::gLiveNodeImpls++; - NodeImpl::gTotalNodeImpls++; -}; - -// This only makes a shallow copy, cloneChildren must also be called for a -// deep clone -NodeImpl::NodeImpl(const NodeImpl &other) : NodeListImpl() -{ - this->flags = other.flags; - this->isReadOnly(false); - - this->nodeRefCount = 0; - NodeImpl::gLiveNodeImpls++; - NodeImpl::gTotalNodeImpls++; - - // Need to break the association w/ original parent - // this->ownerNode = other.getOwnerDocument(); this doesn't work??? - this->ownerNode = ((NodeImpl*)&other)->getOwnerDocument(); - this->isOwned(false); -}; - - - -NodeImpl::~NodeImpl() { - if (hasUserData()) - { - setUserData(null); - } - NodeImpl::gLiveNodeImpls--; -}; - - -// Dynamic Cast substitute functions -bool NodeImpl::isAttrImpl() {return false;}; -bool NodeImpl::isCDATASectionImpl() {return false;}; -bool NodeImpl::isDocumentFragmentImpl() {return false;}; -bool NodeImpl::isDocumentImpl() {return false;}; -bool NodeImpl::isDocumentTypeImpl() {return false;}; -bool NodeImpl::isElementImpl() {return false;}; -bool NodeImpl::isEntityReference() {return false;}; -bool NodeImpl::isTextImpl() {return false;}; - - -void NodeImpl::changed() { - // we do not actually store this information on every node, we only - // have a global indicator on the Document. Doing otherwise cost us too - // much for little gain. - getDocument()->changed(); -} - -int NodeImpl::changes() -{ - // we do not actually store this information on every node, we only - // have a global indicator on the Document. Doing otherwise cost us too - // much for little gain. - return getDocument()->changes(); -}; - - -NodeImpl * NodeImpl::appendChild(NodeImpl *newChild) -{ - return insertBefore(newChild, null); -}; - - -// NodeImpl::deleteIf is called when a node's reference count goes -// to 0. It is separate function from removeRef because removeRef -// is likely to be in-lined. -// -// See comments at RefCountedImpl::removeRef(). -// -void NodeImpl::deleteIf(NodeImpl *thisNode) -{ - if (thisNode == 0) - return; - - if (thisNode->isOwned()) - return; - - // Delete this node. There should be no siblings, as the DOM - // supports no node operations that would detach a node from - // its parent while retaining siblings. - // The target node may have children, in which case they must - // be removed from this node before deleting this node. - - // First, if this node is an ID attribute, we need to remove it - // from the hashtable of element IDs before removing the Attrs - // children. This is because the Attr's children Text nodes - // contain the attr's value, which is the hash table key. - // - if (thisNode->isAttrImpl() && ((AttrImpl *)thisNode->isIdAttr())) - { - ((AttrImpl *)thisNode)->getOwnerDocument() -> - getNodeIDMap()->remove((AttrImpl *)thisNode); - } - - thisNode->isReadOnly(false); // removeChild requires node not be readonly. - NodeImpl *theNextChild; - for (NodeImpl *child = thisNode->getFirstChild(); child != 0; - child=theNextChild) - { - theNextChild = child->getNextSibling(); - thisNode->removeChild(child); - if (child->nodeRefCount == 0) - deleteIf(child); - } - delete thisNode; -}; - - - -NamedNodeMapImpl * NodeImpl::getAttributes() { - return 0; // overridden in ElementImpl -}; - - -NodeListImpl *NodeImpl::getChildNodes() { - return this; // overridden in ParentNode -}; - - - -NodeImpl * NodeImpl::getFirstChild() { - return 0; // overridden in ParentNode -}; - - -NodeImpl * NodeImpl::getLastChild() -{ - return 0; // overridden in ParentNode -}; - - -unsigned int NodeImpl::getLength() { - return 0; // overridden in ParentNode -}; - - -NodeImpl * NodeImpl::getNextSibling() { - return null; // overridden in ChildNode -}; - - - -DOMString NodeImpl::getNodeValue() -{ - return null; // overridden in some subclasses -}; - - -DocumentImpl *NodeImpl::getOwnerDocument() -{ - // if we have an owner simply forward the request - // otherwise ownerNode is our ownerDocument - if (isOwned()) { - return ownerNode->getDocument(); - } else { - return (DocumentImpl *) ownerNode; - } -}; - -// unlike getOwnerDocument this is not overriden by DocumentImpl to return null -DocumentImpl *NodeImpl::getDocument() -{ - // if we have an owner simply forward the request - // otherwise ownerNode is our ownerDocument - if (isOwned()) { - return ownerNode->getDocument(); - } else { - return (DocumentImpl *) ownerNode; - } -}; - - -void NodeImpl::setOwnerDocument(DocumentImpl *doc) { - // if we have an owner we rely on it to have it right - // otherwise ownerNode is our ownerDocument - if (!isOwned()) { - ownerNode = doc; - } -} - -NodeImpl * NodeImpl::getParentNode() -{ - return null; // overridden in ChildNode -} - - -NodeImpl* NodeImpl::getPreviousSibling() -{ - return null; // overridden in ChildNode -} - - -void *NodeImpl::getUserData() -{ - return (hasUserData()) ? getOwnerDocument()->getUserData(this) : null; -} - - -bool NodeImpl::hasChildNodes() -{ - return false; -} - - - -NodeImpl *NodeImpl::insertBefore(NodeImpl * /*newChild*/, NodeImpl * /*refChild*/) { - throw DOM_DOMException(DOM_DOMException::HIERARCHY_REQUEST_ERR,null); - return 0; -} - -NodeImpl *NodeImpl::item(unsigned int /*index*/) { - return 0; -} - - -NodeImpl *NodeImpl::removeChild(NodeImpl * /*oldChild*/) -{ - throw DOM_DOMException(DOM_DOMException::NOT_FOUND_ERR, null); - return 0; -} - - -NodeImpl *NodeImpl::replaceChild(NodeImpl * /*newChild*/, NodeImpl * /*oldChild*/) -{ - throw DOM_DOMException(DOM_DOMException::HIERARCHY_REQUEST_ERR,null); - return 0; -} - - -void NodeImpl::referenced() -{ - RefCountedImpl::addRef(this->getOwnerDocument()); -} - - -// -// unreferenced will be called whenever the refernce count on -// this node goes from 1 to 0. This node will only be -// directly deleted here (by deleteIf) if it is outside -// of the document tree. -// -void NodeImpl::unreferenced() -{ - DocumentImpl *doc = this->getOwnerDocument(); - deleteIf(this); // This gets nodes outside of the document - - // deleteIf() deletes only if the parent - // node is null. - - // If this was the last external reference within the document, - // the entire document will be deleted as well. - RefCountedImpl::removeRef(doc); -} - - -void NodeImpl::setNodeValue(const DOMString & /*val*/) -{ - // Default behavior is to do nothing, overridden in some subclasses -} - - - -void NodeImpl::setReadOnly(bool readOnly, bool /*deep*/) -{ - this->isReadOnly(readOnly); - // by default we do not have children, so deep is meaningless - // this is overridden by ParentNode -} - - -void NodeImpl::setUserData(void * val) -{ - getOwnerDocument()->setUserData(this, val); - if (val) - hasUserData(true); - else - hasUserData(false); -}; - - - -DOMString NodeImpl::toString() -{ - return DOMString("[")+getNodeName()+": "+getNodeValue()+"]"; - // return getNodeName(); -}; - -//Introduced in DOM Level 2 - -void NodeImpl::normalize() -{ - // does nothing by default, overridden by subclasses -}; - - -bool NodeImpl::isSupported(const DOMString &feature, const DOMString &version) -{ - return DOM_DOMImplementation::getImplementation().hasFeature(feature, version); -} - -DOMString NodeImpl::getNamespaceURI() -{ - return 0; -} - -DOMString NodeImpl::getPrefix() -{ - return 0; -} - -DOMString NodeImpl::getLocalName() -{ - return 0; -} - - -void NodeImpl::setPrefix(const DOMString & /*fPrefix*/) -{ - throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR,null); -} - -bool NodeImpl::hasAttributes() { - return 0; // overridden in ElementImpl -}; - - -DOMString NodeImpl::getXmlnsString() { - return DStringPool::getStaticString("xmlns" - , &s_xmlns - , reinitNodeImpl - , nodeImplCleanup - ); -} - -DOMString NodeImpl::getXmlnsURIString() { - return DStringPool::getStaticString("http://www.w3.org/2000/xmlns/" - , &s_xmlnsURI - , reinitNodeImpl - , nodeImplCleanup - ); -} - -DOMString NodeImpl::getXmlString() { - return DStringPool::getStaticString("xml" - , &s_xml - , reinitNodeImpl - , nodeImplCleanup - ); -} - -DOMString NodeImpl::getXmlURIString() { - return DStringPool::getStaticString("http://www.w3.org/XML/1998/namespace" - , &s_xmlURI - , reinitNodeImpl - , nodeImplCleanup - ); -} - -//Return a URI mapped from the given prefix and namespaceURI as below -// prefix namespaceURI output -//--------------------------------------------------- -// "xml" xmlURI xmlURI -// "xml" otherwise NAMESPACE_ERR -// "xmlns" xmlnsURI xmlnsURI (nType = ATTRIBUTE_NODE only) -// "xmlns" otherwise NAMESPACE_ERR (nType = ATTRIBUTE_NODE only) -// != null null or "" NAMESPACE_ERR -// else any namesapceURI -const DOMString& NodeImpl::mapPrefix(const DOMString &prefix, - const DOMString &namespaceURI, short nType) -{ - DOMString xml = DStringPool::getStaticString("xml" - , &s_xml - , reinitNodeImpl - , nodeImplCleanup - ); - DOMString xmlURI = DStringPool::getStaticString("http://www.w3.org/XML/1998/namespace" - , &s_xmlURI - , reinitNodeImpl - , nodeImplCleanup - ); - DOMString xmlns = DStringPool::getStaticString("xmlns" - , &s_xmlns - , reinitNodeImpl - , nodeImplCleanup - ); - DOMString xmlnsURI = DStringPool::getStaticString("http://www.w3.org/2000/xmlns/" - , &s_xmlnsURI - , reinitNodeImpl - , nodeImplCleanup - ); - - if (prefix == null) - return namespaceURI; - if (prefix.equals(xml)) { - if (namespaceURI.equals(xmlURI)) - return *s_xmlURI; - throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - } else if (nType == DOM_Node::ATTRIBUTE_NODE && prefix.equals(xmlns)) { - if (namespaceURI.equals(xmlnsURI)) - return *s_xmlnsURI; - throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - } else if (namespaceURI == null || namespaceURI.length() == 0) { - throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - } else - return namespaceURI; - return namespaceURI; -} - -// ----------------------------------------------------------------------- -// Notification that lazy data has been deleted -// ----------------------------------------------------------------------- -void NodeImpl::reinitNodeImpl() { - - delete s_xml; - s_xml = 0; - - delete s_xmlURI; - s_xmlURI = 0; - - delete s_xmlns; - s_xmlns = 0; - - delete s_xmlnsURI; - s_xmlnsURI = 0; - -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/NodeImpl.hpp b/src/xercesc/dom/deprecated/NodeImpl.hpp deleted file mode 100644 index b83c3c36f539a0bc190ddb827b34b53c34c1bc3e..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NodeImpl.hpp +++ /dev/null @@ -1,271 +0,0 @@ -#ifndef NodeImpl_HEADER_GUARD_ -#define NodeImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -/** - * A NodeImpl doesn't have any children, and can therefore only be directly - * inherited by classes of nodes that never have any, such as Text nodes. For - * other types, such as Element, classes must inherit from ParentNode. - * <P> - * All nodes in a single document must originate - * in that document. (Note that this is much tighter than "must be - * same implementation") Nodes are all aware of their ownerDocument, - * and attempts to mismatch will throw WRONG_DOCUMENT_ERR. - * <P> - * However, to save memory not all nodes always have a direct reference - * to their ownerDocument. When a node is owned by another node it relies - * on its owner to store its ownerDocument. Parent nodes always store it - * though, so there is never more than one level of indirection. - * And when a node doesn't have an owner, ownerNode refers to its - * ownerDocument. - **/ - -#include <xercesc/util/XMemory.hpp> -#include "NodeListImpl.hpp" -#include "DOMString.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class NamedNodeMapImpl; -class NodeListImpl; -class DocumentImpl; - -// define 'null' is used extensively in the DOM implementation code, -// as a consequence of its Java origins. -// MSVC 5.0 compiler has problems with overloaded function resolution -// when using the const int definition. -// -#if defined(XML_CSET) -const int null = 0; -#else -#define null 0 -#endif - - -class DEPRECATED_DOM_EXPORT NodeImpl: public NodeListImpl { -public: - NodeImpl *ownerNode; // typically the parent but not always! - - // data - - unsigned short flags; - - static const unsigned short READONLY; - static const unsigned short SYNCDATA; - static const unsigned short SYNCCHILDREN; - static const unsigned short OWNED; - static const unsigned short FIRSTCHILD; - static const unsigned short SPECIFIED; - static const unsigned short IGNORABLEWS; - static const unsigned short SETVALUE; - static const unsigned short ID_ATTR; - static const unsigned short USERDATA; - static const unsigned short HASSTRING; - - static int gLiveNodeImpls; // Counters for debug & tuning. - static int gTotalNodeImpls; - -public: - NodeImpl(DocumentImpl *ownerDocument); - NodeImpl(const NodeImpl &other); - virtual ~NodeImpl(); - - // Dynamic Cast replacement functions. - virtual bool isAttrImpl(); - virtual bool isCDATASectionImpl(); - virtual bool isDocumentFragmentImpl(); - virtual bool isDocumentImpl(); - virtual bool isDocumentTypeImpl(); - virtual bool isElementImpl(); - virtual bool isEntityReference(); - virtual bool isTextImpl(); - - virtual void changed(); - virtual int changes(); - - virtual NodeImpl *appendChild(NodeImpl *newChild); - virtual NodeImpl * cloneNode(bool deep) = 0; - static void deleteIf(NodeImpl *thisNode); - virtual NamedNodeMapImpl * getAttributes(); - virtual NodeListImpl *getChildNodes(); - virtual NodeImpl * getFirstChild(); - virtual NodeImpl * getLastChild(); - virtual unsigned int getLength(); - virtual NodeImpl * getNextSibling(); - virtual DOMString getNodeName() = 0; - virtual short getNodeType() = 0; - virtual DOMString getNodeValue(); - virtual DocumentImpl * getOwnerDocument(); - virtual NodeImpl * getParentNode(); - virtual NodeImpl* getPreviousSibling(); - virtual void *getUserData(); - virtual bool hasChildNodes(); - virtual NodeImpl *insertBefore(NodeImpl *newChild, NodeImpl *refChild); - static bool isKidOK(NodeImpl *parent, NodeImpl *child); - virtual NodeImpl *item(unsigned int index); - virtual void referenced(); - virtual NodeImpl * removeChild(NodeImpl *oldChild); - virtual NodeImpl *replaceChild(NodeImpl *newChild, NodeImpl *oldChild); - virtual void setNodeValue(const DOMString &value); - virtual void setReadOnly(bool readOnly, bool deep); - virtual void setUserData(void *value); - virtual DOMString toString(); - virtual void unreferenced(); - - //Introduced in DOM Level 2 - virtual void normalize(); - virtual bool isSupported(const DOMString &feature, const DOMString &version); - virtual DOMString getNamespaceURI(); - virtual DOMString getPrefix(); - virtual DOMString getLocalName(); - virtual void setPrefix(const DOMString &prefix); - virtual bool hasAttributes(); - -protected: - //Utility, not part of DOM Level 2 API - static const DOMString& mapPrefix(const DOMString &prefix, - const DOMString &namespaceURI, short nType); - static DOMString getXmlnsString(); - static DOMString getXmlnsURIString(); - static DOMString getXmlString(); - static DOMString getXmlURIString(); - -public: // should really be protected - ALH - - virtual void setOwnerDocument(DocumentImpl *doc); - // NON-DOM - // unlike getOwnerDocument this never returns null, even for Document nodes - virtual DocumentImpl * getDocument(); - - /* - * Flags setters and getters - */ - - inline bool isReadOnly() const { - return (flags & READONLY) != 0; - } - - inline void isReadOnly(bool value) { - flags = (value ? flags | READONLY : flags & ~READONLY); - } - - inline bool needsSyncData() const { - return (flags & SYNCDATA) != 0; - } - - inline void needsSyncData(bool value) { - flags = (value ? flags | SYNCDATA : flags & ~SYNCDATA); - } - - inline bool needsSyncChildren() const { - return (flags & SYNCCHILDREN) != 0; - } - - inline void needsSyncChildren(bool value) { - flags = (value ? flags | SYNCCHILDREN : flags & ~SYNCCHILDREN); - } - - inline bool isOwned() const { - return (flags & OWNED) != 0; - } - - inline void isOwned(bool value) { - flags = (value ? flags | OWNED : flags & ~OWNED); - } - - inline bool isFirstChild() const { - return (flags & FIRSTCHILD) != 0; - } - - inline void isFirstChild(bool value) { - flags = (value ? flags | FIRSTCHILD : flags & ~FIRSTCHILD); - } - - inline bool isSpecified() const { - return (flags & SPECIFIED) != 0; - } - - inline void isSpecified(bool value) { - flags = (value ? flags | SPECIFIED : flags & ~SPECIFIED); - } - - inline bool ignorableWhitespace() const { - return (flags & IGNORABLEWS) != 0; - } - - inline void ignorableWhitespace(bool value) { - flags = (value ? flags | IGNORABLEWS : flags & ~IGNORABLEWS); - } - - inline bool setValueCalled() const { - return (flags & SETVALUE) != 0; - } - - inline void setValueCalled(bool value) { - flags = (value ? flags | SETVALUE : flags & ~SETVALUE); - } - - inline bool isIdAttr() const { - return (flags & ID_ATTR) != 0; - } - - inline void isIdAttr(bool value) { - flags = (value ? flags | ID_ATTR : flags & ~ID_ATTR); - } - - inline bool hasUserData() const { - return (flags & USERDATA) != 0; - } - - inline void hasUserData(bool value) { - flags = (value ? flags | USERDATA : flags & ~USERDATA); - } - - inline bool hasStringValue() const { - return (flags & HASSTRING) != 0; - } - - inline void hasStringValue(bool value) { - flags = (value ? flags | HASSTRING : flags & ~HASSTRING); - } - - // ----------------------------------------------------------------------- - // Notification that lazy data has been deleted - // ----------------------------------------------------------------------- - static void reinitNodeImpl(); - -}; - - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/NodeIteratorImpl.cpp b/src/xercesc/dom/deprecated/NodeIteratorImpl.cpp deleted file mode 100644 index 911871d73ac6e83a02fecd5bff5635fa68c62a16..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NodeIteratorImpl.cpp +++ /dev/null @@ -1,395 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// NodeIteratorImpl.cpp: implementation of the NodeIteratorImpl class. -// -////////////////////////////////////////////////////////////////////// - -#include "NodeIteratorImpl.hpp" -#include "DOM_Document.hpp" -#include "DOM_DOMException.hpp" -#include "DocumentImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -NodeIteratorImpl::NodeIteratorImpl () -: fNodeFilter(0), - fDetached(false) -{ -} - -NodeIteratorImpl::~NodeIteratorImpl () -{ - fDetached = false; -} - - -void NodeIteratorImpl::detach () -{ - fDetached = true; -} - - -NodeIteratorImpl::NodeIteratorImpl ( - DOM_Node root, - unsigned long whatToShow, - DOM_NodeFilter* nodeFilter, - bool expandEntityRef) -: fRoot(root), - fWhatToShow(whatToShow), - fNodeFilter(nodeFilter), - fExpandEntityReferences(expandEntityRef), - fDetached(false), - fCurrentNode(0), - fForward(true) -{ - -} - - -NodeIteratorImpl::NodeIteratorImpl ( const NodeIteratorImpl& toCopy) -: RefCountedImpl(), - fRoot(toCopy.fRoot), - fWhatToShow(toCopy.fWhatToShow), - fNodeFilter(toCopy.fNodeFilter), - fExpandEntityReferences(toCopy.fExpandEntityReferences), - fDetached(toCopy.fDetached), - fCurrentNode(toCopy.fCurrentNode), - fForward(toCopy.fForward) -{ -} - - -NodeIteratorImpl& NodeIteratorImpl::operator= (const NodeIteratorImpl& other) { - fRoot = other.fRoot; - fCurrentNode = other.fRoot; - fWhatToShow = other.fWhatToShow; - fNodeFilter = other.fNodeFilter; - fForward = other.fForward; - fDetached = other.fDetached; - fExpandEntityReferences = other.fExpandEntityReferences; - return *this; -} - -/** Return the Root Node. */ -DOM_Node NodeIteratorImpl::getRoot () { - return fRoot; -} - -// Implementation Note: Note that the iterator looks at whatToShow -// and filter values at each call, and therefore one _could_ add -// setters for these values and alter them while iterating! - -/** Return the whatToShow value */ - -unsigned long NodeIteratorImpl::getWhatToShow () { - return fWhatToShow; -} - - -/** Return the filter */ - -DOM_NodeFilter* NodeIteratorImpl::getFilter () { - return fNodeFilter; -} - -/** Get the expandEntity reference flag. */ -bool NodeIteratorImpl::getExpandEntityReferences() -{ - return fExpandEntityReferences; -} - -/** Return the next DOM_Node in the Iterator. The node is the next node in - * depth-first order which also passes the filter, and whatToShow. - * A null return means either that - */ - -DOM_Node NodeIteratorImpl::nextNode () { - if (fDetached) - throw DOM_DOMException(DOM_DOMException::INVALID_STATE_ERR, null); - - DOM_Node result; - - // if root is null there is no next node. - if (fRoot.isNull()) - return result; - - DOM_Node aNextNode = fCurrentNode; - bool accepted = false; // the next node has not been accepted. - - while (!accepted) { - - // if last direction is not forward, repeat node. - if (!fForward && !aNextNode.isNull()) { - //System.out.println("nextNode():!fForward:"+fCurrentNode.getNodeName()); - aNextNode = fCurrentNode; - } else { - // else get the next node via depth-first - aNextNode = nextNode(aNextNode, true); - } - - fForward = true; //REVIST: should direction be set forward before null check? - - // nothing in the list. return null. - if (aNextNode.isNull()) - return result; - - // does node pass the filters and whatToShow? - accepted = acceptNode(aNextNode); - if (accepted) { - // if so, then the node is the current node. - fCurrentNode = aNextNode; - return fCurrentNode; - } - - } - - // no nodes, or no accepted nodes. - return result; -} - - -/** Return the previous Node in the Iterator. The node is the next node in - * _backwards_ depth-first order which also passes the filter, and whatToShow. - */ - -DOM_Node NodeIteratorImpl::previousNode () { - if (fDetached) - throw DOM_DOMException(DOM_DOMException::INVALID_STATE_ERR, null); - - DOM_Node result; - - // if the root is null, or the current node is null, return null. - if (fRoot.isNull() || fCurrentNode.isNull()) - return result; - - DOM_Node aPreviousNode = fCurrentNode; - bool accepted = false; - - while (!accepted) { - - - if (fForward && ! aPreviousNode.isNull()) { - //repeat last node. - aPreviousNode = fCurrentNode; - } else { - // get previous node in backwards depth first order. - aPreviousNode = previousNode(aPreviousNode); - } - - // we are going backwards - fForward = false; - - // if the new previous node is null, we're at head or past the root, - // so return null. - if (aPreviousNode.isNull()) - return result; - - // check if node passes filters and whatToShow. - accepted = acceptNode(aPreviousNode); - if (accepted) { - // if accepted, update the current node, and return it. - fCurrentNode = aPreviousNode; - return fCurrentNode; - } - } - // there are no nodes? - return result; -} - - -/** The node is accepted if it passes the whatToShow and the filter. */ -bool NodeIteratorImpl::acceptNode (DOM_Node node) { - if (fDetached) - throw DOM_DOMException(DOM_DOMException::INVALID_STATE_ERR, null); - - if (fNodeFilter == 0) { - return ((fWhatToShow & (1 << (node.getNodeType() - 1))) != 0); - } else { - return ((fWhatToShow & (1 << (node.getNodeType() - 1))) != 0) - && fNodeFilter->acceptNode(node) == DOM_NodeFilter::FILTER_ACCEPT; - } -} - - -/** Return node, if matches or any parent if matches. */ -DOM_Node NodeIteratorImpl::matchNodeOrParent (DOM_Node node) { - DOM_Node result; - - for (DOM_Node n = fCurrentNode; n != fRoot; n = n.getParentNode()) { - if (node == n) return n; - } - - return result; -} - - -/** The method nextNode(DOM_Node, bool) returns the next node - * from the actual DOM tree. - * - * The bool visitChildren determines whether to visit the children. - * The result is the nextNode. - */ - -DOM_Node NodeIteratorImpl::nextNode (DOM_Node node, bool visitChildren) { - if (fDetached) - throw DOM_DOMException(DOM_DOMException::INVALID_STATE_ERR, null); - - if (node.isNull()) return fRoot; - - DOM_Node result; - // only check children if we visit children. - if (visitChildren) { - //if hasChildren, return 1st child. - if (node.hasChildNodes()) { - result = node.getFirstChild(); - return result; - } - } - - // if hasSibling, return sibling - if (node != fRoot) { - result = node.getNextSibling(); - if (! result.isNull()) return result; - - - // return parent's 1st sibling. - DOM_Node parent = node.getParentNode(); - while (!parent.isNull() && parent != fRoot) { - result = parent.getNextSibling(); - if (!result.isNull()) { - return result; - } else { - parent = parent.getParentNode(); - } - - } // while (parent != null && parent != fRoot) { - } - // end of list, return null - DOM_Node aNull; - return aNull; -} - - -/** The method previousNode(DOM_Node) returns the previous node - * from the actual DOM tree. - */ - -DOM_Node NodeIteratorImpl::previousNode (DOM_Node node) { - if (fDetached) - throw DOM_DOMException(DOM_DOMException::INVALID_STATE_ERR, null); - - DOM_Node result; - - // if we're at the root, return null. - if (node == fRoot) - return result; - - // get sibling - result = node.getPreviousSibling(); - if (result.isNull()) { - //if 1st sibling, return parent - result = node.getParentNode(); - return result; - } - - // if sibling has children, keep getting last child of child. - if (result.hasChildNodes()) { - while (result.hasChildNodes()) { - result = result.getLastChild(); - } - } - - return result; -} - - -/** Fix-up the iterator on a remove. Called by DOM or otherwise, - * before an actual DOM remove. - */ - -void NodeIteratorImpl::removeNode (DOM_Node node) { - if (fDetached) - throw DOM_DOMException(DOM_DOMException::INVALID_STATE_ERR, null); - - // Implementation note: Fix-up means setting the current node properly - // after a remove. - - if (node.isNull()) - return; - - DOM_Node deleted = matchNodeOrParent(node); - - if (deleted.isNull()) return; - - if (fForward) { - fCurrentNode = previousNode(deleted); - } else - // if (!fForward) - { - DOM_Node next = nextNode(deleted, false); - if (! next.isNull()) { - // normal case: there _are_ nodes following this in the iterator. - fCurrentNode = next; - } else { - // the last node in the iterator is to be removed, - // so we set the current node to be the previous one. - fCurrentNode = previousNode(deleted); - fForward = true; - } - - } - -} - - -void NodeIteratorImpl::unreferenced() -{ - DOM_Document doc = fRoot.getOwnerDocument(); - DocumentImpl* impl; - - if (! doc.isNull()) { - impl = (DocumentImpl *) doc.fImpl; - } - else - impl = (DocumentImpl *) fRoot.fImpl; - - if (impl->iterators != 0L) { - int i; - int sz = impl->iterators->size(); - for (i = 0; i < sz; i++) - if (impl->iterators->elementAt(i) == this) { - impl->iterators->removeElementAt(i); - break; - } - } - -// delete this; - NodeIteratorImpl* ptr = this; - delete ptr; -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/NodeIteratorImpl.hpp b/src/xercesc/dom/deprecated/NodeIteratorImpl.hpp deleted file mode 100644 index b1757f888e682634b4368eea0f5d7e4c175de039..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NodeIteratorImpl.hpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#ifndef NodeIteratorImpl_HEADER_GUARD_ -#define NodeIteratorImpl_HEADER_GUARD_ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -#include "DOM_Node.hpp" -#include "DOM_NodeIterator.hpp" -#include "RefCountedImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DEPRECATED_DOM_EXPORT NodeIteratorImpl : public RefCountedImpl { - protected: - NodeIteratorImpl (); - - public: - virtual ~NodeIteratorImpl (); - NodeIteratorImpl ( - DOM_Node root, - unsigned long whatToShow, - DOM_NodeFilter* nodeFilter, - bool expandEntityRef); - - NodeIteratorImpl ( const NodeIteratorImpl& toCopy); - - NodeIteratorImpl& operator= (const NodeIteratorImpl& other); - - DOM_Node getRoot (); - unsigned long getWhatToShow (); - DOM_NodeFilter* getFilter (); - - DOM_Node nextNode (); - DOM_Node previousNode (); - bool acceptNode (DOM_Node node); - DOM_Node matchNodeOrParent (DOM_Node node); - DOM_Node nextNode (DOM_Node node, bool visitChildren); - DOM_Node previousNode (DOM_Node node); - void removeNode (DOM_Node node); - - void unreferenced(); - - void detach (); - - // Get the expandEntity reference flag. - bool getExpandEntityReferences(); - - - private: - // - // Data - // - // The root. - DOM_Node fRoot; - - // The whatToShow mask. - unsigned long fWhatToShow; - - // The NodeFilter reference. - DOM_NodeFilter* fNodeFilter; - - // The expandEntity reference flag. - bool fExpandEntityReferences; - - bool fDetached; - - // - // Iterator state - current node and direction. - // - // Note: The current node and direction are sufficient to implement - // the desired behaviour of the current pointer being _between_ - // two nodes. The fCurrentNode is actually the last node returned, - // and the - // direction is whether the pointer is in front or behind this node. - // (usually akin to whether the node was returned via nextNode()) - // (eg fForward = true) or previousNode() (eg fForward = false). - - // The last Node returned. - DOM_Node fCurrentNode; - - // The direction of the iterator on the fCurrentNode. - // <code> - // nextNode() == fForward = true;<br> - // previousNode() == fForward = false;<br> - // </code> - bool fForward; - - -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/NodeListImpl.cpp b/src/xercesc/dom/deprecated/NodeListImpl.cpp deleted file mode 100644 index 60ce7e4b39f1f5f3cc393834e9530c5b2be6df81..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NodeListImpl.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - - -#include "NodeListImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -NodeListImpl::NodeListImpl() {}; - -NodeListImpl::~NodeListImpl() {}; - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/NodeListImpl.hpp b/src/xercesc/dom/deprecated/NodeListImpl.hpp deleted file mode 100644 index 4de1e1584e70aac9ffb89b1634366139a261482b..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NodeListImpl.hpp +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef NodeListImpl_HEADER_GUARD_ -#define NodeListImpl_HEADER_GUARD_ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -#include <xercesc/util/XercesDefs.hpp> -#include "RefCountedImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - -class NodeImpl; - - -class DEPRECATED_DOM_EXPORT NodeListImpl : public RefCountedImpl -{ -protected: - NodeListImpl(); -public: - virtual ~NodeListImpl(); - virtual NodeImpl * item(unsigned int index) = 0; - virtual unsigned int getLength() = 0; -}; - -XERCES_CPP_NAMESPACE_END - -#endif - - diff --git a/src/xercesc/dom/deprecated/NodeVector.cpp b/src/xercesc/dom/deprecated/NodeVector.cpp deleted file mode 100644 index 0f493dbd38255cbb556f56aecc59034b5bab3296..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NodeVector.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// file: NodeVector.cpp -// Implementation of class NodeVector. -// (Use of STL vector, or equivalent, would have been nice, -// but is not available. 'NodeImpl *' is the only type -// kept in Vectors in this DOM implementation, so this is -// a hardwired implementation for that type. -// - -#include "NodeVector.hpp" -#include <xercesc/framework/MemoryManager.hpp> -#include <assert.h> - -XERCES_CPP_NAMESPACE_BEGIN - - -NodeVector::NodeVector(MemoryManager* const manager) -: fMemoryManager(manager) -{ - init(10); -}; - -NodeVector::NodeVector(unsigned int size, - MemoryManager* const manager) -: fMemoryManager(manager) -{ - init(size); -}; - - -void NodeVector::init(unsigned int size) { - assert(size > 0); - data = (NodeImpl**) fMemoryManager->allocate(size * sizeof(NodeImpl*));//new NodeImpl *[size]; - assert(data != 0); - allocatedSize = size; - nextFreeSlot = 0; -}; - - -NodeVector::~NodeVector() { - fMemoryManager->deallocate(data);//delete [] data; -}; - - -void NodeVector::addElement(NodeImpl *elem) { - checkSpace(); - data[nextFreeSlot] = elem; - ++nextFreeSlot; -}; - - -void NodeVector::checkSpace() { - if (nextFreeSlot == allocatedSize) { - unsigned int grow = allocatedSize/2; - if (grow < 50) grow = 50; - unsigned int newAllocatedSize = allocatedSize + grow; - NodeImpl **newData = (NodeImpl**) fMemoryManager->allocate - ( - newAllocatedSize * sizeof(NodeImpl*) - );//new NodeImpl *[newAllocatedSize]; - assert(newData != 0); - for (unsigned int i=0; i<allocatedSize; i++) { - newData[i] = data[i]; - }; - fMemoryManager->deallocate(data);//delete [] data; - allocatedSize = newAllocatedSize; - data = newData; - }; -}; - - -NodeImpl *NodeVector::elementAt(unsigned int index) { - if (index >= nextFreeSlot) - return 0; - return data[index]; -}; - -NodeImpl *NodeVector::lastElement() { - if (nextFreeSlot == 0) - return 0; - return data[nextFreeSlot-1]; -}; - - -void NodeVector::insertElementAt(NodeImpl *elem, unsigned int index) { - unsigned int i; - - assert(index <= nextFreeSlot); - - checkSpace(); - for (i=nextFreeSlot; i>index; --i) { - data[i] = data[i-1]; - } - data[index] = elem; - ++nextFreeSlot; - -}; - - -void NodeVector::removeElementAt(unsigned int index) { - assert(index < nextFreeSlot); - for (unsigned int i=index; i<nextFreeSlot-1; ++i) { - data[i] = data[i+1]; - } - --nextFreeSlot; -}; - -void NodeVector::reset() { - nextFreeSlot = 0; -}; - -void NodeVector::setElementAt(NodeImpl *elem, unsigned int index) { - assert(index < nextFreeSlot); - data[index] = elem; -}; - - -unsigned int NodeVector::size() { - return nextFreeSlot; -}; - - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/NodeVector.hpp b/src/xercesc/dom/deprecated/NodeVector.hpp deleted file mode 100644 index 375dc6a578f7add4836977c014e9328a1b8b6e07..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NodeVector.hpp +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef NodeVector_HEADER_GUARD_ -#define NodeVector_HEADER_GUARD_ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - -#include <xercesc/util/PlatformUtils.hpp> - -XERCES_CPP_NAMESPACE_BEGIN - - -class NodeImpl; - - -class NodeVector : public XMemory { -private: - NodeImpl **data; - unsigned int allocatedSize; - unsigned int nextFreeSlot; - MemoryManager* fMemoryManager; - - void init(unsigned int size); - void checkSpace(); - -public: - NodeVector(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - NodeVector(unsigned int size, - MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - ~NodeVector(); - - unsigned int size(); - NodeImpl *elementAt(unsigned int index); - NodeImpl *lastElement(); - void addElement(NodeImpl *); - void insertElementAt(NodeImpl *, unsigned int index); - void setElementAt(NodeImpl *val, unsigned int index); - void removeElementAt(unsigned int index); - void reset(); -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/NotationImpl.cpp b/src/xercesc/dom/deprecated/NotationImpl.cpp deleted file mode 100644 index c9126347b89a3c04dd6fd6347606b71ca6b86a0c..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NotationImpl.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "NotationImpl.hpp" -#include "DOM_DOMException.hpp" -#include "DOM_Node.hpp" - - -XERCES_CPP_NAMESPACE_BEGIN - - -/** -* Notations are how the Document Type Description (DTD) records hints -* about the format of an XML "unparsed entity" -- in other words, -* non-XML data bound to this document type, which some applications -* may wish to consult when manipulating the document. A Notation -* represents a name-value pair, with its nodeName being set to the -* declared name of the notation. -* <P> -* Notations are also used to formally declare the "targets" of -* Processing Instructions. -* <P> -* Note that the Notation's data is non-DOM information; the DOM only -* records what and where it is. -* <P> -* See the XML 1.0 spec, sections 4.7 and 2.6, for more info. -* <P> -* Level 1 of the DOM does not support editing Notation contents. -* -* @author Rania Y. Khalaf -* @author Joseph Kesselman -* @since PR-DOM-Level-1-19980818. -*/ - -NotationImpl::NotationImpl(DocumentImpl *ownerDoc, const DOMString &nName) - : NodeImpl(ownerDoc) -{ - name = nName.clone(); -} - -NotationImpl::NotationImpl(const NotationImpl &other, bool /*deep*/) - : NodeImpl(other) -{ - name = other.name.clone(); -} - - -NotationImpl::~NotationImpl() -{ -} - - -NodeImpl *NotationImpl::cloneNode(bool deep) -{ - return new NotationImpl(*this, deep); -} - - -DOMString NotationImpl::getNodeName() { - return name; -} - - -short NotationImpl::getNodeType() { - return DOM_Node::NOTATION_NODE; -} - - -// Notation nodes do not have a parent -NodeImpl * NotationImpl::getParentNode() -{ - return 0; -} - - -DOMString NotationImpl::getPublicId() -{ - return publicId.clone(); -} - - -DOMString NotationImpl::getSystemId() -{ - return systemId.clone(); -} - - -void NotationImpl::setPublicId(const DOMString &arg) -{ - if(isReadOnly()) - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR,null); - - publicId = arg.clone(); -} - - -void NotationImpl::setSystemId(const DOMString &arg) -{ - if(isReadOnly()) - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR,null); - - systemId = arg.clone(); -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/NotationImpl.hpp b/src/xercesc/dom/deprecated/NotationImpl.hpp deleted file mode 100644 index 74f45637eff926657bc34512317b69a1af47a2ca..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/NotationImpl.hpp +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef NotationImpl_HEADER_GUARD_ -#define NotationImpl_HEADER_GUARD_ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -#include <xercesc/util/XercesDefs.hpp> -#include "NodeImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DocumentImpl; - -class DEPRECATED_DOM_EXPORT NotationImpl: public NodeImpl { -private: - DOMString name; - DOMString publicId; - DOMString systemId; - -public: - NotationImpl(DocumentImpl *, const DOMString &); - NotationImpl(const NotationImpl &other, bool deep=false); - - virtual ~NotationImpl(); - - virtual NodeImpl *cloneNode(bool deep); - virtual DOMString getNodeName(); - virtual short getNodeType(); - virtual NodeImpl * getParentNode(); - - // - // The Public Identifier for this Notation. If no public identifier - // was specified, this will be null. - virtual DOMString getPublicId(); - - // The System Identifier for this Notation. If no system identifier - // was specified, this will be null. - virtual DOMString getSystemId(); - - - // NON-DOM: The Public Identifier for this Notation. If no public - // identifier was specified, this will be null. */ - virtual void setPublicId(const DOMString &arg); - - - // NON-DOM: The System Identifier for this Notation. If no system - // identifier was specified, this will be null. */ - virtual void setSystemId(const DOMString &arg); - -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/ParentNode.cpp b/src/xercesc/dom/deprecated/ParentNode.cpp deleted file mode 100644 index 273d32056da18eea13dd48302353cbdd1dd2d31a..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/ParentNode.cpp +++ /dev/null @@ -1,475 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - * - * <p><b>WARNING</b>: Some of the code here is partially duplicated in - * AttrImpl, be careful to keep these two classes in sync! - */ - - -#include "ParentNode.hpp" -#include "DOM_DOMException.hpp" -#include "TextImpl.hpp" -#include "DocumentImpl.hpp" -#include "RangeImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -ParentNode::ParentNode(DocumentImpl *ownerDoc) - : ChildNode(ownerDoc) -{ - this->ownerDocument = ownerDoc; - this->firstChild = null; - - fCachedLength = -1; - fCachedChild = null; - fCachedChildIndex = -1; -}; - -// This only makes a shallow copy, cloneChildren must also be called for a -// deep clone -ParentNode::ParentNode(const ParentNode &other) - : ChildNode(other) -{ - this->ownerDocument = other.ownerDocument; - - // Need to break the association w/ original kids - this->firstChild = null; - - fCachedLength = -1; - fCachedChild = null; - fCachedChildIndex = -1; -}; - - -void ParentNode::cloneChildren(const NodeImpl &other) { - // for (NodeImpl *mykid = other.getFirstChild(); - for (NodeImpl *mykid = ((NodeImpl&)other).getFirstChild(); - mykid != null; - mykid = mykid->getNextSibling()) { - this->appendChild(mykid->cloneNode(true)); - } -} - -DocumentImpl * ParentNode::getOwnerDocument() { - return ownerDocument; -} - -// unlike getOwnerDocument this is not overriden by DocumentImpl to return null -DocumentImpl * ParentNode::getDocument() { - return ownerDocument; -} - -void ParentNode::setOwnerDocument(DocumentImpl *doc) { - ownerDocument = doc; - for (NodeImpl *child = firstChild; - child != null; child = child->getNextSibling()) { - child->setOwnerDocument(doc); - } -} - - -NodeListImpl *ParentNode::getChildNodes() { - return this; -}; - - -NodeImpl * ParentNode::getFirstChild() { - return firstChild; -}; - - -NodeImpl * ParentNode::getLastChild() -{ - return lastChild(); -}; - -ChildNode * ParentNode::lastChild() -{ - // last child is stored as the previous sibling of first child - return firstChild != null ? firstChild->previousSibling : null; -}; - -void ParentNode::lastChild(ChildNode *node) { - // store lastChild as previous sibling of first child - if (firstChild != null) { - firstChild->previousSibling = node; - } - } - - -unsigned int ParentNode::getLength() { - if (fCachedLength == -1) { // is the cached length invalid ? - ChildNode *node; - // start from the cached node if we have one - if (fCachedChildIndex != -1 && fCachedChild != null) { - fCachedLength = fCachedChildIndex; - node = fCachedChild; - } else { - node = firstChild; - fCachedLength = 0; - } - while (node != null) { - fCachedLength++; - node = node->nextSibling; - } - } - return fCachedLength; -}; - - -bool ParentNode::hasChildNodes() -{ - return firstChild!=null; -}; - - - -NodeImpl *ParentNode::insertBefore(NodeImpl *newChild, NodeImpl *refChild) { - - bool errorChecking = ownerDocument->getErrorChecking(); - - if (newChild->isDocumentFragmentImpl()) { - // SLOW BUT SAFE: We could insert the whole subtree without - // juggling so many next/previous pointers. (Wipe out the - // parent's child-list, patch the parent pointers, set the - // ends of the list.) But we know some subclasses have special- - // case behavior they add to insertBefore(), so we don't risk it. - // This approch also takes fewer bytecodes. - - // NOTE: If one of the children is not a legal child of this - // node, throw HIERARCHY_REQUEST_ERR before _any_ of the children - // have been transferred. (Alternative behaviors would be to - // reparent up to the first failure point or reparent all those - // which are acceptable to the target node, neither of which is - // as robust. PR-DOM-0818 isn't entirely clear on which it - // recommends????? - - // No need to check kids for right-document; if they weren't, - // they wouldn't be kids of that DocFrag. - if (errorChecking) { - for (NodeImpl *kid = newChild->getFirstChild(); // Prescan - kid != null; kid = kid->getNextSibling()) { - - if (!DocumentImpl::isKidOK(this, kid)) { - throw DOM_DOMException( - DOM_DOMException::HIERARCHY_REQUEST_ERR, - null); - } - } - } - - while (newChild->hasChildNodes()) { // Move - insertBefore(newChild->getFirstChild(),refChild); - } - return newChild; - } - - // it's a no-op if refChild is the same as newChild - if (refChild == newChild) { - return newChild; - } - - if (errorChecking) { - if (isReadOnly()) { - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - } - if (newChild->getOwnerDocument() != ownerDocument) { - throw DOM_DOMException(DOM_DOMException::WRONG_DOCUMENT_ERR, null); - } - if (!DocumentImpl::isKidOK(this, newChild)) { - throw DOM_DOMException(DOM_DOMException::HIERARCHY_REQUEST_ERR, - null); - } - // refChild must be a child of this node (or null) - if (refChild != null && refChild->getParentNode() != this) { - throw DOM_DOMException(DOM_DOMException::NOT_FOUND_ERR, null); - } - - // Prevent cycles in the tree - // newChild cannot be ancestor of this Node, - // and actually cannot be this - bool treeSafe = true; - for (NodeImpl *a = this; treeSafe && a != null; a = a->getParentNode()) - { - treeSafe = (newChild != a); - } - if (!treeSafe) { - throw DOM_DOMException(DOM_DOMException::HIERARCHY_REQUEST_ERR, - null); - } - } - - // Convert to internal type, to avoid repeated casting - ChildNode * newInternal = (ChildNode *)newChild; - - NodeImpl *oldparent = newInternal->getParentNode(); - if (oldparent != null) { - oldparent->removeChild(newInternal); - } - - // Convert to internal type, to avoid repeated casting - ChildNode *refInternal = (ChildNode *)refChild; - - // Attach up - newInternal->ownerNode = this; - newInternal->isOwned(true); - - // Attach before and after - // Note: firstChild.previousSibling == lastChild!! - if (firstChild == null) { - // this our first and only child - firstChild = newInternal; - newInternal->isFirstChild(true); - newInternal->previousSibling = newInternal; - } - else { - if (refInternal == null) { - // this is an append - ChildNode *lastChild = firstChild->previousSibling; - lastChild->nextSibling = newInternal; - newInternal->previousSibling = lastChild; - firstChild->previousSibling = newInternal; - } - else { - // this is an insert - if (refChild == firstChild) { - // at the head of the list - firstChild->isFirstChild(false); - newInternal->nextSibling = firstChild; - newInternal->previousSibling = firstChild->previousSibling; - firstChild->previousSibling = newInternal; - firstChild = newInternal; - newInternal->isFirstChild(true); - } - else { - // somewhere in the middle - ChildNode *prev = refInternal->previousSibling; - newInternal->nextSibling = refInternal; - prev->nextSibling = newInternal; - refInternal->previousSibling = newInternal; - newInternal->previousSibling = prev; - } - } - } - - changed(); - - // update cached length if we have any - if (fCachedLength != -1) { - fCachedLength++; - } - if (fCachedChildIndex != -1) { - // if we happen to insert just before the cached node, update - // the cache to the new node to match the cached index - if (fCachedChild == refInternal) { - fCachedChild = newInternal; - } - else { - // otherwise just invalidate the cache - fCachedChildIndex = -1; - } - } - - if (this->getOwnerDocument() != null) { - typedef RefVectorOf<RangeImpl> RangeImpls; - RangeImpls* ranges = this->getOwnerDocument()->getRanges(); - if ( ranges != null) { - unsigned int sz = ranges->size(); - for (unsigned int i =0; i<sz; i++) { - ranges->elementAt(i)->updateRangeForInsertedNode(newInternal); - } - } - } - - return newInternal; -}; - - -NodeImpl *ParentNode::item(unsigned int uindex) { - // short way - int index = uindex; - if (fCachedChildIndex != -1 && fCachedChild != null) { - if (fCachedChildIndex < index) { - while (fCachedChildIndex < index && fCachedChild != null) { - fCachedChildIndex++; - fCachedChild = fCachedChild->nextSibling; - } - } - else if (fCachedChildIndex > index) { - while (fCachedChildIndex > index && fCachedChild != null) { - fCachedChildIndex--; - fCachedChild = (ChildNode *)fCachedChild->getPreviousSibling(); - } - } - return fCachedChild; - } - - // long way - fCachedChild = firstChild; - for (fCachedChildIndex = 0; - fCachedChildIndex < index && fCachedChild != null; - fCachedChildIndex++) { - fCachedChild = fCachedChild->nextSibling; - } - return fCachedChild; -}; - - -NodeImpl *ParentNode::removeChild(NodeImpl *oldChild) -{ - if (ownerDocument->getErrorChecking()) { - if (isReadOnly()) { - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - } - if (oldChild == null || oldChild->getParentNode() != this) { - throw DOM_DOMException(DOM_DOMException::NOT_FOUND_ERR, null); - } - } - //fix other ranges for change before deleting the node - if (getOwnerDocument() != null) { - typedef RefVectorOf<RangeImpl> RangeImpls; - RangeImpls* ranges = this->getOwnerDocument()->getRanges(); - if (ranges != null) { - unsigned int sz = ranges->size(); - if (sz != 0) { - for (unsigned int i =0; i<sz; i++) { - if (ranges->elementAt(i) != null) - ranges->elementAt(i)->updateRangeForDeletedNode(oldChild); - } - } - } - } - - ChildNode * oldInternal = (ChildNode *) oldChild; - - // update cached length if we have any - if (fCachedLength != -1) { - fCachedLength--; - } - if (fCachedChildIndex != -1) { - // if the removed node is the cached node - // move the cache to its (soon former) previous sibling - if (fCachedChild == oldInternal) { - fCachedChildIndex--; - fCachedChild = (ChildNode *)oldInternal->getPreviousSibling(); - } else { - // otherwise just invalidate the cache - fCachedChildIndex = -1; - } - } - - // Patch linked list around oldChild - // Note: lastChild == firstChild->previousSibling - if (oldInternal == firstChild) { - // removing first child - oldInternal->isFirstChild(false); - firstChild = oldInternal->nextSibling; - if (firstChild != null) { - firstChild->isFirstChild(true); - firstChild->previousSibling = oldInternal->previousSibling; - } - } else { - ChildNode *prev = oldInternal->previousSibling; - ChildNode *next = oldInternal->nextSibling; - prev->nextSibling = next; - if (next == null) { - // removing last child - firstChild->previousSibling = prev; - } else { - // removing some other child in the middle - next->previousSibling = prev; - } - } - - // Remove oldInternal's references to tree - oldInternal->ownerNode = ownerDocument; - oldInternal->isOwned(false); - oldInternal->nextSibling = null; - oldInternal->previousSibling = null; - - changed(); - - return oldInternal; -}; - - -NodeImpl *ParentNode::replaceChild(NodeImpl *newChild, NodeImpl *oldChild) -{ - insertBefore(newChild, oldChild); - if (newChild != oldChild) { - removeChild(oldChild); - } - // changed() already done. - return oldChild; -}; - - -void ParentNode::setReadOnly(bool readOnl, bool deep) -{ - NodeImpl::setReadOnly(readOnl, deep); - - if (deep) - // Recursively set kids - for (ChildNode *mykid = firstChild; - mykid != null; - mykid = mykid->nextSibling) - if(! (mykid->isEntityReference())) - mykid->setReadOnly(readOnl,true); -}; - - -//Introduced in DOM Level 2 - -void ParentNode::normalize() -{ - ChildNode *kid, *next; - for (kid = firstChild; kid != null; kid = next) - { - next = kid->nextSibling; - - // If kid and next are both Text nodes (but _not_ CDATASection, - // which is a subclass of Text), they can be merged. - if (next != null && - kid->isTextImpl() && !(kid->isCDATASectionImpl()) && - next->isTextImpl() && !(next->isCDATASectionImpl()) ) - { - ((TextImpl *) kid)->appendData(((TextImpl *) next)->getData()); - removeChild(next); - if (next->nodeRefCount == 0) - deleteIf(next); - next = kid; // Don't advance; there might be another. - } - - // Otherwise it might be an Element, which is handled recursively - else - if (kid->isElementImpl()) - kid->normalize(); - }; - - // changed() will have occurred when the removeChild() was done, - // so does not have to be reissued. -}; - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/ParentNode.hpp b/src/xercesc/dom/deprecated/ParentNode.hpp deleted file mode 100644 index cd5c6a82393a2625a9166621bdc45ea3081e40fe..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/ParentNode.hpp +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef ParentNode_HEADER_GUARD_ -#define ParentNode_HEADER_GUARD_ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -/* - * $Id$ - */ - -/** - * ParentNode inherits from ChildImpl and adds the capability of having child - * nodes. Not every node in the DOM can have children, so only nodes that can - * should inherit from this class and pay the price for it. - * <P> - * ParentNode, just like NodeImpl, also implements NodeList, so it can - * return itself in response to the getChildNodes() query. This eliminiates - * the need for a separate ChildNodeList object. Note that this is an - * IMPLEMENTATION DETAIL; applications should _never_ assume that - * this identity exists. - * <P> - * While we have a direct reference to the first child, the last child is - * stored as the previous sibling of the first child. First child nodes are - * marked as being so, and getNextSibling hides this fact. - * <P>Note: Not all parent nodes actually need to also be a child. At some - * point we used to have ParentNode inheriting from NodeImpl and another class - * called ChildAndParentNode that inherited from ChildNode. But due to the lack - * of multiple inheritance a lot of code had to be duplicated which led to a - * maintenance nightmare. At the same time only a few nodes (Document, - * DocumentFragment, Entity, and Attribute) cannot be a child so the gain is - * memory wasn't really worth it. The only type for which this would be the - * case is Attribute, but we deal with there in another special way, so this is - * not applicable. - * - * <p><b>WARNING</b>: Some of the code here is partially duplicated in - * AttrImpl, be careful to keep these two classes in sync! - * - **/ - -#include <xercesc/util/XercesDefs.hpp> -#include "ChildNode.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - -class DEPRECATED_DOM_EXPORT ParentNode: public ChildNode { -public: - DocumentImpl *ownerDocument; // Document this node belongs to - - ChildNode *firstChild; - -public: - ParentNode(DocumentImpl *ownerDocument); - ParentNode(const ParentNode &other); - - virtual DocumentImpl * getOwnerDocument(); - virtual void setOwnerDocument(DocumentImpl *doc); - - virtual NodeListImpl *getChildNodes(); - virtual NodeImpl * getFirstChild(); - virtual NodeImpl * getLastChild(); - virtual unsigned int getLength(); - virtual bool hasChildNodes(); - virtual NodeImpl *insertBefore(NodeImpl *newChild, NodeImpl *refChild); - virtual NodeImpl *item(unsigned int index); - virtual NodeImpl * removeChild(NodeImpl *oldChild); - virtual NodeImpl *replaceChild(NodeImpl *newChild, NodeImpl *oldChild); - virtual void setReadOnly(bool isReadOnly, bool deep); - - //Introduced in DOM Level 2 - virtual void normalize(); - - // NON-DOM - // unlike getOwnerDocument this never returns null, even for Document nodes - virtual DocumentImpl * getDocument(); -protected: - void cloneChildren(const NodeImpl &other); - ChildNode * lastChild(); - void lastChild(ChildNode *); - - /** Cached node list length. */ - int fCachedLength; - - /** Last requested child. */ - ChildNode * fCachedChild; - - /** Last requested child index. */ - int fCachedChildIndex; -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/ProcessingInstructionImpl.cpp b/src/xercesc/dom/deprecated/ProcessingInstructionImpl.cpp deleted file mode 100644 index a63b5236e24ccec67386e32b7455c4839dc8243d..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/ProcessingInstructionImpl.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "ProcessingInstructionImpl.hpp" -#include "DocumentImpl.hpp" -#include "NodeImpl.hpp" -#include "DOM_DOMException.hpp" -#include "DOM_Node.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -ProcessingInstructionImpl::ProcessingInstructionImpl(DocumentImpl *ownerDoc, - const DOMString &targt, - const DOMString &dat) - : ChildNode(ownerDoc) -{ - this->target = targt.clone(); - this->data = dat.clone(); -}; - - -ProcessingInstructionImpl::ProcessingInstructionImpl( - const ProcessingInstructionImpl &other, - bool /*deep*/) - : ChildNode(other) -{ - target = other.target.clone(); - data = other.data.clone(); -}; - - -ProcessingInstructionImpl::~ProcessingInstructionImpl() -{ -}; - - -NodeImpl *ProcessingInstructionImpl::cloneNode(bool deep) -{ - return new ProcessingInstructionImpl(*this, deep); -}; - - -DOMString ProcessingInstructionImpl::getNodeName() -{ - return target; -}; - - -short ProcessingInstructionImpl::getNodeType() { - return DOM_Node::PROCESSING_INSTRUCTION_NODE; -}; - - -DOMString ProcessingInstructionImpl::getNodeValue() -{ - return data.clone(); -}; - - -void ProcessingInstructionImpl::setNodeValue(const DOMString &value) -{ - if (isReadOnly()) - throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - data = value.clone(); -}; - - -DOMString ProcessingInstructionImpl::getData() -{ - return data.clone(); -}; - - -/** A PI's "target" states what processor channel the PI's data -should be directed to. It is defined differently in HTML and XML. - - In XML, a PI's "target" is the first (whitespace-delimited) token - following the "<?" token that begins the PI. - - In HTML, target is always null. - - Note that getNodeName is aliased to getTarget. -*/ -DOMString ProcessingInstructionImpl::getTarget() -{ - return target.clone(); -}; - - -/** -* Change the data content of this PI. -* Note that setNodeValue is aliased to setData -* @see getData(). -* @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if node is read-only. -*/ -void ProcessingInstructionImpl::setData(const DOMString &arg) -{ - if (isReadOnly()) - throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, - null); - data = arg.clone(); -}; - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/ProcessingInstructionImpl.hpp b/src/xercesc/dom/deprecated/ProcessingInstructionImpl.hpp deleted file mode 100644 index 4b3ef8cc903316b18e3a574c5287281362231a01..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/ProcessingInstructionImpl.hpp +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef ProcessingInstructionImpl_HEADER_GUARD_ -#define ProcessingInstructionImpl_HEADER_GUARD_ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - -#include <xercesc/util/XercesDefs.hpp> -#include "ChildNode.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DocumentImpl; - - -class DEPRECATED_DOM_EXPORT ProcessingInstructionImpl: public ChildNode { -protected: - DOMString target; - DOMString data; - -public: - ProcessingInstructionImpl(DocumentImpl *ownerDoc, - const DOMString & target, - const DOMString &data); - ProcessingInstructionImpl(const ProcessingInstructionImpl &other, - bool deep=false); - virtual ~ProcessingInstructionImpl(); - virtual NodeImpl *cloneNode(bool deep); - virtual DOMString getNodeValue(); - virtual void setNodeValue(const DOMString &value); - virtual DOMString getNodeName(); - virtual short getNodeType(); - virtual DOMString getData(); - virtual DOMString getTarget(); - virtual void setData(const DOMString &arg); -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/RangeImpl.cpp b/src/xercesc/dom/deprecated/RangeImpl.cpp deleted file mode 100644 index 6390e545379a0f8e10d428468e8914b8580b0b83..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/RangeImpl.cpp +++ /dev/null @@ -1,1658 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include <xercesc/util/RefVectorOf.hpp> -#include "NodeImpl.hpp" -#include "RangeImpl.hpp" -#include "TextImpl.hpp" -#include "DocumentImpl.hpp" -#include "DOM_DOMException.hpp" -#include "DOM_Document.hpp" -#include "DocumentFragmentImpl.hpp" -#include "DOM_Document.hpp" -#include "DOM_RangeException.hpp" -#include "DOM_DOMException.hpp" -#include "DOM_Text.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -//--------------------- -// C'tor and D'tor -//--------------------- - -RangeImpl::RangeImpl(DOM_Document doc) - - : fStartContainer(doc), - fStartOffset(0), - fEndContainer(doc), - fEndOffset(0), - fCollapsed(true), - fDocument(doc), - fDetached(false), - fRemoveChild(0) -{ -} - -RangeImpl::RangeImpl(const RangeImpl& other) : RefCountedImpl() -{ - fDocument = other.fDocument; - fStartContainer = other.fStartContainer; - fStartOffset = other.fStartOffset; - fEndContainer = other.fEndContainer; - fEndOffset = other.fEndOffset; - fDetached = other.fDetached; - fCollapsed = other.fCollapsed; - fRemoveChild = other.fRemoveChild; -} - -RangeImpl::~RangeImpl() -{ -} - -void RangeImpl::unreferenced() -{ - if (((DocumentImpl*)fDocument.fImpl)->ranges != 0L) { - int sz = ((DocumentImpl*)fDocument.fImpl)->ranges->size(); - for (int i=0; i< sz; i++) { - if (((DocumentImpl*)fDocument.fImpl)->ranges->elementAt(i) == this) { - ((DocumentImpl*)fDocument.fImpl)->ranges->removeElementAt(i); - break; - } - } - } -// delete this; - RangeImpl* ptr = this; - delete ptr; -}; - - -//------------------------------- -// Public getter functions -//------------------------------- - - -DOM_Node RangeImpl::getStartContainer() const -{ - return fStartContainer; -} - -unsigned int RangeImpl::getStartOffset() const -{ - return fStartOffset; -} - -DOM_Node RangeImpl::getEndContainer() const -{ - return fEndContainer; -} - -unsigned int RangeImpl::getEndOffset() const -{ - return fEndOffset; -} - - - -bool RangeImpl::getCollapsed() const -{ - if (fDetached) - { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - - return ((fStartContainer == fEndContainer) - && (fStartOffset == fEndOffset)); -} - -//------------------------------- -// Public getter functions -//------------------------------- - -void RangeImpl::setStartContainer(const DOM_Node& node) -{ - if (fDetached) - { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - - fStartContainer = node; -} - -void RangeImpl::setStartOffset(unsigned int offset) -{ - if (fDetached) - { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - - fStartOffset = offset; -} - -void RangeImpl::setEndContainer(const DOM_Node& node) -{ - if (fDetached) - { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - - fEndContainer = node; - -} - -void RangeImpl::setEndOffset(unsigned int offset) -{ - if (fDetached) - { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - - fEndOffset = offset; -} - -void RangeImpl::setStart(const DOM_Node& refNode, unsigned int offset) -{ - validateNode(refNode); - checkIndex(refNode, offset); - - fStartContainer = refNode; - fStartOffset = offset; - - if ((fDocument != refNode.getOwnerDocument() ) - && (refNode.getOwnerDocument().fImpl != 0) ) - { - fDocument = refNode.getOwnerDocument(); - collapse(true); - } - - //compare the start and end boundary point - //collapse if start point is after the end point - if(compareBoundaryPoints(DOM_Range::END_TO_START, this) == 1) - collapse(true); //collapse the range positions to start - else - fCollapsed = false; -} - -void RangeImpl::setEnd(const DOM_Node& refNode, unsigned int offset) -{ - validateNode(refNode); - checkIndex(refNode, offset); - - fEndContainer = refNode; - fEndOffset = offset; - - if ((fDocument != refNode.getOwnerDocument() ) - && (refNode.getOwnerDocument().fImpl != 0) ) - { - fDocument = refNode.getOwnerDocument(); - collapse(false); - } - - //compare the start and end boundary point - //collapse if start point is after the end point - if(compareBoundaryPoints(DOM_Range::END_TO_START, this) == 1) - collapse(false); //collapse the range positions to end - else - fCollapsed = false; -} - -void RangeImpl::setStartBefore(const DOM_Node& refNode) -{ - if( fDetached) { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - if ( !hasLegalRootContainer(refNode) || !isLegalContainedNode(refNode)) { - throw DOM_RangeException( - DOM_RangeException::INVALID_NODE_TYPE_ERR, null); - } - - fStartContainer = refNode.getParentNode(); - unsigned int i = 0; - for (DOM_Node n = refNode; n!=null; n = n.getPreviousSibling()) { - i++; - } - if (i == 0) - fStartOffset = 0; - else - fStartOffset = i-1; - - if ((fDocument != refNode.getOwnerDocument()) - && (refNode.getOwnerDocument().fImpl != 0) ) - { - fDocument = refNode.getOwnerDocument(); - collapse(true); - } - - //compare the start and end boundary point - //collapse if start point is after the end point - if(compareBoundaryPoints(DOM_Range::END_TO_START, this) == 1) - collapse(true); //collapse the range positions to start - else - fCollapsed = false; -} - -void RangeImpl::setStartAfter(const DOM_Node& refNode) -{ - if( fDetached) { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - if ( !hasLegalRootContainer(refNode) || !isLegalContainedNode(refNode)) { - throw DOM_RangeException( - DOM_RangeException::INVALID_NODE_TYPE_ERR, null); - } - - fStartContainer = refNode.getParentNode(); - unsigned int i = 0; - for (DOM_Node n = refNode; n!=null; n = n.getPreviousSibling()) { - i++; - } - - fStartOffset = i; - - if ((fDocument != refNode.getOwnerDocument() ) - && (refNode.getOwnerDocument().fImpl != 0) ) - { - fDocument = refNode.getOwnerDocument(); - collapse(true); - } - - //compare the start and end boundary point - //collapse if start point is after the end point - if(compareBoundaryPoints(DOM_Range::END_TO_START, this) == 1) - collapse(true); //collapse the range positions to start - else - fCollapsed = false; -} - -void RangeImpl::setEndBefore(const DOM_Node& refNode) -{ - if( fDetached) { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - if ( !hasLegalRootContainer(refNode) || !isLegalContainedNode(refNode)) { - throw DOM_RangeException( - DOM_RangeException::INVALID_NODE_TYPE_ERR, null); - } - - fEndContainer = refNode.getParentNode(); - unsigned int i = 0; - for (DOM_Node n = refNode; n!=null; n = n.getPreviousSibling(), i++) ; - - if (i< 1) - fEndOffset = 0; - else - fEndOffset = i-1; - - if ((fDocument != refNode.getOwnerDocument() ) - && (refNode.getOwnerDocument().fImpl != 0) ) - { - fDocument = refNode.getOwnerDocument(); - collapse(true); - } - - //compare the start and end boundary point - //collapse if start point is after the end point - if(compareBoundaryPoints(DOM_Range::END_TO_START, this) == 1) - collapse(false); //collapse the range positions to end - else - fCollapsed = false; -} - -void RangeImpl::setEndAfter(const DOM_Node& refNode) -{ - if( fDetached) { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - if ( !hasLegalRootContainer(refNode) || !isLegalContainedNode(refNode)) { - throw DOM_RangeException( - DOM_RangeException::INVALID_NODE_TYPE_ERR, null); - } - - fEndContainer = refNode.getParentNode(); - unsigned int i = 0; - for (DOM_Node n = refNode; n!=null; n = n.getPreviousSibling(), i++) ; - - if (i ==0) - fEndOffset = 0; - else - fEndOffset = i; - - if ((fDocument != refNode.getOwnerDocument() ) - && (refNode.getOwnerDocument().fImpl != 0) ) - { - fDocument = refNode.getOwnerDocument(); - collapse(true); - } - - //compare the start and end boundary point - //collapse if start point is after the end point - if(compareBoundaryPoints(DOM_Range::END_TO_START, this) == 1) - collapse(false); //collapse the range positions to end - else - fCollapsed = false; -} -//------------------------------- -// Public Misc. functions -//------------------------------- -void RangeImpl::detach() -{ - if( fDetached) { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - - fDetached = true; - - //nullify nodes - fStartContainer = 0; - fStartOffset = 0; - fEndContainer = 0; - fEndOffset = 0; - fCollapsed = true; - - fRemoveChild = 0; -} - -void RangeImpl::collapse(bool toStart) -{ - if( fDetached) { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - - if (toStart) { - fEndContainer = fStartContainer; - fEndOffset = fStartOffset; - } else { - fStartContainer = fEndContainer; - fStartOffset = fEndOffset; - } - fCollapsed = true; -} - -void RangeImpl::selectNode(const DOM_Node& refNode) -{ - validateNode(refNode); - if ( !isLegalContainedNode(refNode)) { - throw DOM_RangeException( - DOM_RangeException::INVALID_NODE_TYPE_ERR, null); - } - //First check for the text type node - if (refNode.getNodeType() == DOM_Node::TEXT_NODE) - { - //The node itself is the container. - fStartContainer = refNode; - fEndContainer = refNode; - - //Select all the contents of the node - fStartOffset = 0; - fEndOffset = ((DOM_Text &)refNode).getLength(); - return; - } - - DOM_Node parent = refNode.getParentNode(); - if (parent != null ) // REVIST: what to do if it IS null? - { - fStartContainer = parent; - fEndContainer = parent; - - unsigned int i = 0; - for (DOM_Node n = parent.getFirstChild(); n!=null, n!=refNode; n = n.getNextSibling()) { - i++; - } - - fStartOffset = i; - fEndOffset = fStartOffset+1; - } -} - -void RangeImpl::selectNodeContents(const DOM_Node& node) -{ - validateNode(node); - - fStartContainer = node; - fEndContainer = node; - - fStartOffset = 0; - if (node.getNodeType() == DOM_Node::TEXT_NODE ) { - fEndOffset = ((DOM_Text &)node).getLength(); - return; - } - - DOM_Node first = node.getFirstChild(); - if (first == null) { - fEndOffset = 0; - return; - } - unsigned int i = 0; - for (DOM_Node n = first; n!=null; n = n.getNextSibling()) { - i++; - } - fEndOffset = i; -} - -void RangeImpl::surroundContents(DOM_Node& newParent) -{ - if (newParent==null) return; - - //check for elimination criteria - if( fDetached) { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - - if (newParent.getOwnerDocument() !=fDocument) { - throw DOM_DOMException( - DOM_DOMException::WRONG_DOCUMENT_ERR, null); - } - - int type = newParent.getNodeType(); - if ( !isLegalContainedNode(newParent) - || type == DOM_Node::DOCUMENT_TYPE_NODE) - { - throw DOM_RangeException( - DOM_RangeException::INVALID_NODE_TYPE_ERR, null); - } - - DOM_Node root = getCommonAncestorContainer(); - - DOM_Node realStart = fStartContainer; - DOM_Node realEnd = fEndContainer; - - if (fStartContainer.getNodeType() == DOM_Node::TEXT_NODE) { - realStart = fStartContainer.getParentNode(); - } - if (fEndContainer.getNodeType() == DOM_Node::TEXT_NODE) { - realEnd = fEndContainer.getParentNode(); - } - - if (realStart != realEnd) { - throw DOM_RangeException( - DOM_RangeException::BAD_BOUNDARYPOINTS_ERR, null); - } - - DOM_DocumentFragment frag = extractContents(); - insertNode(newParent); - newParent.appendChild(frag); - selectNode(newParent); -} - - -short RangeImpl::compareBoundaryPoints(DOM_Range::CompareHow how, RangeImpl* srcRange) const -{ - if (fDocument != srcRange->fDocument) { - throw DOM_DOMException( - DOM_DOMException::WRONG_DOCUMENT_ERR, null); - } - if( fDetached) { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - - DOM_Node pointA, pointB; - int offsetA, offsetB; - - switch (how) - { - case (DOM_Range::START_TO_START) : - pointB = srcRange->getStartContainer(); - pointA = fStartContainer; - offsetB = srcRange->getStartOffset(); - offsetA = fStartOffset; - break; - case (DOM_Range::START_TO_END) : - pointB = srcRange->getStartContainer(); - pointA = fEndContainer; - offsetB = srcRange->getStartOffset(); - offsetA = fEndOffset; - break; - case (DOM_Range::END_TO_START) : - pointB = srcRange->getEndContainer(); - pointA = fStartContainer; - offsetB = srcRange->getEndOffset(); - offsetA = fStartOffset; - break; - case (DOM_Range::END_TO_END) : - pointB = srcRange->getEndContainer(); - pointA = fEndContainer; - offsetB = srcRange->getEndOffset(); - offsetA = fEndOffset; - break; - default: - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - - // case 1: same container - if (pointA == pointB) { - if (offsetA < offsetB) return -1; //A before B - if (offsetA == offsetB) return 0; //A equal to B - return 1; // A after B - } - // case 2: Child C of container A is ancestor of B - for (DOM_Node node = pointA.getFirstChild(); node != null; node=node.getNextSibling()) { - if (isAncestorOf(node, pointB)) { - int index = indexOf(node, pointA); - if (offsetA <= index) return -1; - return 1; - } - } - // case 3: Child C of container B is ancestor of A - for (DOM_Node nd = pointB.getFirstChild(); nd != null; nd=nd.getNextSibling()) { - if (isAncestorOf(nd, pointA)) { - int index = indexOf(nd, pointB); - if (index < offsetB ) return -1; - return 1; //B strictly before A - } - } - - // case 4: preorder traversal of context tree. - DOM_Node ancestor = commonAncestorOf(pointA, pointB); - DOM_Node current = ancestor; - - do { - if (current == pointA) return -1; - if (current == pointB) return 1; - current = nextNode(current, true); - } - while (current!=null && current!=ancestor); - - return -2; // this should never happen -} - - -void RangeImpl:: deleteContents() -{ - traverseContents(DELETE_CONTENTS); -} - -DOM_DocumentFragment RangeImpl::extractContents() -{ - checkReadOnly(fStartContainer, fEndContainer, fStartOffset, fEndOffset); - return traverseContents(EXTRACT_CONTENTS); -} - -DOM_DocumentFragment RangeImpl::cloneContents() const -{ - // cast off const. - return ((RangeImpl *)this)->traverseContents(CLONE_CONTENTS); -} - - -void RangeImpl::insertNode(DOM_Node& newNode) -{ - if (newNode == null) return; //don't have to do anything - - for (DOM_Node aNode = fStartContainer; aNode!=null; aNode = aNode.getParentNode()) { - if (aNode.fImpl->isReadOnly()) { - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - } - } - - if (fDocument != newNode.getOwnerDocument()) { - throw DOM_DOMException( - DOM_DOMException::WRONG_DOCUMENT_ERR, null); - } - - // Prevent cycles in the tree. - //isKidOK() is not checked here as its taken care by insertBefore() function - if (isAncestorOf( newNode, fStartContainer)) { - throw DOM_DOMException( - DOM_DOMException::HIERARCHY_REQUEST_ERR, null); - } - - if( fDetached) { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - - int type = newNode.getNodeType(); - if (type == DOM_Node::ATTRIBUTE_NODE - || type == DOM_Node::ENTITY_NODE - || type == DOM_Node::NOTATION_NODE - || type == DOM_Node::DOCUMENT_NODE) - { - throw DOM_RangeException( - DOM_RangeException::INVALID_NODE_TYPE_ERR, null); - } - - - DOM_Node parent; - DOM_Node next; - - if (fStartContainer.getNodeType() == DOM_Node::TEXT_NODE) { - - //set 'parent' and 'next' here - parent = fStartContainer.getParentNode(); - - //split the text nodes - if (fStartOffset > 0) - ((DOM_Text &)fStartContainer).splitText(fStartOffset); - - //update the new start information later. After inserting the first newNode - if (fStartOffset == 0) - next = fStartContainer; - else - next = fStartContainer.getNextSibling(); - - } // end of text handling - else { - parent = fStartContainer; - - next = fStartContainer.getFirstChild(); - for(unsigned int i = 0; (i < fStartOffset) && (next != null); i++) { - next=next.getNextSibling(); - } - } - - if (parent != null) { - if (next != null) - parent.insertBefore(newNode, next); - else - parent.appendChild(newNode); - } -} - -RangeImpl* RangeImpl::cloneRange() const -{ - if( fDetached) { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - - RangeImpl* range = ((DocumentImpl*)fDocument.fImpl)->createRange(); - range->setStart(fStartContainer, fStartOffset); - range->setEnd(fEndContainer, fEndOffset); - - return range; -} - -DOMString RangeImpl::toString() const -{ - if( fDetached) { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - - DOM_Node node = fStartContainer; - DOM_Node stopNode = fEndContainer; - - DOMString tempString; - if ( (fStartContainer.getNodeType() == DOM_Node::TEXT_NODE) - || (fStartContainer.getNodeType() == DOM_Node::CDATA_SECTION_NODE) ) { - if (fStartContainer == fEndContainer) { - tempString.appendData(fStartContainer.getNodeValue().substringData(fStartOffset, fEndOffset-fStartOffset)); - return tempString; - } else { - int length = fStartContainer.getNodeValue().length(); - tempString.appendData(fStartContainer.getNodeValue().substringData(fStartOffset, length - fStartOffset)); - node = nextNode(node, true); - } - }else { //fStartContainer is not a TextNode - node=node.getFirstChild(); - if (fStartOffset>0) { //find a first node within a range, specified by fStartOffset - unsigned int counter = 0; - while (counter<fStartOffset && node!=null) { - node=node.getNextSibling(); - counter++; - } - } - if (node == null) { - node = nextNode(fStartContainer,false); - } - } - - if ( fEndContainer.getNodeType()!= DOM_Node::TEXT_NODE && - fEndContainer.getNodeType()!= DOM_Node::CDATA_SECTION_NODE ){ - int i=fEndOffset; - stopNode = fEndContainer.getFirstChild(); - while( i>0 && stopNode!=null ){ - --i; - stopNode = stopNode.getNextSibling(); - } - if ( stopNode == null ) - stopNode = nextNode( fEndContainer, false ); - } - - while (node != stopNode) { //look into all kids of the Range - if (node == null) break; - if (node.getNodeType() == DOM_Node::TEXT_NODE - || node.getNodeType() == DOM_Node::CDATA_SECTION_NODE) { - tempString.appendData(node.getNodeValue()); - } - node = nextNode(node, true); - } - - if (fEndContainer.getNodeType() == DOM_Node::TEXT_NODE - || fEndContainer.getNodeType() == DOM_Node::CDATA_SECTION_NODE) { - tempString.appendData(fEndContainer.getNodeValue().substringData(0,fEndOffset)); - } - return tempString; -} - -DOM_Document RangeImpl::getDocument() -{ - return fDocument; -} - -const DOM_Node RangeImpl::getCommonAncestorContainer() const -{ - return commonAncestorOf(fStartContainer, fEndContainer); - -} - -//--------------------- -//private functions -//--------------------- - -bool RangeImpl::isValidAncestorType(const DOM_Node& node) const -{ - for (DOM_Node aNode = node; aNode!=null; aNode = aNode.getParentNode()) { - short type = aNode.getNodeType(); - if ( type == DOM_Node::ENTITY_NODE - || type == DOM_Node::NOTATION_NODE - || type == DOM_Node::DOCUMENT_TYPE_NODE) - return false; - } - return true; -} - -bool RangeImpl::isAncestorOf(const DOM_Node& a, const DOM_Node& b) { - for (DOM_Node node=b; node != null; node=node.getParentNode()) { - if (node == a) return true; - } - return false; -} - -bool RangeImpl::hasLegalRootContainer(const DOM_Node& node) const { - if ( node==null ) - return false; - - DOM_Node rootContainer = node; - for (; rootContainer.getParentNode()!=null; rootContainer = rootContainer.getParentNode()) - ; - - switch( rootContainer.getNodeType() ) { - case DOM_Node::ATTRIBUTE_NODE: - case DOM_Node::DOCUMENT_NODE: - case DOM_Node::DOCUMENT_FRAGMENT_NODE: - return true; - } - return false; -} - -bool RangeImpl::isLegalContainedNode(const DOM_Node& node ) const { - if ( node==null ) - return false; - switch( node.getNodeType() ) - { - case DOM_Node::DOCUMENT_NODE: - case DOM_Node::DOCUMENT_FRAGMENT_NODE: - case DOM_Node::ATTRIBUTE_NODE: - case DOM_Node::ENTITY_NODE: - case DOM_Node::NOTATION_NODE: - return false; - } - return true; -} - -unsigned short RangeImpl::indexOf(const DOM_Node& child, const DOM_Node& parent) const -{ - unsigned short i = 0; - if (child.getParentNode() != parent) return (unsigned short)-1; - for(DOM_Node node = child.getPreviousSibling(); node!= null; node=node.getPreviousSibling()) { - i++; - } - return i; -} - -void RangeImpl::validateNode(const DOM_Node& node) const -{ - if( fDetached) { - throw DOM_DOMException( - DOM_DOMException::INVALID_STATE_ERR, null); - } - - if ( !isValidAncestorType(node)) { - throw DOM_RangeException( - DOM_RangeException::INVALID_NODE_TYPE_ERR, null); - } -} - - -const DOM_Node RangeImpl::commonAncestorOf(const DOM_Node& pointA, const DOM_Node& pointB) const -{ - if (fDetached) - throw DOM_DOMException(DOM_DOMException::INVALID_STATE_ERR, null); - - if (pointA.getOwnerDocument() != pointB.getOwnerDocument()) - throw DOM_DOMException( DOM_DOMException::WRONG_DOCUMENT_ERR, null ); - - //if the containers are same then it itself is its common ancestor. - if (pointA == pointB) - return pointA; - - typedef RefVectorOf<NodeImpl> VectorNodes; - VectorNodes* startV= new (((DocumentImpl*)fDocument.fImpl)->getMemoryManager()) VectorNodes(1, false, ((DocumentImpl*)fDocument.fImpl)->getMemoryManager()); - DOM_Node node; - - for (node=fStartContainer; node != null; node=node.getParentNode()) - { - startV->addElement(node.fImpl); - } - VectorNodes* endV = new (((DocumentImpl*)fDocument.fImpl)->getMemoryManager()) VectorNodes(1, false, ((DocumentImpl*)fDocument.fImpl)->getMemoryManager()); - for (node=fEndContainer; node != null; node=node.getParentNode()) - { - endV->addElement(node.fImpl); - } - - int s = startV->size()-1; - int e = endV->size()-1; - - NodeImpl* commonAncestor = 0; - - while (s>=0 && e>=0) { - if (startV->elementAt(s) == endV->elementAt(e)) { - commonAncestor = startV->elementAt(s); - } - else break; - --s; - --e; - } - - delete startV; - delete endV; - - return DOM_Node(commonAncestor); -} - -void RangeImpl::checkIndex(const DOM_Node& node, unsigned int offset) const -{ - short type = node.getNodeType(); - - if((type == DOM_Node::TEXT_NODE - || type == DOM_Node::CDATA_SECTION_NODE - || type == DOM_Node::COMMENT_NODE - || type == DOM_Node::PROCESSING_INSTRUCTION_NODE)) { - if (offset > node.getNodeValue().length()) - throw DOM_DOMException( DOM_DOMException::INDEX_SIZE_ERR, null ); - else return; - } - - DOM_Node child = node.getFirstChild(); - unsigned int i = 0; - for (; child != null; i++) { - child = child.getNextSibling(); - } - if (i < offset) { - throw DOM_DOMException( DOM_DOMException::INDEX_SIZE_ERR, null ); - } - -} - -DOM_Node RangeImpl::nextNode(const DOM_Node& node, bool visitChildren) const -{ - - if (node == null) return null; - - DOM_Node result; - if (visitChildren) { - result = node.getFirstChild(); - if (result != null) { - return result; - } - } - - // if hasSibling, return sibling - result = node.getNextSibling(); - if (result != null) { - return result; - } - - - // return parent's 1st sibling. - DOM_Node parent = node.getParentNode(); - - - while ( (parent != null) && (parent != fDocument) ) - { - result = parent.getNextSibling(); - if (result != null) { - return result; - } else { - parent = parent.getParentNode(); - if (parent == fEndContainer) return parent; - - } - - } - // end of list, return null - return null; -} - - -/** This is the master routine invoked to visit the nodes -* selected by this range. For each such node, different -* actions are taken depending on the value of the TraversalType argument. -*/ -DOM_DocumentFragment RangeImpl::traverseContents(TraversalType how) -{ - if (fDetached) - throw DOM_DOMException(DOM_DOMException::INVALID_STATE_ERR, null); - - if (fStartContainer == null || fEndContainer == null) { - return DOM_DocumentFragment(); // REVIST: Throw exception? - } - - /* Traversal is accomplished by first determining the - relationship between the endpoints of the range. - For each of four significant relationships, we will - delegate the traversal call to a method that - can make appropriate assumptions. - */ - - // case 1: same container - if ( fStartContainer == fEndContainer ) - return traverseSameContainer( how ); - - // case 2: Child C of start container is ancestor of end container - for (DOM_Node node = fStartContainer.getFirstChild(); node != null; node=node.getNextSibling()) { - if (isAncestorOf(node, fEndContainer)) - return traverseCommonStartContainer( node, how ); - } - - // case 3: Child C of end container is ancestor of start container - for (DOM_Node nd = fEndContainer.getFirstChild(); nd != null; nd=nd.getNextSibling()) { - if (isAncestorOf(nd, fStartContainer)) - return traverseCommonEndContainer( nd, how ); - } - - // case 4: preorder traversal of context tree. - // There is a common ancestor container. Find the - // ancestor siblings that are children of that container. - DOM_Node ancestor = commonAncestorOf(fStartContainer, fEndContainer); - return traverseCommonAncestors( ancestor, ancestor, how ); - } - -/** - * Visits the nodes selected by this range when we know - * a-priori that the start and end containers are the same. - * - */ -DOM_DocumentFragment RangeImpl::traverseSameContainer( int how ) -{ - DOM_DocumentFragment frag = null; - if ( how!=DELETE_CONTENTS) - frag = fDocument.createDocumentFragment(); - - // If selection is empty, just return the fragment - if ( fStartOffset==fEndOffset ) - return frag; - - DOM_Node current = fStartContainer; - DOM_Node cloneCurrent = null; - - // Text node needs special case handling - if ( fStartContainer.getNodeType()== DOM_Node::TEXT_NODE ) - { - cloneCurrent = fStartContainer.cloneNode(false); - cloneCurrent.setNodeValue( - cloneCurrent.getNodeValue().substringData(fStartOffset, fEndOffset - fStartOffset)); - - // set the original text node to its new value - if ( how != CLONE_CONTENTS ) - ((DOM_Text &)fStartContainer).deleteData(fStartOffset, fEndOffset-fStartOffset); - if ( how != DELETE_CONTENTS) - frag.appendChild(cloneCurrent); - } - else { - // Copy nodes between the start/end offsets. - DOM_Node n = getSelectedNode( fStartContainer, fStartOffset ); - int cnt = fEndOffset - fStartOffset; - while( cnt > 0 ) - { - DOM_Node sibling = n.getNextSibling(); - DOM_Node xferNode = traverseFullySelected( n, how ); - if ( frag!=null ) - frag.appendChild( xferNode ); - --cnt; - n = sibling; - } - } - - // Nothing is partially selected, so collapse to start point - if ( how != CLONE_CONTENTS ) - collapse(true); - return frag; -} - -/** - * Visits the nodes selected by this range when we know - * a-priori that the start and end containers are not the - * same, but the start container is an ancestor of the end container - * - */ -DOM_DocumentFragment RangeImpl::traverseCommonStartContainer( DOM_Node endAncestor, int how ) -{ - DOM_DocumentFragment frag = null; - if ( how!=DELETE_CONTENTS) - frag = fDocument.createDocumentFragment(); - DOM_Node n = traverseRightBoundary( endAncestor, how ); - if ( frag!=null ) - frag.appendChild( n ); - - int endIdx = indexOf( endAncestor, fStartContainer ); - int cnt = endIdx - fStartOffset; - if ( cnt <=0 ) - { - // Collapse to just before the endAncestor, which - // is partially selected. - if ( how != CLONE_CONTENTS ) - { - setEndBefore( endAncestor ); - collapse( false ); - } - return frag; - } - - n = endAncestor.getPreviousSibling(); - while( cnt > 0 ) - { - DOM_Node sibling = n.getPreviousSibling(); - DOM_Node xferNode = traverseFullySelected( n, how ); - if ( frag!=null ) - frag.insertBefore( xferNode, frag.getFirstChild() ); - --cnt; - n = sibling; - } - // Collapse to just before the endAncestor, which - // is partially selected. - if ( how != CLONE_CONTENTS ) - { - setEndBefore( endAncestor ); - collapse( false ); - } - return frag; -} - -/** - * Visits the nodes selected by this range when we know - * a-priori that the start and end containers are not the - * same, but the end container is an ancestor of the start container - * - */ -DOM_DocumentFragment RangeImpl::traverseCommonEndContainer( DOM_Node startAncestor, int how ) -{ - DOM_DocumentFragment frag = null; - if ( how!=DELETE_CONTENTS) - frag = fDocument.createDocumentFragment(); - DOM_Node n = traverseLeftBoundary( startAncestor, how ); - if ( frag!=null ) - frag.appendChild( n ); - int startIdx = indexOf( startAncestor, fEndContainer ); - ++startIdx; // Because we already traversed it.... - - int cnt = fEndOffset - startIdx; - n = startAncestor.getNextSibling(); - while( cnt > 0 ) - { - DOM_Node sibling = n.getNextSibling(); - DOM_Node xferNode = traverseFullySelected( n, how ); - if ( frag!=null ) - frag.appendChild( xferNode ); - --cnt; - n = sibling; - } - - if ( how != CLONE_CONTENTS ) - { - setStartAfter( startAncestor ); - collapse( true ); - } - - return frag; -} - -/** - * Visits the nodes selected by this range when we know - * a-priori that the start and end containers are not - * the same, and we also know that neither the start - * nor end container is an ancestor of the other. - */ -DOM_DocumentFragment RangeImpl::traverseCommonAncestors( DOM_Node startAncestor, DOM_Node endAncestor, int how ) -{ - DOM_DocumentFragment frag = null; - if ( how!=DELETE_CONTENTS) - frag = fDocument.createDocumentFragment(); - - DOM_Node n = traverseLeftBoundary( startAncestor, how ); - if ( frag!=null ) - frag.appendChild( n ); - - DOM_Node commonParent = startAncestor.getParentNode(); - int startOffset = indexOf( startAncestor, commonParent ); - int endOffset = indexOf( endAncestor, commonParent ); - ++startOffset; - - int cnt = endOffset - startOffset; - DOM_Node sibling = startAncestor.getNextSibling(); - - while( cnt > 0 ) - { - DOM_Node nextSibling = sibling.getNextSibling(); - n = traverseFullySelected( sibling, how ); - if ( frag!=null ) - frag.appendChild( n ); - sibling = nextSibling; - --cnt; - } - - n = traverseRightBoundary( endAncestor, how ); - if ( frag!=null ) - frag.appendChild( n ); - - if ( how != CLONE_CONTENTS ) - { - setStartAfter( startAncestor ); - collapse( true ); - } - return frag; -} - -/** - * Traverses the "right boundary" of this range and - * operates on each "boundary node" according to the - * how parameter. It is a-priori assumed - * by this method that the right boundary does - * not contain the range's start container. - * - * A "right boundary" is best visualized by thinking - * of a sample tree: - * A - * /|\ - * / | \ - * / | \ - * B C D - * /|\ /|\ - * E F G H I J - * - * Imagine first a range that begins between the - * "E" and "F" nodes and ends between the - * "I" and "J" nodes. The start container is - * "B" and the end container is "D". Given this setup, - * the following applies: - * - * Partially Selected Nodes: B, D<br> - * Fully Selected Nodes: F, G, C, H, I - * - * The "right boundary" is the highest subtree node - * that contains the ending container. The root of - * this subtree is always partially selected. - * - * In this example, the nodes that are traversed - * as "right boundary" nodes are: H, I, and D. - * - */ -DOM_Node RangeImpl::traverseRightBoundary( DOM_Node root, int how ) -{ - DOM_Node next = getSelectedNode( fEndContainer, fEndOffset-1 ); - bool isFullySelected = ( next!=fEndContainer ); - - if ( next==root ) - return traverseNode( next, isFullySelected, false, how ); - - DOM_Node parent = next.getParentNode(); - DOM_Node clonedParent = traverseNode( parent, false, false, how ); - - while( parent!=null ) - { - while( next!=null ) - { - DOM_Node prevSibling = next.getPreviousSibling(); - DOM_Node clonedChild = - traverseNode( next, isFullySelected, false, how ); - if ( how!=DELETE_CONTENTS ) - { - clonedParent.insertBefore( - clonedChild, - clonedParent.getFirstChild() - ); - } - isFullySelected = true; - next = prevSibling; - } - if ( parent==root ) - return clonedParent; - - next = parent.getPreviousSibling(); - parent = parent.getParentNode(); - DOM_Node clonedGrandParent = traverseNode( parent, false, false, how ); - if ( how!=DELETE_CONTENTS ) - clonedGrandParent.appendChild( clonedParent ); - clonedParent = clonedGrandParent; - - } - - // should never occur - return null; -} - -/** - * Traverses the "left boundary" of this range and - * operates on each "boundary node" according to the - * how parameter. It is a-priori assumed - * by this method that the left boundary does - * not contain the range's end container. - * - * A "left boundary" is best visualized by thinking - * of a sample tree: - * - * A - * /|\ - * / | \ - * / | \ - * B C D - * /|\ /|\ - * E F G H I J - * - * Imagine first a range that begins between the - * "E" and "F" nodes and ends between the - * "I" and "J" nodes. The start container is - * "B" and the end container is "D". Given this setup, - * the following applies: - * - * Partially Selected Nodes: B, D<br> - * Fully Selected Nodes: F, G, C, H, I - * - * The "left boundary" is the highest subtree node - * that contains the starting container. The root of - * this subtree is always partially selected. - * - * In this example, the nodes that are traversed - * as "left boundary" nodes are: F, G, and B. - * - */ -DOM_Node RangeImpl::traverseLeftBoundary( DOM_Node root, int how ) -{ - DOM_Node next = getSelectedNode( getStartContainer(), getStartOffset() ); - bool isFullySelected = ( next!=getStartContainer() ); - - if ( next==root ) - return traverseNode( next, isFullySelected, true, how ); - - DOM_Node parent = next.getParentNode(); - DOM_Node clonedParent = traverseNode( parent, false, true, how ); - - while( parent!=null ) - { - while( next!=null ) - { - DOM_Node nextSibling = next.getNextSibling(); - DOM_Node clonedChild = - traverseNode( next, isFullySelected, true, how ); - if ( how!=DELETE_CONTENTS ) - clonedParent.appendChild(clonedChild); - isFullySelected = true; - next = nextSibling; - } - if ( parent==root ) - return clonedParent; - - next = parent.getNextSibling(); - parent = parent.getParentNode(); - DOM_Node clonedGrandParent = traverseNode( parent, false, true, how ); - if ( how!=DELETE_CONTENTS ) - clonedGrandParent.appendChild( clonedParent ); - clonedParent = clonedGrandParent; - - } - - // should never occur - return null; - -} - -/** - * Utility method for traversing a single node. - * Does not properly handle a text node containing both the - * start and end offsets. Such nodes should - * have been previously detected and been routed to traverseTextNode. - * - */ -DOM_Node RangeImpl::traverseNode( DOM_Node n, bool isFullySelected, bool isLeft, int how ) -{ - if ( isFullySelected ) - return traverseFullySelected( n, how ); - if ( n.getNodeType()== DOM_Node::TEXT_NODE ) - return traverseTextNode( n, isLeft, how ); - return traversePartiallySelected( n, how ); -} - -/** - * Utility method for traversing a single node when - * we know a-priori that the node if fully - * selected. - * - */ -DOM_Node RangeImpl::traverseFullySelected( DOM_Node n, int how ) -{ - switch( how ) - { - case CLONE_CONTENTS: - return n.cloneNode( true ); - case EXTRACT_CONTENTS: - if ( n.getNodeType()== DOM_Node::DOCUMENT_TYPE_NODE ) - { - throw DOM_DOMException( - DOM_DOMException::HIERARCHY_REQUEST_ERR, null); - } - return n; - case DELETE_CONTENTS: - n.getParentNode().removeChild(n); - return null; - } - return null; -} - -/** - * Utility method for traversing a single node when - * we know a-priori that the node if partially - * selected and is not a text node. - * - */ -DOM_Node RangeImpl::traversePartiallySelected( DOM_Node n, int how ) -{ - switch( how ) - { - case DELETE_CONTENTS: - return null; - case CLONE_CONTENTS: - case EXTRACT_CONTENTS: - return n.cloneNode( false ); - } - return null; -} - -/** - * Utility method for traversing a text node that we know - * a-priori to be on a left or right boundary of the range. - * This method does not properly handle text nodes that contain - * both the start and end points of the range. - * - */ -DOM_Node RangeImpl::traverseTextNode( DOM_Node n, bool isLeft, int how ) -{ - DOMString txtValue = n.getNodeValue(); - DOMString newNodeValue; - DOMString oldNodeValue; - - if ( isLeft ) - { - int offset = getStartOffset(); - newNodeValue = txtValue.substringData( offset , fStartContainer.getNodeValue().length()-offset); - oldNodeValue = txtValue.substringData( 0, offset ); - } - else - { - int offset = getEndOffset(); - newNodeValue = txtValue.substringData( 0, offset ); - oldNodeValue = txtValue.substringData( offset , fEndContainer.getNodeValue().length()-offset ); - } - - if ( how != CLONE_CONTENTS ) - n.setNodeValue( oldNodeValue ); - if ( how==DELETE_CONTENTS ) - return null; - DOM_Node newNode = n.cloneNode( false ); - newNode.setNodeValue( newNodeValue ); - return newNode; -} - -/** - * Utility method to retrieve a child node by index. This method - * assumes the caller is trying to find out which node is - * selected by the given index. Note that if the index is - * greater than the number of children, this implies that the - * first node selected is the parent node itself. - * - */ -DOM_Node RangeImpl::getSelectedNode( DOM_Node container, int offset ) -{ - if ( container.getNodeType() == DOM_Node::TEXT_NODE ) - return container; - - // This case is an important convenience for - // traverseRightBoundary() - if ( offset<0 ) - return container; - - DOM_Node child = container.getFirstChild(); - while( child!=null && offset > 0 ) - { - --offset; - child = child.getNextSibling(); - } - if ( child!=null ) - return child; - return container; -} - -void RangeImpl::checkReadOnly(DOM_Node& start, DOM_Node& end, - unsigned int startOffset, unsigned int endOffset) -{ - if ((start == null) || (end == null) ) return; - //if both start and end are text check and return - if (start.getNodeType() == DOM_Node::TEXT_NODE) { - if (start.fImpl->isReadOnly()) { - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - } - if (start == end) - return; - } - //set the start and end nodes to check - DOM_Node sNode = start.getFirstChild(); - for(unsigned int i = 0; i<startOffset; i++) - sNode = sNode.getNextSibling(); - - DOM_Node eNode; - if (end.getNodeType() == DOM_Node::TEXT_NODE) { - eNode = end; //need to check only till this node - } - else { //need to check all the kids that fall before the end offset value - eNode = end.getFirstChild(); - for (unsigned int i = 0; i<endOffset-1; i++) - eNode = eNode.getNextSibling(); - } - //recursivly search if any node is readonly - recurseTreeAndCheck(sNode, eNode); -} - -void RangeImpl::recurseTreeAndCheck(DOM_Node& start, DOM_Node& end) -{ - for(DOM_Node node=start; node != null && node !=end; node=node.getNextSibling()) - { - if (node.fImpl->isReadOnly()) { - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - } - - if (node.hasChildNodes()) { - node = node.getFirstChild(); - recurseTreeAndCheck(node, end); - } - } -} - - -DOM_Node RangeImpl::removeChild(DOM_Node& parent, DOM_Node& child) -{ - fRemoveChild = child; //only a precaution measure not to update this range data before removal - DOM_Node n = parent.removeChild(child); - fRemoveChild = null; - return n; -} - - -// -// Mutation functions -// - - -/* This function is called from DOM. -* The text has already beeen replaced. -* Fix-up any offsets. -*/ -void RangeImpl::receiveReplacedText(NodeImpl* node) -{ - if (node == null) return; - DOM_Node anode(node); - if (anode == fStartContainer - && fStartContainer.getNodeType() == DOM_Node::TEXT_NODE) { - fStartOffset = 0; - } - if (anode == fEndContainer - && fEndContainer.getNodeType() == DOM_Node::TEXT_NODE) { - fEndOffset = 0; - } -} - - -/** This function is called from DOM. -* The text has already beeen inserted. -* Fix-up any offsets. -*/ -void RangeImpl::updateRangeForDeletedText(DOM_Node& node, unsigned int offset, int count) -{ - if (node == null) return; - - if (node == fStartContainer - && fStartContainer.getNodeType() == DOM_Node::TEXT_NODE) { - if (fStartOffset > offset+count) { - fStartOffset = fStartOffset-count; - } else if (fStartOffset > offset) { - fStartOffset = offset; - } - } - if (node == fEndContainer - && fEndContainer.getNodeType() == DOM_Node::TEXT_NODE) { - if (fEndOffset > offset+count) { - fEndOffset = fEndOffset-count; - } else if (fEndOffset > offset) { - fEndOffset = offset; - } - } -} - - - -/** This function must be called by the DOM _BEFORE_ -* a node is deleted, because at that time it is -* connected in the DOM tree, which we depend on. -*/ -void RangeImpl::updateRangeForDeletedNode(NodeImpl* node) -{ - - if (node == null) return; - if (fRemoveChild == node) return; - - DOM_Node tNode(node); - - if (node->getParentNode() == fStartContainer.fImpl) { - unsigned short index = indexOf(tNode, fStartContainer); - if ( fStartOffset > index) { - fStartOffset--; - } - } - - if (node->getParentNode() == fEndContainer.fImpl) { - unsigned short index = indexOf(tNode, fEndContainer); - if ( fEndOffset > index) { - fEndOffset--; - } - } - - if (node->getParentNode() != fStartContainer.fImpl - || node->getParentNode() != fEndContainer.fImpl) { - if (isAncestorOf(node, fStartContainer)) { - DOM_Node tpNode(node->getParentNode()); - setStartContainer( tpNode ); - fStartOffset = indexOf( tNode, tpNode); - } - if (isAncestorOf(node, fEndContainer)) { - DOM_Node tpNode(node->getParentNode()); - setEndContainer( tpNode ); - fEndOffset = indexOf( tNode, tpNode); - } - } - -} - -void RangeImpl::updateRangeForInsertedNode(NodeImpl* node) { - if (node == null) return; - - if (node->getParentNode() == fStartContainer.fImpl) { - unsigned int index = indexOf(DOM_Node(node), fStartContainer); - if (index < fStartOffset) { - fStartOffset++; - } - } - - if (node->getParentNode() == fEndContainer.fImpl) { - unsigned int index = indexOf(DOM_Node(node), fEndContainer); - if (index < fEndOffset) { - fEndOffset++; - } - } -} - - -void RangeImpl::updateSplitInfo(TextImpl* oldNode, TextImpl* startNode, unsigned int offset) -{ - if (startNode == null) return; - - DOM_Text oldText(oldNode); - DOM_Text newText(startNode); - - if (fStartContainer == oldText && fStartOffset > offset) { - fStartOffset = fStartOffset - offset; - fStartContainer = newText; - } - - if (fEndContainer == oldText && fEndOffset > offset) { - fEndContainer = newText; - fEndOffset = fEndOffset - offset; - } -} - - -XERCES_CPP_NAMESPACE_END - - diff --git a/src/xercesc/dom/deprecated/RangeImpl.hpp b/src/xercesc/dom/deprecated/RangeImpl.hpp deleted file mode 100644 index 5f03ddefc35557d8f85ebf0e8fa1563432770aeb..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/RangeImpl.hpp +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef RangeImpl_HEADER_GUARD_ -#define RangeImpl_HEADER_GUARD_ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - -#include "DOM_Node.hpp" -#include "RefCountedImpl.hpp" -#include "DOM_Range.hpp" -#include "DOM_Text.hpp" -#include "DOM_Document.hpp" -#include <xercesc/util/RefVectorOf.hpp> - -XERCES_CPP_NAMESPACE_BEGIN - - -typedef RefVectorOf<RangeImpl> Ranges; - -class DEPRECATED_DOM_EXPORT RangeImpl : public RefCountedImpl { -public: - //c'tor - RangeImpl(DOM_Document doc); - RangeImpl(const RangeImpl& other); - - //d'tor - ~RangeImpl(); - - //referencing related functions - virtual void unreferenced(); - - - //getter functions - DOM_Node getStartContainer() const; - unsigned int getStartOffset() const; - DOM_Node getEndContainer() const; - unsigned int getEndOffset() const; - - - - void collapse(bool toStart); - bool getCollapsed() const; - - void setStartBefore(const DOM_Node& node); - void setStartAfter(const DOM_Node& node); - void setEndBefore(const DOM_Node& node); - void setEndAfter(const DOM_Node& node); - - void setStart(const DOM_Node& node, unsigned int offset); - void setEnd(const DOM_Node& node, unsigned int offset); - - void selectNode(const DOM_Node& node); - void selectNodeContents(const DOM_Node& node); - - short compareBoundaryPoints(DOM_Range::CompareHow how, RangeImpl* range) const; - - void detach(); - - void deleteContents(); - - RangeImpl* cloneRange() const; - DOMString toString() const; - - DOM_Document getDocument(); - void surroundContents(DOM_Node& node); - DOM_DocumentFragment extractContents(); - DOM_DocumentFragment cloneContents() const; - void insertNode(DOM_Node& newNode); - const DOM_Node getCommonAncestorContainer() const; - - // functions to inform all existing valid ranges about a change - void updateSplitInfo(TextImpl* oldNode, TextImpl* startNode, unsigned int offset); - void updateRangeForInsertedNode(NodeImpl* node); - void receiveReplacedText(NodeImpl* node); - void updateRangeForDeletedText(DOM_Node& node, unsigned int offset, int count); - void updateRangeForDeletedNode(NodeImpl* node); - -private: - enum TraversalType { - EXTRACT_CONTENTS = 1, - CLONE_CONTENTS = 2, - DELETE_CONTENTS = 3 - }; - - enum TraversePoint { - BEFORE = -1, - START = 0, - AFTER = 1 - }; - - //setter functions - void setStartContainer(const DOM_Node& node); - void setStartOffset(unsigned int offset) ; - void setEndContainer(const DOM_Node& node); - void setEndOffset(unsigned int offset) ; - - //misc functions - void validateNode(const DOM_Node& node) const; - bool isValidAncestorType(const DOM_Node& node) const; - bool hasLegalRootContainer(const DOM_Node& node) const; - bool isLegalContainedNode(const DOM_Node& node ) const; - void checkIndex(const DOM_Node& node, unsigned int offset) const; - static bool isAncestorOf(const DOM_Node& a, const DOM_Node& b); - - unsigned short indexOf(const DOM_Node& child, const DOM_Node& parent) const; - - const DOM_Node commonAncestorOf(const DOM_Node& pointA, const DOM_Node& pointB) const; - DOM_Node nextNode(const DOM_Node& node, bool visitChildren) const; - DOM_DocumentFragment traverseContents(TraversalType type); - void checkReadOnly(DOM_Node& start, DOM_Node& end, - unsigned int starOffset, unsigned int endOffset); - void recurseTreeAndCheck(DOM_Node& start, DOM_Node& end); - DOM_Node removeChild(DOM_Node& parent, DOM_Node& child); - - DOM_DocumentFragment traverseSameContainer( int how ); - DOM_DocumentFragment traverseCommonStartContainer( DOM_Node endAncestor, int how ); - DOM_DocumentFragment traverseCommonEndContainer( DOM_Node startAncestor, int how ); - DOM_DocumentFragment traverseCommonAncestors( DOM_Node startAncestor, DOM_Node endAncestor, int how ); - DOM_Node traverseRightBoundary( DOM_Node root, int how ); - DOM_Node traverseLeftBoundary( DOM_Node root, int how ); - DOM_Node traverseNode( DOM_Node n, bool isFullySelected, bool isLeft, int how ); - DOM_Node traverseFullySelected( DOM_Node n, int how ); - DOM_Node traversePartiallySelected( DOM_Node n, int how ); - DOM_Node traverseTextNode( DOM_Node n, bool isLeft, int how ); - DOM_Node getSelectedNode( DOM_Node container, int offset ); - - - //private data - DOM_Node fStartContainer; - unsigned int fStartOffset; - DOM_Node fEndContainer; - unsigned int fEndOffset; - bool fCollapsed; - DOM_Document fDocument; - bool fDetached; - - DOM_Node fRemoveChild; - -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/RefCountedImpl.cpp b/src/xercesc/dom/deprecated/RefCountedImpl.cpp deleted file mode 100644 index 9bbb508ad285552fd02b78ca4edb7f8acf2895c7..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/RefCountedImpl.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "RefCountedImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -RefCountedImpl::RefCountedImpl() -{ - nodeRefCount = 0; -}; - - - -RefCountedImpl::~RefCountedImpl() -{ -}; - - - - - -void RefCountedImpl::addRef(RefCountedImpl *thisNode) -{ - if (thisNode) - { - if (++thisNode->nodeRefCount == 1) - { - thisNode->referenced(); - } - } -}; - - -void RefCountedImpl::referenced() -{ -}; - - - -void RefCountedImpl::removeRef(RefCountedImpl *thisNode) -{ - if (thisNode) - { - if (--thisNode->nodeRefCount == 0) - { - thisNode->unreferenced(); - } - } -}; - - -void RefCountedImpl::unreferenced() -{ -}; - - -XERCES_CPP_NAMESPACE_END - - - diff --git a/src/xercesc/dom/deprecated/RefCountedImpl.hpp b/src/xercesc/dom/deprecated/RefCountedImpl.hpp deleted file mode 100644 index 094e1bb6b4aeb31346c16eac1beddb657fe3b938..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/RefCountedImpl.hpp +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef RefCountedImpl_HEADER_GUARD_ -#define RefCountedImpl_HEADER_GUARD_ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - - -#include <xercesc/util/XMemory.hpp> - -XERCES_CPP_NAMESPACE_BEGIN - - -class DEPRECATED_DOM_EXPORT RefCountedImpl : public XMemory -{ -public: - int nodeRefCount; - - RefCountedImpl(); - virtual ~RefCountedImpl(); - - static void addRef(RefCountedImpl *thisNode); - static void removeRef(RefCountedImpl *thisNode); - - virtual void referenced(); // This function will be called by - // the reference counting implementation - // whenever the reference count transitions - // from 0 to 1. - - virtual void unreferenced(); // unreferenced() is called whenever the - // the ref count goes from 1 to 0. (Nodes are - // not deleted when the ref count goes to zero - // if they are in the doc tree and the tree - // is still referenced, so a nodes referenced / - // unreferenced state may switch many times - // over its life time.) -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/TextImpl.cpp b/src/xercesc/dom/deprecated/TextImpl.cpp deleted file mode 100644 index 5d47225d9505509d5f8f12577bbcc290985ea580..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/TextImpl.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "DocumentImpl.hpp" -#include "DOM_DOMException.hpp" -#include "DOM_Node.hpp" -#include "TextImpl.hpp" -#include "CharacterDataImpl.hpp" -#include "DStringPool.hpp" -#include "RangeImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -static DOMString *gText = 0; // will be lazily initialized to point to "#text" -static XMLRegisterCleanup gTextCleanup; - -TextImpl::TextImpl(DocumentImpl *ownerDoc, const DOMString &dat) - : CharacterDataImpl(ownerDoc, dat) -{ -}; - -TextImpl::TextImpl(const TextImpl &other, bool deep) - : CharacterDataImpl(other, deep) -{ -}; - -TextImpl::~TextImpl() -{ -}; - - -bool TextImpl::isTextImpl() -{ - return true; -}; - - -NodeImpl *TextImpl::cloneNode(bool deep) -{ - return new (getOwnerDocument()->getMemoryManager()) TextImpl(*this, deep); -}; - - -DOMString TextImpl::getNodeName() { - return DStringPool::getStaticString("#text" - , &gText - , reinitTextImpl - , gTextCleanup - ); -} - -short TextImpl::getNodeType() { - return DOM_Node::TEXT_NODE; -}; - - -TextImpl *TextImpl::splitText(unsigned int offset) -{ - if (isReadOnly()) - { - throw DOM_DOMException( - DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - } - unsigned int len = data.length(); - if (offset > len) - throw DOM_DOMException(DOM_DOMException::INDEX_SIZE_ERR, null); - - TextImpl *newText = - (TextImpl *) getOwnerDocument()->createTextNode( - data.substringData(offset, data.length() - offset)); - - NodeImpl *parent = getParentNode(); - if (parent != null) - parent->insertBefore(newText, getNextSibling()); - - data = data.substringData(0, offset); - - if (this->getOwnerDocument() != null) { - typedef RefVectorOf<RangeImpl> RangeImpls; - RangeImpls* ranges = this->getOwnerDocument()->getRanges(); - if (ranges != null) { - unsigned int sz = ranges->size(); - if (sz != 0) { - for (unsigned int i =0; i<sz; i++) { - ranges->elementAt(i)->updateSplitInfo( this, newText, offset); - } - } - } - } - - return newText; -}; - - -bool TextImpl::isIgnorableWhitespace() -{ - return ignorableWhitespace(); -} - - -void TextImpl::setIgnorableWhitespace(bool ignorable) -{ - ignorableWhitespace(ignorable); -} - -// ----------------------------------------------------------------------- -// Notification that lazy data has been deleted -// ----------------------------------------------------------------------- -void TextImpl::reinitTextImpl() { - - delete gText; - gText = 0; - -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/TextImpl.hpp b/src/xercesc/dom/deprecated/TextImpl.hpp deleted file mode 100644 index 6e825d97374e5244c262153a6415774273db27a7..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/TextImpl.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - - - -#ifndef TextImpl_HEADER_GUARD_ -#define TextImpl_HEADER_GUARD_ - -#include <xercesc/util/XercesDefs.hpp> -#include "CharacterDataImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DEPRECATED_DOM_EXPORT TextImpl: public CharacterDataImpl { -public: - TextImpl(DocumentImpl *ownerDoc, const DOMString &data); - TextImpl(const TextImpl &other, bool deep=false); - virtual ~TextImpl(); - virtual NodeImpl *cloneNode(bool deep); - virtual DOMString getNodeName(); - virtual short getNodeType(); - virtual bool isTextImpl(); - virtual TextImpl *splitText(unsigned int offset); - virtual bool isIgnorableWhitespace(); - - // ----------------------------------------------------------------------- - // Notification that lazy data has been deleted - // ----------------------------------------------------------------------- - static void reinitTextImpl(); - -protected: - virtual void setIgnorableWhitespace(bool ignorable); - friend class DOMParser; -}; - -XERCES_CPP_NAMESPACE_END - -#endif - diff --git a/src/xercesc/dom/deprecated/TreeWalkerImpl.cpp b/src/xercesc/dom/deprecated/TreeWalkerImpl.cpp deleted file mode 100644 index bf9c66a8f1529cbf54ff6830f1cbe441dbafc427..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/TreeWalkerImpl.cpp +++ /dev/null @@ -1,516 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "TreeWalkerImpl.hpp" -#include "DOM_Document.hpp" -#include "DOM_DOMException.hpp" -#include "DocumentImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -/** constructor */ -TreeWalkerImpl::TreeWalkerImpl ( - DOM_Node root, - unsigned long whatToShow, - DOM_NodeFilter* nodeFilter, - bool expandEntityRef) -: fWhatToShow(whatToShow), - fNodeFilter(nodeFilter), - fCurrentNode(root), - fRoot(root), - fExpandEntityReferences(expandEntityRef) - -{ -} - - -TreeWalkerImpl::TreeWalkerImpl (const TreeWalkerImpl& twi) -: RefCountedImpl(), - fWhatToShow(twi.fWhatToShow), - fNodeFilter(twi.fNodeFilter), - fCurrentNode(twi.fCurrentNode), - fRoot(twi.fRoot), - fExpandEntityReferences(twi.fExpandEntityReferences) -{ -} - - -TreeWalkerImpl& TreeWalkerImpl::operator= (const TreeWalkerImpl& twi) { - if (this != &twi) - { - fCurrentNode = twi.fCurrentNode; - fRoot = twi.fRoot; - fWhatToShow = twi.fWhatToShow; - fNodeFilter = twi.fNodeFilter; - fExpandEntityReferences = twi.fExpandEntityReferences; - } - - return *this; -} - - - -void TreeWalkerImpl::unreferenced() -{ - DOM_Document doc = fRoot.getOwnerDocument(); - DocumentImpl* impl; - - if (! doc.isNull()) { - impl = (DocumentImpl *) doc.fImpl; - } - else - impl = (DocumentImpl *) fRoot.fImpl; - - if (impl->treeWalkers != 0L) { - int i; - int sz = impl->treeWalkers->size(); - for (i = 0; i < sz; i++) - if (impl->treeWalkers->elementAt(i) == this) { - impl->treeWalkers->removeElementAt(i); - break; - } - } - -// delete this; - TreeWalkerImpl* ptr = this; - delete ptr; -} - - -/** Return the Root Node. */ -DOM_Node TreeWalkerImpl::getRoot () { - - return fRoot; -} - -/** Return the whatToShow value */ -unsigned long TreeWalkerImpl::getWhatToShow () { - return fWhatToShow; -} - - -/** Return the NodeFilter */ -DOM_NodeFilter* TreeWalkerImpl::getFilter () { - return fNodeFilter; -} - -/** Get the expandEntity reference flag. */ -bool TreeWalkerImpl::getExpandEntityReferences() { - return fExpandEntityReferences; -} - - - -/** Return the current Node. */ -DOM_Node TreeWalkerImpl::getCurrentNode () { - - return fCurrentNode; -} - - -/** Return the current Node. */ -void TreeWalkerImpl::setCurrentNode (DOM_Node node) { - - fCurrentNode = node; -} - - -/** Return the parent Node from the current node, - * after applying filter, whatToshow. - * If result is not null, set the current Node. - */ -DOM_Node TreeWalkerImpl::parentNode () { - - DOM_Node result; - - if (fCurrentNode.isNull()) return result; - - DOM_Node node = getParentNode(fCurrentNode); - if (node != 0) { - fCurrentNode = node; - } - return node; - -} - - -/** Return the first child Node from the current node, - * after applying filter, whatToshow. - * If result is not null, set the current Node. - */ -DOM_Node TreeWalkerImpl::firstChild () { - - DOM_Node result; - - if (fCurrentNode.isNull()) return result; - - DOM_Node node = getFirstChild(fCurrentNode); - if (! node.isNull()) { - fCurrentNode = node; - } - return node; -} - - -/** Return the last child Node from the current node, - * after applying filter, whatToshow. - * If result is not null, set the current Node. - */ -DOM_Node TreeWalkerImpl::lastChild () { - - DOM_Node result; - - if (fCurrentNode.isNull()) return result; - - DOM_Node node = getLastChild(fCurrentNode); - if (! node.isNull()) { - fCurrentNode = node; - } - return node; -} - - -/** Return the previous sibling Node from the current node, - * after applying filter, whatToshow. - * If result is not null, set the current Node. - */ - -DOM_Node TreeWalkerImpl::previousSibling () { - - DOM_Node result; - - if (fCurrentNode.isNull()) return result; - - DOM_Node node = getPreviousSibling(fCurrentNode); - if (! node.isNull()) { - fCurrentNode = node; - } - return node; -} - - -/** Return the next sibling Node from the current node, - * after applying filter, whatToshow. - * If result is not null, set the current Node. - */ - -DOM_Node TreeWalkerImpl::nextSibling () { - - DOM_Node result; - - if (fCurrentNode.isNull()) return result; - - DOM_Node node = getNextSibling(fCurrentNode); - if (! node.isNull()) { - fCurrentNode = node; - } - return node; -} - - -/** Return the previous Node from the current node, - * after applying filter, whatToshow. - * If result is not null, set the current Node. - */ - -DOM_Node TreeWalkerImpl::previousNode () { - - DOM_Node result; - - if (fCurrentNode.isNull()) return result; - - // get sibling - result = getPreviousSibling(fCurrentNode); - if (result.isNull()) { - result = getParentNode(fCurrentNode); - if (! result.isNull()) { - fCurrentNode = result; - return fCurrentNode; - } - return result; - } - - // get the lastChild of result. - DOM_Node lastChild = getLastChild(result); - - // if there is a lastChild which passes filters return it. - if (! lastChild.isNull()) { - fCurrentNode = lastChild; - return fCurrentNode; - } - - // otherwise return the previous sibling. - if (! result.isNull()) { - fCurrentNode = result; - return fCurrentNode; - } - - // otherwise return null. - return result; -} - - -/** Return the next Node from the current node, - * after applying filter, whatToshow. - * If result is not null, set the current Node. - */ - -DOM_Node TreeWalkerImpl::nextNode () { - - DOM_Node result; - - if (fCurrentNode.isNull()) return result; - - result = getFirstChild(fCurrentNode); - - if (! result.isNull()) { - fCurrentNode = result; - return result; - } - - result = getNextSibling(fCurrentNode); - - if (! result.isNull()) { - fCurrentNode = result; - return result; - } - - // return parent's 1st sibling. - DOM_Node parent = getParentNode(fCurrentNode); - while (! parent.isNull()) { - result = getNextSibling(parent); - if (! result.isNull()) { - fCurrentNode = result; - return result; - } else { - parent = getParentNode(parent); - } - } - - // end , return null - return result; -} - - -/** Internal function. - * Return the parent Node, from the input node - * after applying filter, whatToshow. - * The current node is not consulted or set. - */ - -DOM_Node TreeWalkerImpl::getParentNode (DOM_Node node) { - - DOM_Node result; - - if (node.isNull() || node == fRoot) return result; - - DOM_Node newNode = node.getParentNode(); - if (newNode.isNull()) return result; - - short accept = acceptNode(newNode); - - if (accept == DOM_NodeFilter::FILTER_ACCEPT) - return newNode; - - return getParentNode(newNode); - -} - - -/** Internal function. - * Return the nextSibling Node, from the input node - * after applying filter, whatToshow. - * The current node is not consulted or set. - */ - -DOM_Node TreeWalkerImpl::getNextSibling (DOM_Node node) { - - DOM_Node result; - - if (node.isNull() || node == fRoot) return result; - - DOM_Node newNode = node.getNextSibling(); - if (newNode.isNull()) { - - newNode = node.getParentNode(); - - if (newNode.isNull() || node == fRoot) return result; - - short parentAccept = acceptNode(newNode); - - if (parentAccept == DOM_NodeFilter::FILTER_SKIP) { - return getNextSibling(newNode); - } - - return result; - } - - short accept = acceptNode(newNode); - - if (accept == DOM_NodeFilter::FILTER_ACCEPT) - return newNode; - else - if (accept == DOM_NodeFilter::FILTER_SKIP) { - DOM_Node fChild = getFirstChild(newNode); - if (fChild.isNull()) { - return getNextSibling(newNode); - } - return fChild; - } - return getNextSibling(newNode); - -} - - -/** Internal function. - * Return the previous sibling Node, from the input node - * after applying filter, whatToshow. - * The current node is not consulted or set. - */ - -DOM_Node TreeWalkerImpl::getPreviousSibling (DOM_Node node) { - - DOM_Node result; - - if (node.isNull() || node == fRoot) return result; - - DOM_Node newNode = node.getPreviousSibling(); - if (newNode.isNull()) { - - newNode = node.getParentNode(); - if (newNode.isNull() || node == fRoot) return result; - - short parentAccept = acceptNode(newNode); - - if (parentAccept == DOM_NodeFilter::FILTER_SKIP) { - return getPreviousSibling(newNode); - } - - return result; - } - - short accept = acceptNode(newNode); - - if (accept == DOM_NodeFilter::FILTER_ACCEPT) - return newNode; - else - if (accept == DOM_NodeFilter::FILTER_SKIP) { - DOM_Node fChild = getLastChild(newNode); - if (fChild.isNull()) { - return getPreviousSibling(newNode); - } - return fChild; - } - return getPreviousSibling(newNode); - -} - - -/** Internal function. - * Return the first child Node, from the input node - * after applying filter, whatToshow. - * The current node is not consulted or set. - */ - -DOM_Node TreeWalkerImpl::getFirstChild (DOM_Node node) { - - DOM_Node result; - - if (node.isNull()) return result; - - DOM_Node newNode = node.getFirstChild(); - if (newNode.isNull()) return result; - - short accept = acceptNode(newNode); - - if (accept == DOM_NodeFilter::FILTER_ACCEPT) - return newNode; - else - if (accept == DOM_NodeFilter::FILTER_SKIP - && newNode.hasChildNodes()) - { - return getFirstChild(newNode); - } - return getNextSibling(newNode); -} - - -/** Internal function. - * Return the last child Node, from the input node - * after applying filter, whatToshow. - * The current node is not consulted or set. - */ - -DOM_Node TreeWalkerImpl::getLastChild (DOM_Node node) { - - DOM_Node result; - - if (node.isNull()) return result; - - DOM_Node newNode = node.getLastChild(); - if (newNode.isNull()) return result; - - short accept = acceptNode(newNode); - - if (accept == DOM_NodeFilter::FILTER_ACCEPT) - return newNode; - else - if (accept == DOM_NodeFilter::FILTER_SKIP - && newNode.hasChildNodes()) - { - return getLastChild(newNode); - } - return getPreviousSibling(newNode); - - -} - - -/** The node is accepted if it passes the whatToShow and the filter. */ - -short TreeWalkerImpl::acceptNode (DOM_Node node) { - - if (fNodeFilter == 0) { - if ( ( fWhatToShow & (1 << (node.getNodeType() - 1))) != 0) - { - return DOM_NodeFilter::FILTER_ACCEPT; - } - else - { - return DOM_NodeFilter::FILTER_SKIP; - } - } else { - // REVISIT: This logic is unclear from the spec! - if ((fWhatToShow & (1 << (node.getNodeType() - 1))) != 0 ) { - return fNodeFilter->acceptNode(node); - } else { - // what to show has failed! - if (fNodeFilter->acceptNode(node) == DOM_NodeFilter::FILTER_REJECT) { - return DOM_NodeFilter::FILTER_REJECT; - } else { - return DOM_NodeFilter::FILTER_SKIP; - } - } - } -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/TreeWalkerImpl.hpp b/src/xercesc/dom/deprecated/TreeWalkerImpl.hpp deleted file mode 100644 index 4914b45a97eba61d230fdd8aaa58a0054428c74f..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/TreeWalkerImpl.hpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -#ifndef TreeWalkerImpl_HEADER_GUARD_ -#define TreeWalkerImpl_HEADER_GUARD_ - -#include <xercesc/util/XMemory.hpp> -#include "DOM_TreeWalker.hpp" -#include "RefCountedImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - -class DEPRECATED_DOM_EXPORT TreeWalkerImpl : public RefCountedImpl { - - public: - // Implementation Note: No state is kept except the data above - // (fWhatToShow, fNodeFilter, fCurrentNode, fRoot) such that - // setters could be created for these data values and the - // implementation will still work. - - /** Public constructor */ - TreeWalkerImpl ( - DOM_Node root, - unsigned long whatToShow, - DOM_NodeFilter* nodeFilter, - bool expandEntityRef); - TreeWalkerImpl (const TreeWalkerImpl& twi); - TreeWalkerImpl& operator= (const TreeWalkerImpl& twi); - - // Return the root DOM_Node. - DOM_Node getRoot (); - - // Return the whatToShow value. - unsigned long getWhatToShow (); - - // Return the NodeFilter. - DOM_NodeFilter* getFilter (); - - - // Return the current DOM_Node. - DOM_Node getCurrentNode (); - - // Return the current Node. - void setCurrentNode (DOM_Node node); - - // Return the parent Node from the current node, - // after applying filter, whatToshow. - // If result is not null, set the current Node. - DOM_Node parentNode (); - - // Return the first child Node from the current node, - // after applying filter, whatToshow. - // If result is not null, set the current Node. - DOM_Node firstChild (); - - // Return the last child Node from the current node, - // after applying filter, whatToshow. - // If result is not null, set the current Node. - DOM_Node lastChild (); - - // Return the previous sibling Node from the current node, - // after applying filter, whatToshow. - // If result is not null, set the current Node. - DOM_Node previousSibling (); - - // Return the next sibling Node from the current node, - // after applying filter, whatToshow. - // If result is not null, set the current Node. - - DOM_Node nextSibling (); - // Return the previous Node from the current node, - // after applying filter, whatToshow. - // If result is not null, set the current Node. - DOM_Node previousNode (); - - // Return the next Node from the current node, - // after applying filter, whatToshow. - // If result is not null, set the current Node. - DOM_Node nextNode (); - - void unreferenced (); - - // Get the expandEntity reference flag. - bool getExpandEntityReferences(); - -protected: - - // Internal function. - // Return the parent Node, from the input node - // after applying filter, whatToshow. - // The current node is not consulted or set. - DOM_Node getParentNode (DOM_Node node); - - // Internal function. - // Return the nextSibling Node, from the input node - // after applying filter, whatToshow. - // The current node is not consulted or set. - DOM_Node getNextSibling (DOM_Node node); - - // Internal function. - // Return the previous sibling Node, from the input node - // after applying filter, whatToshow. - // The current node is not consulted or set. - DOM_Node getPreviousSibling (DOM_Node node); - - // Internal function. - // Return the first child Node, from the input node - // after applying filter, whatToshow. - // The current node is not consulted or set. - DOM_Node getFirstChild (DOM_Node node); - - // Internal function. - // Return the last child Node, from the input node - // after applying filter, whatToshow. - // The current node is not consulted or set. - DOM_Node getLastChild (DOM_Node node); - - // The node is accepted if it passes the whatToShow and the filter. - short acceptNode (DOM_Node node); - - -private: - // The whatToShow mask. - unsigned long fWhatToShow; - - // The NodeFilter reference. - DOM_NodeFilter* fNodeFilter; - - // The current Node. - DOM_Node fCurrentNode; - - // The root Node. - DOM_Node fRoot; - - // The expandEntity reference flag. - bool fExpandEntityReferences; -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/deprecated/XMLDeclImpl.cpp b/src/xercesc/dom/deprecated/XMLDeclImpl.cpp deleted file mode 100644 index ad6d77f38c4b4f7b1eaf2d4048292711b768aa2a..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/XMLDeclImpl.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -#include "XMLDeclImpl.hpp" -#include <xercesc/util/XMLUni.hpp> -#include "DOM_Node.hpp" -#include "DStringPool.hpp" -#include "DocumentImpl.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -static DOMString *gNam = 0; // will be lazily initialized to "#xmldecl" -static XMLRegisterCleanup gNamCleanup; - -XMLDeclImpl::XMLDeclImpl(DocumentImpl *ownerDoc) - : ChildNode(ownerDoc), - version(DOMString(XMLUni::fgVersion1_0)), - encoding (DOMString(XMLUni::fgUTF8EncodingString)), - standalone (DOMString(XMLUni::fgNoString)) -{ -} - - -//Introduced in DOM Level 2 -XMLDeclImpl::XMLDeclImpl(DocumentImpl *ownerDoc, const DOMString &ver, - const DOMString &enc, const DOMString &isStd) - : ChildNode(ownerDoc), - version ( ver.clone() ), - encoding ( enc.clone() ), - standalone ( isStd.clone() ) -{ -} - - -XMLDeclImpl::XMLDeclImpl(const XMLDeclImpl &other, bool /*deep*/) - : ChildNode(other) -{ - version = other.version.clone(); - encoding = other.encoding.clone(); - standalone = other.standalone.clone(); -} - - -XMLDeclImpl::~XMLDeclImpl() -{ -} - -NodeImpl * XMLDeclImpl::cloneNode(bool deep) -{ - return new (getOwnerDocument()->getMemoryManager()) XMLDeclImpl(*this, deep); -} - -DOMString XMLDeclImpl::getNodeName() -{ - - return DStringPool::getStaticString("#xmldecl" - , &gNam - , reinitXMLDeclImpl - , gNamCleanup - ); -} - -short XMLDeclImpl::getNodeType() -{ - return DOM_Node::XML_DECL_NODE; -} - -DOMString XMLDeclImpl::getVersion() const -{ - return version; -} - -DOMString XMLDeclImpl::getEncoding() const -{ - return encoding; -} - -DOMString XMLDeclImpl::getStandalone() const -{ - return standalone; -} - -void XMLDeclImpl::setVersion(const DOMString &data) -{ - version = data.clone(); -} - -void XMLDeclImpl::setEncoding(const DOMString &data) -{ - encoding = data.clone(); -} - -void XMLDeclImpl::setStandalone(const DOMString &data) -{ - standalone = data.clone(); -} - -// ----------------------------------------------------------------------- -// Notification that lazy data has been deleted -// ----------------------------------------------------------------------- -void XMLDeclImpl::reinitXMLDeclImpl() { - - delete gNam; - gNam = 0; - -} - -XERCES_CPP_NAMESPACE_END - diff --git a/src/xercesc/dom/deprecated/XMLDeclImpl.hpp b/src/xercesc/dom/deprecated/XMLDeclImpl.hpp deleted file mode 100644 index c9ffb2aaaa190d001dfc496d85f1648ac5c095de..0000000000000000000000000000000000000000 --- a/src/xercesc/dom/deprecated/XMLDeclImpl.hpp +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef XMLDeclImpl_HEADER_GUARD_ -#define XMLDeclImpl_HEADER_GUARD_ - -/* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed 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$ - */ - -// -// This file is part of the internal implementation of the C++ XML DOM. -// It should NOT be included or used directly by application programs. -// -// Applications should include the file <xercesc/dom/deprecated/DOM.hpp> for the entire -// DOM API, or DOM_*.hpp for individual DOM classes, where the class -// name is substituded for the *. -// - -#include <xercesc/util/XercesDefs.hpp> -#include "ChildNode.hpp" - -XERCES_CPP_NAMESPACE_BEGIN - - -class DOMString; - -class DEPRECATED_DOM_EXPORT XMLDeclImpl: public ChildNode { - -private: - // ----------------------------------------------------------------------- - // Private data types - // ----------------------------------------------------------------------- - DOMString version; - DOMString encoding; - DOMString standalone; - -public: - XMLDeclImpl(DocumentImpl *ownerDoc); - XMLDeclImpl(DocumentImpl *ownerDoc, const DOMString& version, - const DOMString& encoding, const DOMString& standalone); - XMLDeclImpl(const XMLDeclImpl &other, bool deep=false); - virtual ~XMLDeclImpl(); - - virtual NodeImpl * cloneNode(bool deep); - virtual DOMString getNodeName(); - virtual short getNodeType(); - - - virtual DOMString getVersion() const; - virtual DOMString getEncoding() const; - virtual DOMString getStandalone() const; - - virtual void setVersion(const DOMString& data); - virtual void setEncoding(const DOMString& data); - virtual void setStandalone(const DOMString& data); - - // ----------------------------------------------------------------------- - // Notification that lazy data has been deleted - // ----------------------------------------------------------------------- - static void reinitXMLDeclImpl(); - -}; - -XERCES_CPP_NAMESPACE_END - -#endif diff --git a/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp b/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp index 56a1e737d6e7986615ba2242f98d60161ad08b08..0ef0f36719d260774ec2526c7e344d4350924d7f 100644 --- a/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp +++ b/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp @@ -36,6 +36,7 @@ #include <xercesc/util/XMLMsgLoader.hpp> #include <xercesc/dom/StDOMNode.hpp> #include <xercesc/util/OutOfMemoryException.hpp> +#include <xercesc/util/XMLChar.hpp> XERCES_CPP_NAMESPACE_BEGIN @@ -648,7 +649,7 @@ void DOMLSSerializerImpl::processNode(const DOMNode* const nodeToWrite, int leve fLineFeedInTextNodePrinted = false; fLastWhiteSpaceInTextNode = 0; - if(XMLString::isAllWhiteSpace(nodeValue)) + if(XMLChar1_0::isAllSpaces(nodeValue, XMLString::stringLen(nodeValue))) { // skips whitespace-only text nodes unless whitespace-in-element is set. if (!getFeature(WHITESPACE_IN_ELEMENT_CONTENT_ID))