How to remove xml declaration <?xml version="1.0" encoding="UTF-8" standalone="no" ?>

Hi All,

I am using xerces for XML parsing.
After parsing in new XML file I am getting below is a first line but i dont want it.
"<?xml version="1.0" encoding="UTF-8" standalone="no" ?>"

Could anyone please help me to remove this line in output/updated XML file.
(please suggest solution suits to xerces)


Regards,
Akash
Write the file yourself -- does the tool give you a big string (you can use substring and a small loop or find or something to get the index) that you can write yourself?
I am using xerces, so looking for the solution in xerces.

XMLUni::fgDOMXMLDeclaration is the one feature but am not getting this feature in current xerces
version 3.1.1.

Maybe post your code.

https://xerces.apache.org/xerces-c/
Because it would seem the s/w you're using should be able to do the right thing if what you're passing in is actually valid XML to begin with.
Hi All,
Thanks for your valuable reply.

I was using older xerces version, Now I have updated it to version 3.1.1.

And able to remove default XML declaration line
"<?xml version="1.0" encoding="UTF-8" standalone="no" ?>"

by setting false for XMLUni::fgDOMXMLDeclaration.
<code>
ptrDomConfig->setParameter(XMLUni::fgDOMXMLDeclaration, false);
</code>
I want to read data on one of tag in CDATA section.
But unable to parse the CDATA section in the input XML file.

Any Idea?
Topic archived. No new replies allowed.