[Libreoffice] XML pretty printer (was: Where did Setup.xcu go?)

Lubos Lunak l.lunak at suse.cz
Wed Aug 17 06:54:06 PDT 2011


On Thursday 11 of August 2011, Miklos Vajna wrote:
> On Wed, Aug 10, 2011 at 11:28:42PM +0200, Eike Rathke <ooo at erack.de> wrote:
> > For which I always recommend xmlpp,
> > http://software.decisionsoft.com/tools.html
>
> Is this better in some aspect than xmllint --format, which cames with
> libxml and requires no manual installation? :)

 Xmllint --format silently(!) drops any xml content it cannot handle (e.g if 
the .xml has one closing tag missing). Xmlpp seems to handle that fine (the 
only minor problem I noticed is that it alters the original xml in "harmless" 
ways such as changing " to ' or reordering attributes).

 If you need to deal with possibly broken XML, I suggest to use 
http://cgit.freedesktop.org/libreoffice/build/tree/scratch/formatxml.cpp . It 
handles even malformed XML, it does not alter the contents in any way except 
for indenting it and explicitly marking problems in the XML structure with an 
easily visible comment.

-- 
 Lubos Lunak
 l.lunak at suse.cz


More information about the LibreOffice mailing list