Re: [xml] XML Formatting

On Wed, Jul 09, 2008 at 06:44:38PM +1000, Alistair Leslie-Hughes wrote:

I have a xml document as follows
<Testing>\n<Val foo=\"baa\">xxx </Val></Testing>

Note the \n after <Testing>.

If I load and then save using libxml, the formating appears to be lost.

I've used  xmlNodeDump with format to 1 and xmlTreeIndentString="\t", and 
yes it indents, but thew whole document.

MSXML3 only formats the places that have a \n, in the example above it 
would changed the \n -> \r\n\t.

1.Is there a way to reproduce this bahaviour?


2. Is there a way to normalize EOL's to \r\n?

  no it doesn't make any sense from an XML processing perspective as
this will be changed back when parsing.
  doing this does not make sense from an XML perspective, if you want to change
it, post-process the XML document.


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]