[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Implementing a kind of bag element with XML schema


kind of bag
I tried to implement with XML schema a kind of bag element with the
following requirements:

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

Here are valid XML instance examples:

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

<metadata>
  <dc:subject>this is the subject</dc:subject>
  <anyOtherElement>blabla</anyOtherElement>
  <dc:identifier>urn:hsc:1234</dc:identifier>
</metadata>

I would like to force that dc:identifier is always present in the metadata
element, but where this element appears is not important! This is the
requierement I have to implement.

For example, I tried somethink like that:

   <xs:element name="metadata">
      <xs:complexType>
         <xs:choice>
            <xs:element name="identifier" type="xs:string" minOccurs="1"
maxOccurs="1" />
            <xs:any processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
         </xs:choice>
      </xs:complexType>
   </xs:element>
   
But in this case it violates the "Unique Particle Attribution". Nobody can
help me to solve this problem (mailing-lists or others). I don't know if a
reach a limitation of the W3C recommendation, but from my point of view this
use case is a real concrete use case that should be supported by W3C XML
schema recommendation.

Does it exist a possibility to implement what I want to do or do I really
reach a limitation of the XML schema W3C recommendation 1.0?

Yvan Hess
Chief Software Architect

e-mail: yvan.hess@i...
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.



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.