alexsandrovp wrote:
Hi all,
I'm new to xerces and I'm using DOM in my current project.
I already know how to parse the xml file and get pointers to DOMNode objects
of my interest.
What I would like to learn is how can I comment out a particular node. Is
there a way to change the node type from ELEMENT_NODE to COMMENT_NODE? How
is the proper way to do it?
Thanks in advance.
There is no way in DOM to change the type of a node; you need to
serialize the element using DOMWriter::writeToString (you may need to
call setFeature(XMLUni::fgDOMXMLDeclaration, false) to turn off the
generation of the XML PI), then create a DOMComment with the returned
string, then use DOMNode::replaceChild to switch the two nodes.
Alberto
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]