[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Pretty-printers for XML and JSON
- From: Matthew Wild <mwild1@...>
- Date: Mon, 30 Aug 2010 12:47:02 +0100
On 30 August 2010 08:34, steve donovan <email@example.com> wrote:
> On Sun, Aug 29, 2010 at 8:31 AM, Alexander Gladysh <firstname.lastname@example.org> wrote:
>> It is important that each parameter in the resulting string will be on
>> a separate line. This is a surprisingly rare feature for command-line
>> XML pretty-printers I've tried (note that, anyway, I need a Lua
>> module, not a command-line tool).
> It doesn't sound like a difficult thing to put together on a rainy
> afternoon (which is how many Lua modules get started ;)) but I'm sure
> it would not make everyone happy, since the desired presentation for a
> piece of XML depends on how you want to view its structure. (E.g.
> compare your desired presentation with XHTML.) Maybe a
> template-driven approach, or at least heavily customizable.
> On a somewhat OT note, it would be cool if luaexpat had a module to
> convert LOM format into string XML output - there would then be the
> same problem of customizing the presentation.
We don't use LOM, but something quite like it. We have a serializer
that we've optimised to death, it wouldn't be hard to adapt it for
LOM, or insert linebreaks after attributes. The code starts here:
runs until line 218.
The rest of that module is about creating and manipulating snippets of
XML, some documentation at