Re: [xml] XML Formatting



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

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?

  no

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.
  http://www.w3.org/TR/REC-xml/#sec-line-ends
  doing this does not make sense from an XML perspective, if you want to change
it, post-process the XML document.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



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