You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Rob S." <rs...@home.com> on 2002/01/29 19:10:02 UTC

RE: why does xerces add attributes in alphabetical order of attri bute name

>Say the important elements of your xml are identified by a name which is
>identifies them to your editors. The other attributes are less important.

The XML spec's design goal #6 says that they should be 
human-readable.  Considering they are readable as-is, and enforcing 
ordering would require more work, why do it?  In your example, yes, but if 
there were 20 or 30 <elem> elements, you would do CTRL-F "wid" and keep 
hitting ALT-F until you found the one you wanted.  Adding more rules 
complicates things for what I see as a payoff only a small percentage of 
the time.

IMHO, the original person that brought this up probably wanted to use 
ordering of attributes for structure when that's not what I believe the 
purpose of attributes is.

- r


>It's a lot easier to spot the widget in
>
><doc>
>       <elem name="widget" code="XYZ-1234" country="US" type="A">
>             blah blah
>             blah blah
>             blah blah
>       </elem>
>       <elem name="fribber" code="XYZ-1235" country="Australia" type="A">
>             blah blah
>             blah blah
>             blah blah
>       </elem>
>       <elem name="skiff" code="XYW-1234" type="B">
>             blah blah
>             blah blah
>             blah blah
>       </elem>
>       etc
>
>than in
>
>
>       <elem code="XYZ-1234" country="US" name="widget" type="A">
>             blah blah
>             blah blah
>             blah blah
>       </elem>
>       <elem code="XYZ-1235" country="Australia" name="fribber" type="B">
>             blah blah
>             blah blah
>             blah blah
>       </elem>
>       <elem code="XYW-1234" name="skiff" type="A">
>             blah blah
>             blah blah
>             blah blah
>       </elem>
>       etc
>
>
>
> 
>
>                       "Rob 
> S." 
>
>                       <rslifka@home.co         To: 
> xerces-j-user@xml.apache.org
>                       m>                       cc: 
>
>                                                Subject: RE: why does 
> xerces add attributes in alphabetical order of  attri
>                       01/29/2002 12:34         bute 
> name
>                       PM 
>
>                       Please 
> respond 
>
>                       to 
> xerces-j-user 
>
> 
>
> 
>
>
>
>
>
>
> >I know that this is not the right list to address the issue, but I just
> >want to point out that XML was invented with human readability in mind --
> >so it seems perfectly reasonable to want to make an XML document humanly
> >readable (ie. by ordering attributes in some meaningful order). I guess it
>
> >was an oversight in the XML spec to specify attributes unordered.
>
>I would guess from the designer's perspective, the answer is "why?"  What
>benefits are there to ordering attributes?   Elements are not ordered to
>preserve readability, they are ordered to preserve structure.  If the
>readability of your document is severely influenced by attribute ordering,
>I'd guess that you have too many attributes in an element.
>
>- r
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org