[Cc'ing the gdome list since this problem was raised there too ] On Thu, Apr 26, 2001 at 11:14:52AM -0700, Joe McAlerney wrote:
Hello, I recently upgraded from 2.3.6 to 2.3.7. When I use xmlDocDump() to output an xmlDoc to a file, I noticed that newlines were not inserted at the end of child-less nodes, and the closing tags of nodes with children (with the exception of the XML declaration and DOCTYPE declaration). In other words, the tree is mungged together into a single line.
[...]
In past experience, these sorts of things end up being features, or bug fixes. I couldn't find anything in the ChangeLog related to what I am seeing. Is there an explanation? I am using DOM to build my trees. RH 7.0 and
Okay, basically I changed the behaviour of the saving routines which were still doing this kind of things. The underlying point is that in XML any char is significant, even "formatting spaces", so it was one of the changes i introduced in 2.0 for conformance. I found that a few saving routines were still doing this and it should never happen by default (i.e. adding nodes to a document should not be done unless there is an explicit request for this). So it is a bug fix, but it seems people were relying on the old semantic. The best I can offer is provide a new entry point with a flag making this choice explicit, functions like xmlDocDumpFormatMemory() have this already (it's the format arg, 1 means that libxml should indent the document). The enclosed patch provides such a function: xmlSaveFormatFile(const char *filename, xmlDocPtr cur, int format); call it like xmlSaveFile with the extra 1 parameter Daniel [P.S. the mailing list is now xml gnome org :-) ] -- Daniel Veillard | Red Hat Network http://redhat.com/products/network/ veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
Attachment:
indent.patch
Description: Text document