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 [EMAIL PROTECTED]  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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to