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

Dec 6, 2019 at 10:52am
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
Dec 6, 2019 at 6:41pm
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?
Dec 7, 2019 at 6:53am
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.

Dec 7, 2019 at 8:59am
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.
Dec 13, 2019 at 6:25am
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>
Dec 13, 2019 at 6:27am
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.