[XML Records] AddDeclaration to Xml

[XML Records] AddDeclaration to Xml

Forge Component
Published on 5 Feb by Afonso Carvalho
32 votes
Published on 5 Feb by Afonso Carvalho
Maybe someone can explain why I don't get a declaration added to the xml when I set the AddDeclaration to True in the XmlDeclaration Record of the DefaultXmlConfig Record?
Hello Wayne,

I imagine you're using XMLRecords in the Java version as it is the only one which did not have the code to allow outputting xml declaration.

I have fixed that in version 1.5.4 of the XML Records component. Please check if it fits your needs.
Thank you! It works fine

And Yes, I am using the Java version. I had done a workaround by doing a replace on the first tag to add it in but have removed it in favor of the config option.

Thanks again for your help,
Hey Ricardo,

First of all, thanks for the extension :)

I'm having issues with the AddDeclaration attribute for the DefaultXMLConfig on .NET. Despite defining it as True, it doesn't get generated.

May it be because I'm using the AddRootNode paramenter as true when generating it? If I don't, I get an error: "There are multiple root elements."

I'm using a variable A that's a record list of type B. So I was expecting to have it generating something like:

<B />
<B />