Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Problem designing complexType accepting a specified element a nd a llowing any others

From: "Markus Seibold" <markus.seibold@---.--->
To: "'Hess Yvan'" <yvan.hess@----.-->
Date: 3/12/2004 12:07:00 AM
I don't know how <all> handles the <any> element??? I only know that
<all> allows instance documents to mix the element order.

Sorry! 


> -----Original Message-----
> From: xmlschema-dev-request@w... 
> [mailto:xmlschema-dev-request@w...] On Behalf Of Hess Yvan
> Sent: Donnerstag, 11. M=E4rz 2004 22:54
> To: 'Markus Seibold '
> Cc: 'xmlschema-dev@w... '
> Subject: RE: Problem designing complexType accepting a 
> specified element a nd a llowing any others
> 
> 
> 
> Do you mean I have to change the schema like that ?
> 
> <xs:element name="metadata">
>   <xs:complexType>
>      <xs:all>
>         <xs:element name="identifier" type="xs:string"/>
>         <xs:any processContents="lax"/>
>       </xs:all>
>    </xs:complexType>
> </xs:element>
> 
> If yes, I can say that I get an error saying that the xml 
> schema is not valid.
> 
> Regards. Yvan
> 
> -----Original Message-----
> From: Markus Seibold
> To: 'Hess Yvan'; xmlschema-dev@w...
> Sent: 11.03.04 22:33
> Subject: RE: Problem designing complexType accepting a 
> specified element and
> a 	llowing any others
> 
> 
> Hi Yvan,
> try <all> instead of <sequence>. This element allows the 
> elements to appear in random order but element declarations 
> within the all container cannot contain maxOccurs="unbounded" 
> but only maxOccurs="1".
> 
> Markus
> 
> > -----Original Message-----
> > From: xmlschema-dev-request@w...
> > [mailto:xmlschema-dev-request@w...] On Behalf Of Hess Yvan
> > Sent: Donnerstag, 11. M=E4rz 2004 20:45
> > To: 'xmlschema-dev@w...'
> > Subject: Problem designing complexType accepting a specified 
> > element and a llowing any others
> > 
> > 
> > 
> > I want to design a complexType named "metadata" that forces
> > the presence of an "identifier" element and allows any others 
> > elements not predefined. Moreover the "identifier" and the 
> > others elements can appear in any order into the "metadata" 
> > element. Here are examples of valid xml instances:
> > 
> > <metadata xmlns="http://www.imtf.com/test">
> >   <identifier>urn:hsc:1234</identifier>
> >   <name>Hess Yvan</name>
> > </metadata>
> > 
> > <metadata xmlns="http://www.imtf.com/test">
> >   <subject>This is the subject</subject>
> >   <identifier>urn:hsc:1234</identifier>
> > </metadata>
> > 
> > I implemented the following xml schema but it doesn't work:
> > 
> > <xs:element name="metadata">
> >   <xs:complexType>
> >     <xs:choice minOccurs="0" maxOccurs="unbounded">
> >       <xs:element name="identifier" type="xs:string"/>
> >       <xs:any processContents="lax" minOccurs="0"
> > maxOccurs="unbounded"/>
> >     </xs:choice>
> >   </xs:complexType>
> > </xs:element>
> > 
> > 
> > I get the following error with Xerces validation and a
> > similar one with XSV (I violated the "Unique Particle 
> Attribution"). 
> > 
> > [Error] choice.xsd:4:23: cos-nonambig:
> > "http://www.imtf.com/test":identifier
> > and
> >  WC[##any] (or elements from their substitution group) 
> > violate "Unique Particle Attribution". During validation 
> > against this schema, ambiguity would be created for those two 
> > particles.
> > choice.xml: 571 ms (3 elems, 1 attrs, 0 spaces, 30 chars)
> > 
> > If I change my xml schema using sequence instead of choice 
> as follow:
> > 
> > <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>
> > 
> > it works but in this case the "identifier" element must be at
> > the FIRST position and I don't want that !!! 
> > 
> > Please can you help me to solve this problem. I have no idea
> > how to solve it !!!
> > 
> > Regards. Yvan Hess
> > 
> > --------------------------------------------------------
> > XML file:
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <metadata xmlns="http://www.imtf.com/test"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:schemaLocation="http://www.imtf.com/test choice.xsd">
> >    <identifier>urn:hsc:1234</identifier>
> >    <name>Hess Yvan</name>
> > </metadata>
> > 
> > --------------------------------------------------------
> > XML schema file:
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xs:schema targetNamespace="http://www.imtf.com/test"
> > xmlns="http://www.imtf.com/test"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > elementFormDefault="qualified" =
attributeFormDefault="unqualified">
> >    <xs:element name="metadata">
> >       <xs:complexType>
> >          <xs:choice minOccurs="0" maxOccurs="unbounded">
> >             <xs:element name="identifier" type="xs:string"/>
> >             <xs:any processContents="lax" minOccurs="0" 
> > maxOccurs="unbounded"/>
> >          </xs:choice>
> >       </xs:complexType>
> >    </xs:element>
> > </xs:schema>
> > 
> > 
> > 
> > 
> 
> 

From mik@f...  Thu Mar 11 17:12:34 2004
Return-Path: <mik@f...>
X-Original-To: xmlschema-dev@l...
Delivered-To: xmlschema-dev@l...
Received: from dr-


transparent
Print
Mail
Digg
delicious
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