Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xml-dev] The order of attributes

From: Mitch Amiano <mitch.amiano@-----------.--->
To: Xasima Xirohata <xasima@-----.--->
Date: 1/6/2006 8:40:00 PM
Deferring the question to "that's the way SGML did it" is a bit 
unsatisfying.

I would guess that some of the old timers on this list would say that 
they had discussions about these sorts of issues in the process of 
standardizing generalized markup. As I haven't heard any comment, I'll 
make a couple of wild suppositions and hope that someone else provides a 
more historically accurate version:

An attribute is conceived in SGML as "a characteristic quality, other 
than type or content" (4.9). Comparing apples-to-apples (element type, 
content, attribute*), one should instead ask the question, "why doesn't 
an attribute value have internal order". (It does, even if it doesn't 
provide element content inside.)  Put it another way: does it make sense 
to ask why the element type and content are not ordered with respect to 
one another? Then why order attributes, which provide qualities of an 
element, analogous to type and content?

I believe it was also envisioned that people would be creating markup 
manually - as many still do to this day.  It would be difficult to 
properly read the ordering of attributes, or to accurately infer the 
actual order at the time it would be processed, if values were 
defaulted. Should DTD ATTLISTs impose an order on attributes?  If you do 
that, what do you do about documents processed without the DTD? It is a 
usability issue.

Regards,

Mitch


Xasima Xirohata wrote:

> Hi, everybody.
>
> I wonder why the order of attributes doesn't matter in the XML 1.0.  
> spec.
>
> I've tried to find the reason for the fact, so I believe that there is 
> the only situation that might deal with this. A mixed content is 
> commonly used in xml elements, while it's impossible to imagine 
> something like "mixed" in the scope of attributes. If the mixed 
> content would unhappily be forbidden in the scope of element, the 
> order of elements hadn't been of importance too. If something like 
> mixed content would be allowed in the scope of attributes, the order 
> of attributes had been of importance.
>
>
> On the other hand, while we are trying to express some kind of 
> information relations of the document by the XML notation, I don't 
> consider strange the idea of using the order of attributes in some 
> purposes.
>
> For example, we have the xml document that express what font should be 
> used for the text. If some font isn't found at the target system, the 
> next font in the sequence should be used.
>
> Xml:
> <text>
>   <font_sequence>
>     <font>Antique Olive</font>
>     <font>Franklin Gothic Book</font>
>     <font>Arial</font>
>   </font_sequence >
>   <content>
>      Once upon a time ...
>   </content>
> </text>
>
>
> It is endurable to rewrite it like this
> <text font1="Antique Olive"
>       font2="Franklin Gothic Book"
>       font3="Arial">
>      Once upon a time ...
> </text>
>
>
> You see that XML spec say you should explicitly control the names of 
> the attributes. Due to the absence of attribute ordering, you couldn't 
> write in the following way
>
> foreach ( attr in  "/text/@*" ){
>       if (exist_in_system(attr))
>          break;
> }
> I agree that this rule is valuable and merited. I'd only like to know 
> why it emerges.
>
> The next questions that might possible been discussed a long ago is 
> the uniqueness of names of attributes. I accept that some of 
> attributes must be unique in the element scope (i.e., "id" attribute). 
> I wonder whether the name uniqueness is the semantic requirement to do 
> well design, or it's only the relieving for parser processing (it had 
> been too difficult exploring elements by the attribute keys if there 
> would be the necessity to set the primary key for each XML documents).
> What's strange in sense in the following xml.
> <text author="George "
>       author="Mike"
>       author="Alexander">
>      Once upon a time ...
> </text>
>
>
>
> Present my apologies of asking the strange and well-known questions.
>
>
> -- 
> Regards,
>           ~ Xasima Xirohata ~


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent