[xml] Crash using xmlFreeNode

I'm getting a crash using xmlFreeNode.

The stack frame reads:

#0      0x92c29a58 in xmlFreeNodeList
#1      0x92c29cd8 in xmlFreeNode
#2      0x0009112c in ReplaceDependancies at SCORMDisag.cpp:168

ReplaceDependancies is my own function.

The function is this:

void ReplaceDependancies( xmlNode* WholeRoot, xmlNode* NewResource, XML_Map& xMap ) {
        xmlNode* next = My_XMLGetElement(NewResource, "dependency");

        while (next) {
                xmlNode* dep = next;
                next = My_XMLNextElement( dep, "dependency" );
                ReplaceDepSub( WholeRoot, NewResource, dep, xMap );

                xmlUnlinkNode( dep );
                xmlFreeNode( dep );

If I comment out xmlFreeNode, then the code *appears* to work perfectly. (Although it might still be doing something wrong.)

Am I doing something wrong? The NewResource xmlNode* parameter, was created via xmlCopyNode. The document copied from has an XML name space, and so NewResource has an "xmlns" attribute.

Actually a separate issue is that I wish NewResource *didn't* have an xmlns resource. This is because the document I am putting it back into, (via xmlAddChild), has a name space already! And so the xmlns thingy gets duplicated. It's quite annoying to look at duplicate xmlns attributes. They weren't there in the original XML so they shouldn't be there in the copied XML, and they arent' needed even to maintain the XML's meaning, because I'm putting it back into a document with the same name space.

I'd like some way to disable this automatic xmlns addition, please.

Also, this list is quite quiet. Not much activity. Is it because of the holiday or has the list quietned down over time? Really I just worry about getting an answer to my questions!

Thanks in advance to anyone who is able to advise!

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]