emacs-devel
[Top][All Lists]
Advanced

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

RE: Indentation contest nxml vs xml-mode


From: Drew Adams
Subject: RE: Indentation contest nxml vs xml-mode
Date: Thu, 6 Mar 2008 19:31:49 -0800

> Drew Adams wrote:
> >> Try indenting the following in nxml-mode and xml-mode:
> >>
> >> <outermost>
> >>    <inner1><inner2>
> >>        <inner3>Duh</inner3>
> >>      </inner2>
> >>    </inner1>
> >> </outermost>
> >>
> >> I think xml-mode wins here.

(For the record, I did not write that; Lennart did. I wrote that both
indentation styles shown are poor.)

> This has been discussed here before. Try it with some real elements...
> 
> <html>
>   <body><b>
>     <i>Duh</i>
>     </b>
>   </body>
> </html>
> 
> Which indentation looks more correct now?

Again, neither is great, IMO. It is not obvious with your indentation that
<i> is a child of <b>. I would always indent a child inside its parent,
unless there is no choice. Try reading a 10-page XML schema whose
indentation doesn't help you see the hierarchy. Indentation is important to
human readers, even when it is insignificant in terms of XML semantics.

> nxml's indentation is based on the fact that you are using 
> <inner2> in a way that suggests that it has inline, not block semantics.

What are "inline" and "block" semantics? There are no semantics implied by
XML indentation, unless indenting changes significant whitespace (which it
should not).

Of course, anyone or any program is free to add additional semantics (their
own interpretation) to code, but there is no such difference in the XML
standards.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]