W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2007

Multiple elements whose name att is the same: Help

From: Aurelio Calegari <aureliocalegari@hotmail.com>
Date: Thu, 17 May 2007 13:14:01 -0300
Message-ID: <BAY130-DAV7485C1571EEBD7016F183B0330@phx.gbl>
To: <xmlschema-dev@w3.org>
Hello,

I'm having a problem to validate the following XSD:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:element name="TransmittalList">
  <xs:complexType>
   <xs:sequence>
    <xs:element name="PublishInformation" type="PublishInformationType" />
    <xs:element name="FixInformation" type="FixInformationType" />
    <xs:element name="ProductInformation" type="ProductInformationType" />
    <xs:element name="FixAttributes" type="FixAttributesType" />
    <xs:element name="Relation" type="RelationTypeDef" minOccurs="0" maxOccurs="unbounded" />
    <xs:element name="File" type="FixFileTypeDef" minOccurs="1" maxOccurs="1" />
    <xs:element name="File" type="StackedFixFileTypeDef" minOccurs="0" maxOccurs="1" />
    <xs:element name="File" type="MetaFileTypeDef" minOccurs="0" maxOccurs="unbounded" />
   </xs:sequence>
  </xs:complexType>
 </xs:element>
(...)


As you can see, I have three entries for name="File". I have an XSD validator that says it violates the "Unique Particle Attribution". I understand it appears to be wrong (the repeating entries above) but I would need to recieve xml that would have <File> entries with different content. I also tryed:

<xs:sequence>
 <xs:element name="PublishInformation" type="PublishInformationType" />
 <xs:element name="FixInformation" type="FixInformationType" />
 <xs:element name="ProductInformation" type="ProductInformationType" />
 <xs:element name="FixAttributes" type="FixAttributesType" />
 <xs:element name="Relation" type="RelationTypeDef" minOccurs="0" maxOccurs="unbounded" />
 <xs:element name="File" type="FixFileTypeDef" minOccurs="1" maxOccurs="1" />
 <xs:choice>
  <xs:sequence>
   <xs:element name="File" type="MetaFileTypeDef" minOccurs="0" maxOccurs="unbounded" />
  </xs:sequence>
  <xs:sequence>
   <xs:element name="File" type="StackedFixFileTypeDef" minOccurs="1" maxOccurs="1" />
   <xs:element name="File" type="MetaFileTypeDef" minOccurs="0" maxOccurs="unbounded" />
  </xs:sequence>
 </xs:choice>
</xs:sequence>

and a number of other combinations and I cannot succesfully validate a xml document which contain more than a file type. Any suggestions on the model?

Thanks very much in advance

Aurelio
Received on Friday, 18 May 2007 02:18:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:59 GMT