You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ga...@apache.org on 2002/11/21 15:17:55 UTC
cvs commit: xml-xerces/c/src/xercesc/dom/impl DOMAttrImpl.cpp DOMAttrImpl.hpp
gareth 2002/11/21 06:17:55
Modified: c/src/xercesc/dom/impl DOMAttrImpl.cpp DOMAttrImpl.hpp
Log:
Added helper methods to remove and add attributes into the document id map.
Revision Changes Path
1.13 +1 -2 xml-xerces/c/src/xercesc/dom/impl/DOMAttrImpl.cpp
Index: DOMAttrImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMAttrImpl.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- DOMAttrImpl.cpp 4 Nov 2002 15:07:34 -0000 1.12
+++ DOMAttrImpl.cpp 21 Nov 2002 14:17:55 -0000 1.13
@@ -65,7 +65,6 @@
#include "DOMStringPool.hpp"
#include "DOMDocumentImpl.hpp"
#include "DOMCasts.hpp"
-#include "DOMNodeIDMap.hpp"
XERCES_CPP_NAMESPACE_BEGIN
1.6 +29 -1 xml-xerces/c/src/xercesc/dom/impl/DOMAttrImpl.hpp
Index: DOMAttrImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMAttrImpl.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DOMAttrImpl.hpp 4 Nov 2002 15:07:34 -0000 1.5
+++ DOMAttrImpl.hpp 21 Nov 2002 14:17:55 -0000 1.6
@@ -77,6 +77,7 @@
#include "DOMDocumentImpl.hpp"
#include <xercesc/dom/DOMAttr.hpp>
#include <xercesc/framework/XMLBuffer.hpp>
+#include "DOMNodeIDMap.hpp"
XERCES_CPP_NAMESPACE_BEGIN
@@ -110,9 +111,36 @@
// helper function for DOM Level 3 renameNode
virtual DOMNode* rename(const XMLCh* namespaceURI, const XMLCh* name);
+ // helper method that sets this attr to an idnode and places it into the document map
+ virtual void addAttrToIDNodeMap();
+
+ // helper to remove this attr from from the id map if it is in there
+ virtual void removeAttrFromIDNodeMap();
private:
void getTextValue(DOMNode* node, XMLBuffer& buf) const;
};
+
+inline void DOMAttrImpl::removeAttrFromIDNodeMap()
+{
+ if (fNode.isIdAttr()) {
+ ((DOMDocumentImpl *)getOwnerDocument())->getNodeIDMap()->remove(this);
+ fNode.isIdAttr(false);
+ }
+}
+
+inline void DOMAttrImpl::addAttrToIDNodeMap()
+{
+ fNode.isIdAttr(true);
+
+ // REVIST For now, we don't worry about what happens if the new
+ // name conflicts as per setValue
+ DOMDocumentImpl *doc = (DOMDocumentImpl *)(fParent.fOwnerDocument);
+
+ if (doc->fNodeIDMap == 0)
+ doc->fNodeIDMap = new (doc) DOMNodeIDMap(500, doc);
+
+ doc->getNodeIDMap()->add(this);
+}
XERCES_CPP_NAMESPACE_END
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org