I have added this portion to my original posting...
replace() { // parse out the node and replace old value // with this new node. ... (code taken out)
try { // remove the old one here. node->getParentNode()->removeChild(node); node->release();
doc->importNode(newnode, true);
The goal of the function importNode() is to take a node coming from a different document and create a copy that is owned by the current document, so that it has the same lifetime of the other nodes; it does not place the node in the DOM tree. You need to specify where you want it to be by using the usual appendChild/insertBefore/etc.. methods.
If the goal of this method is to replace the node pointed by the "node" variable with the "newnode", you should write this
node->getParentNode()->replaceChild( doc->importNode(newnode,true), node); node->release();
[...]
Also, if I replace my second one of dn = (DOMNode*)doc->getDocumentElement();
dn=doc->getFirstChild() my program would crash.
doc->getFirstChild() returns the first child node of the document, and that could be the document element, a comment, whitespace or a processing-instruction; doing a blind cast of that value to DOMElement* will always lead you directly to a crash.
Alberto
Any ideas would be greatly appreciated. -- Jimmy ____________________________________________ Taxes and golf are alike, you drive your heart out for the green, and then end up in the hole. - Source unknown
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]