[fpc-pascal] XML - Indent, text content, special char

Michael Van Canneyt michael at freepascal.org
Sat Apr 27 13:57:44 CEST 2019



On Sat, 27 Apr 2019, Gabor Boros wrote:

> Hi All,
>
> I have an existing XML file. After load(, modify) and save this file some 
> mandatory formatting things lost from it. I need same indent as before, same 
> text contents and not replace every special chars. With the below code I got 
> the attached OUTPUT.xml from the attached INPUT.xml. Any idea how to solve 
> this problem? (I use fixes_3_2.)
>
> X:=TXMLDocument.Create;
> ReadXMLFile(X,'INPUT.xml');
> WriteXMLFile(X,'OUTPUT.xml');

As far as I know you can't. I recently changed some things in xmlwriter so you can
influence the formatting to some degree, but no attempt is made to respect
the formatting of a previously read file. I believe the formatting info is
discarded on read (I would need to veify) so this would require lots of
rewriting.

Michael.



More information about the fpc-pascal mailing list