in reply to XML output formatting

so in summary the question is whats the best way when using LibXML to get a nice formatted XML output.

IMHO, the best way is to not worry about it, libxml doesn't care :p

Also, xml_pp, XML::LibXML::PrettyPrint

  • Comment on Re: XML output formatting (XML::LibXML::PrettyPrint)

Replies are listed 'Best First'.
Re^2: XML output formatting (XML::LibXML::PrettyPrint)
by Preceptor (Deacon) on Dec 10, 2013 at 22:13 UTC

    XML is a data format, rather than a 'display' format. You can coerce it to 'look pretty' but I'd suggest you're thinking the wrong way if you do. You don't view raw HTML, and expect it to look 'nice', because that's the point of having formatting tags in the first place.

    Consider instead using an XSL style sheet - there's some generic ones that exist, or you can put together your own for your data. It's essentially a set of instructions that transform 'XML tags' into 'format' e.g. much the same way as your browser does with the well defined HTML tags. (HTML being a subset of XML in the first place).

      ... not op ... ... HTML being a subset of XML in the first place

      First came SGML then came HTML then came XML ... is HTML a subset of XML? Not really