Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - RE: Repeating elements with fixed attribute values >Thread Next - Visual Schema Re: Repeating elements with fixed attribute valuesTo: "King, Jeffrey (Mission Systems)" <Jeff.King@---.---> Date: 1/5/2008 7:21:00 PM Hi Jeffrey, King, Jeffrey (Mission Systems) <Jeff.King@n...> writes: > However, I am wondering that if XML Schema 1.0 does not support it, > then maybe it's trying to tell me it's not good approach. Are there > any reasons (other than XML Schema 1.0 does not support it) why using > the design I presented below is poor? You are overloading the same entity (the 'field' element) with many "roles" (e.g., it can be field1, field2, etc.). The different roles are distinguished by a combination of values in attributes/elements. A simpler design would be to have one element for one and only one role and make this role explicit in element's name, for example: <root> <word name="one"> <field1 number="1">any string here</field> <field2 number="2">any string here</field> <field3 number="3">any string here</field> ... </word> <word name="two"> <field4 number="4">any string here</field> <field5 number="5">any string here</field> <field6 number="6">any string here</field> ... </word> </Thanks> Now you can use the XML Schema 1.0 mechanisms to make the 'number' attribute fixed to a specific value. In fact, because there appears to be a 1-to-1 relationship between element's name and attribute's value, you can get rid of the attribute all together since it does not carry any useful information (its value is implied by element's name). Boris -- Boris Kolpackov Code Synthesis Tools CC http://www.codesynthesis.com XML Parsing and XML Schema Validation for Embedded Systems From mike@s... Sat Jan 05 16:10:06 2008 Received: from lisa.w3.org ([128.30.52.41]) | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
