Re: [xml] Attribute indenting




On Jeu 28 avril 2005 13:33, Daniel Veillard a écrit :
On Mon, Apr 25, 2005 at 05:54:55PM +0200, Nicolas Mailhot wrote:
Hi,

Is there any good reason not to indent properly attributes when xmllint
is
invoked with --format ? When I say indenting I think about constructions
like:

 <foo bar1="..."
      bar2="..."
      bar3="...">

which you see in all XML textbooks but can not achieve with most current
XML formaters.

  because for document with a lot of deep, lots of attributes and little
CDATA you could end up with document serialization many multiplied by a
factor
or 2 or 3 easilly for no practical gain.

Well I assume when you ask document reformating you're ready to pay the
formating cost.

Or are you telling me some processes reformat on th fly without any real
need to ?

I ask this because someone told me last week that using more than one
attribute per element should be avoided because the way tools indent
them
(inline) a human can not parse them easily (SIC) so one can not write
readable XML with attributes. And indeed I see that any XML file that
uses

  I see no valid argument there.

Well, I'm afraid the other person was right when arguing that tools
(including libxml) seem to consider attributes second-class citizens that
should not be prettified alogside elements.

namespace declarations (big fat attributes) is very difficult to read
once
reformated by xmllint - the output is fine for elements but not much
else.

  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.

Regards,

-- 
Nicolas Mailhot




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