Multiline text in XML file

Pete Kirkham mach.elf at
Sun Aug 3 13:26:07 CEST 2008 is relevant, as is the
following section on handling carriage returns.

Don't mix C escapes "\n" and XML markup - there really is is no point, and
it reduces the portability of the XML. XML lets you put carriage returns in
without excapes into text, and the back-slash isn't significant in XML. Such
use forces clients to use specific processing, rather than standard tools
for editing. If you don't care whether applications beyond your control can
edit the data, you might not want to bother with XML, and use C literals or
whatever you want.

In many cases, it's easier to use elements to mark up the line breaks -
either as Stefan suggested, or using a standard vocabulary such as XHTML
which is the dual of that approach ( text <tag/> text <tag/> text rather
than <tag>text</tag> <tag>text</tag> <tag>text</tag> ) which is easier for
hand editing, but a little more difficult for XPath processing.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list