axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Sosnoski <...@sosnoski.com>
Subject Re: Maximum Interoperability with "Map" objects
Date Tue, 02 Nov 2004 18:20:58 GMT
Dennis Sosnoski wrote:

> It's actually easy to represent this in schema, as:
>
>  <complexType name="map">
>    <sequence>
>      <complexType minOccurs="0" maxOccurs="unbounded">
>        <sequence>
>          <element name="key" type="xsd:string"/>
>          <element name="value" type="xsd:string"/>
>        </sequence>
>      </complexType>
>    </sequence>
>  </complexType>

Whoops, this should instead be:

 <complexType name="map">
   <sequence minOccurs="0" maxOccurs="unbounded">
     <element name="key" type="xsd:string"/>
     <element name="value" type="xsd:string"/>
   </sequence>
</complexType>

You don't need (and can't use) an inner complexType element, but in more 
complex cases can just nest the sequence (or other compositor, such as 
choice or group) directly to get the same effect. So if you wanted a 
leading count element for the number of entries in the mapping you could 
do it like this:

 <complexType name="map">
   <sequence>
     <element name="count" type="xsd:int"/>
     <sequence minOccurs="0" maxOccurs="unbounded">
       <element name="key" type="xsd:string"/>
       <element name="value" type="xsd:string"/>
     </sequence>
  </sequence>
</complexType>

  - Dennis

Mime
View raw message