[xsd-users] Wrong mapping?

Boris Kolpackov boris at codesynthesis.com
Fri May 16 06:32:55 EDT 2008


Hi Bruno,

bruno.marotta at fortis.com <bruno.marotta at fortis.com> writes:

>   <xsd:complexType name="Identifiers">
>     <xsd:sequence>
>       <xsd:element name="type" type="xsd:string" minOccurs="0" />
> 	<xsd:element name="identifier" type="fortis:Identifier" />
>     </xsd:sequence>
>   </xsd:complexType>
>
> [...]
>
> The xsd cxx-tree is mapping the Identifiers type to:
>
>
>     // identifier
>     //
>     typedef ::xml::Identifier identifier_type;
>     typedef ::xsd::cxx::tree::traits< identifier_type, char > identifier_traits;
>
>     const identifier_type&
>     identifier () const;
>
>     identifier_type&
>     identifier ();
>
>     void
>     identifier (const identifier_type& x);
>
>     void
>     identifier (::std::auto_ptr< identifier_type > p);
>
> The question is: Shouldn't the identifier_type be a sequence?

No, the 'identifier' element in the 'Identifiers' type has maxOccurs = 1
and minOccrus = 1 so its cardinality is "exactly one". You can change your
schema like this to get the sequence in the mapping:

<xsd:element name="identifier" type="fortis:Identifier" maxOccurs="unbounded"/>

Boris




More information about the xsd-users mailing list