Re: [xml] Attribute indenting



On Thu, Apr 28, 2005 at 02:11:10PM +0200, Nicolas Mailhot wrote:
  There is so many axis to the "formatting" of markup, than trying to
provide customization for each an every axis would just be insanely
complex
and confusing APIs. The in-memory format is public, write your own
serializer
if you really need something very custom.

It's not about doing something very custom. Since --format is useful only
when a human reads the output (tools do not need the pretty indenting) I
assumed its aim was to produce code as human-readable as possible, ie use
the same tricks as in XML reference books.

I don't see the point of indenting a document at all if a large part of
its contents (attributes) is still lumped together. It does not take a lot
of attributes to get line wrapping mess - it's a general case.

  user 1 wants

<doc><a foo="1" bar="2"/></doc>

  user 2 wants

<doc>
 <a foo="1" bar="2"/>
</doc>

  user 3 wants

<doc>
\t<a foo="1" bar="2"/>
</doc>

  user 4 wants

<doc>
  <a foo="1" bar="2"/>
</doc>

  user 5 wants

<doc>
  <a foo="1"
     bar="2"/>
</doc>
  indented with spaces

  user 6 wants

<doc>
  <a foo="1" bar="2"/>
</doc>

  but also

<doc>
  <a long_attribute_foo="1"
     long_attribute_bar="2"/>
</doc>

  user 7 wants

<doc><a foo="1"
        bar="2"/></doc>

  now do man indent, and count the options. Same problem, write your own
xmlindent tool based on libxml2 and the existing xmlsave.h API. Then spend
the next 10 years adding more options as you will get more users disagreeing
with each other.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
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]