Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


The order of attributes

From: Xasima Xirohata <xasima@-----.--->
To: xml-dev@-----.---.---
Date: 1/6/2006 9:30:00 AM
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