Another simple question.

I am parsing a formatted xml data file (by "formatted" I mean nicely 
indented etc).

If I change an element value and then save the file back out using

        xmlSaveFormatFile(filename, doc, 1)

It looks the same as the original.

But if I add a child, for example, and use the same 
xmlSaveFormatFile, the added child is correct but not formatted at 
all (no indents, no returns).

It's not clear to me from the documentation if the "1" argument in 
xmlSaveFormatFile is supposed to format it like I expect or not. [as 
per the docs I did call xmlKeepBlanksDefault(0) before the Save call; 
no change]

Do I need to switch over to the xmlTextWriter API, and stop using 
xmlSaveFormatFile, to make the file look "correct" when saved back 
out?

Reason for pursuing this is because the xml data files are small and 
may very well be hand edited on occasion before being parsed again. I 
want them to "look nice" and be easy to edit if the parsing code has 
added a child in the interim.


Stefan Jeglinski



_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to