So before processing I did:
Doc := TXMLDocument.Create(nil);
Doc.ParseOptions := Doc.ParseOptions + [poPreserveWhiteSpace];
That seems to remove default behaviour of indenting with tabs. But now when I insert new node I get it without indents at all. So I have to "reparse" doc before save:
Doc.XML.Text := xmlDoc.FormatXMLData(Doc.XML.Text);
Doc.Active := true;
I did not experiment with - Doc.NodeIndentStr := ' '; because two spaces is used by default.
Happy hacking!
Edit:
I found that FormatXMLData loose my utf-8 encoding. So I had to do:
Encoding := Doc.Encoding;
Doc.XML.Text := xmlDoc.FormatXMLData(Doc.XML.Text);
Doc.Active := true;
Doc.Encoding := Encoding;
Edit:
I found that FormatXMLData loose my utf-8 encoding. So I had to do:
Encoding := Doc.Encoding;
Doc.XML.Text := xmlDoc.FormatXMLData(Doc.XML.Text);
Doc.Active := true;
Doc.Encoding := Encoding;
Nav komentāru:
Ierakstīt komentāru