Reputation: 33
I want to remove XML declaration only from an XML using C++
<?xml version="1.0" encoding="UTF-8" ?>
Then I want to add this line and resave the XML
<?xml version="1.0" encoding="ISO-8859-1" ?>
All I have and know how to do it load the xml document
hr = IXMLDOMDocument->load(vstrfilename, &status);
using the IXMLDOMDocument2
interface of msxml2
How can I achieve this ?
My programming environment is borland c++ builder 6
Thank You
Upvotes: 2
Views: 927
Reputation: 7620
<? some text ?>
is a processing instruction. The node is of type NODE_PROCESSING_INSTRUCTION
.
Retrieve the node as the first child of the document, using get_childNodes
and delete it with removeChild
.
Then, use createProcessingInstruction
for the new encoding and use insertBefore
(with the new first child) to add it to the document.
Upvotes: 1