You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by bu...@apache.org on 2002/11/06 16:19:40 UTC
DO NOT REPLY [Bug 13197] -
problem deleting attributes when element is released
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13197>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13197
problem deleting attributes when element is released
------- Additional Comments From gareth@decisionsoft.com 2002-11-06 15:19 -------
This problem has just manifested iteself while Ive been coding the level 3 id
stuff. Although this code shows a bug with the node id map (which I will fix) I
believe the release issue may cause us problems in other parts of the code.
look at the following code
DOMDocument *doc = parser->getDocument();
DOMNode *n = doc->getFirstChild();
DOMElement *elDoc = doc->getDocumentElement();
DOMElement *newEle1 = doc->createElementNS(X("http://newEle1"),
X("newEle1"));
elDoc->appendChild(newEle1);
XMLCh* temp = XMLString::transcode("val");
DOMAttr *atTest = doc->createAttributeNS(X("http://foo"), X("name"));
atTest->setValue(temp);
newEle1->setAttributeNode(atTest);
newEle1->setIdAttributeNode(atTest);
DOMElement *eleNextTest = doc->getElementById(temp);
cerr << "1 " << XMLString::transcode(eleNextTest->getNodeName()) << endl;
//all good until here
elDoc->removeChild(newEle1);
newEle1->release();
eleNextTest = doc->getElementById(temp);
cerr << "2 " << XMLString::transcode(eleNextTest->getNodeName()) << endl;
//this is bad - the ele has been released
newEle1 = doc->createElementNS(X("http://newEle1"),
X("ohDearThisIsVeryBad"));
eleNextTest = doc->getElementById(temp);
cerr << "3 " << XMLString::transcode(eleNextTest->getNodeName()) << endl;
//this is very bad :( we are accessing a completly different element
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org