
Hi, I'm getting nice pretty print output, but the first line shows UTF-16 <?xml version="1.0" encoding="UTF-16" standalone="no" ?> The original Xojo xml has <?xml version="1.0" encoding="UTF-8"?> Using this to convert from a Xojo XML to a MBS XML dim doc as new XMLDocumentMBS(xmldoc.ToString) doc.tostring has <?xml version="1.0" encoding="UTF-8" standalone="no" ?> UTF-16 gives a XML schema validation error when I try to verify. Regards, Lee
On 21 Mar 2024, at 17:26, Christian Schmitz via MBS Xojo Plugins
wrote: On 21. Mar 2024, at 16:11, Lee Badham via MBS Xojo Plugins
wrote: Hi,
Are there any examples of using XMLConfigurationMBS.formatprettyprint?
Thanks for asking.
Here is a sample:
// parse it Dim doc As New XMLDocumentMBS("
<f>1</f><f>2</f><f>3</f><f>4</f></test>") // create serializer Dim serializer As New XMLSerializerMBS
// options Dim config As XMLConfigurationMBS = serializer.DOMConfig serializer.NewLine = EndOfLine config.SpaceFirstLevelElements = False config.FormatPrettyPrint = True
// and output to string Dim s1 As String = serializer.writeToString(doc)
// options config.FormatPrettyPrint = False
// and output to string Dim s2 As String = serializer.writeToString(doc)
Break // compare in debugger
It will do the nice formatted one and the compact one. If you set FormatPrettyPrint to true, you may set SpaceFirstLevelElements to false to avoid empty lines.
Best regards, Christian
-- Read our blog about news on our plugins:
_______________________________________________ MBS Xojo Plugins mailing list -- mbsxojoplugins@lists.monkeybreadsoftware.com To unsubscribe send an email to mbsxojoplugins-leave@lists.monkeybreadsoftware.com