W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2004

BAG element

From: Hess Yvan <yvan.hess@imtf.ch>
Date: Fri, 12 Mar 2004 09:53:09 +0100
Message-ID: <DF7EC83D7AFBD411965B0008C7596EC5E0D4A4@imtfexchange.imtf.ch>
To: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>

It will be great in the new specification to have a kind of bag element with
the following requirements

1. The order of the elements is not important
2. It can contains predefined elements that must occurs with a given
occurrences (min and max) 
3. It can also accepts any king of others elements (same or others
namespaces) using <xs:any> element. 

   <xs:element name="metadata">
      <xs:complexType>
         <xs:bag>
            <xs:element name="identifier" type="xs:string" minOccurs="1"
maxOccurs="1" />
            <xs:element name="subject" type="xs:string" minOccurs="0"
maxOccurs="1" />
            <xs:element name="name" type="xs:string" minOccurs="0"
maxOccurs="unbounded" />
            <xs:any processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
         </xs:bag>
      </xs:complexType>
   </xs:element>
   
Here is an instance example:

<metadata>
  <identifier>urn:hsc:1234</identifier>
  <name>Hess Yvan</name>
   <subject>this is the subject</subject>
   <name>Hess Yvan</name>
   <anyOtherElement>blabla</anyOtherElement>
</metadata>


With version 1.0, I tried many possible ways but I never success. I think I
reach a limitation of the W3C recommendation 1.0. I used for example:

   <xs:element name="metadata">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="identifier" type="xs:string"/>
            <xs:any processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
         </xs:sequence>
      </xs:complexType>
   </xs:element>
   
But in this case it violates the "Unique Particle Attribution". From my
point of view this use case is a real concrete use case that should be
supported by W3C XML schema recommendation in a given way.


Yvan Hess
Chief Software Architect

e-mail: yvan.hess@imtf.ch
phone : +41 (0)26 460 66 66 
fax   : +41 (0)26 460 66 60 

Informatique-MTF SA
Route du Bleuet 1 
CH-1762 Givisiez 
        
Systemintegrators for eDocuments 
http://www.imtf.com

DISCLAIMER 
This message is intended only for use by the person to whom it is addressed.
It may contain information that is privileged and confidential. Its content
does not constitute a formal commitment by IMTF. If you are not the intended
recipient of this message, kindly notify the sender immediately and destroy
this message. Thank You.
Received on Friday, 12 March 2004 03:59:10 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:09:02 UTC