The WSIT Tutorial

List of Values

Guideline: A collection such as List<Integer> can be mapped to a list of XML values (that is, an XML schema list simple type) using annotation @XmlList. .NET maps a list simple type to a .NET System.string.

Example: Collection to a list of values using @XmlList

//-- Java code fragment
public PurchaseOrder {
    @XmlList public List<Integer> items;

//-- Schema fragment
<xs:element name="po" type="purchaseOrder">
<xs:complexType name="purchaseOrder">
    <xs:element name="items" minOccurs="0">
            <xs:list itemType="xs:int"/>

//-- XML serialization
    <items> 1 2 3 </items>

// .NET auto generated code from schema
partial class purchaseOrder {
    private string itemsField;

    public string items
        get { return this.itemsField; }
        set { this.itemsField = value; }