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
and confusing APIs. The in-memory format is public, write your own
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

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

  user 3 wants

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

  user 4 wants

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

  user 5 wants

  <a foo="1"
  indented with spaces

  user 6 wants

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

  but also

  <a long_attribute_foo="1"

  user 7 wants

<doc><a foo="1"

  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 Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]