Download PDF - Oracle Documentation
Transcript
186
DATA CONTRACTS
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
// C# code generated by svcutil
public partial class purchaseOrder
{
private purchaseOrderItem[] itemField;
System.Xml.Serialization.XmlElementAttribute("item",
Form=System.Xml.Schema.XmlSchemaForm.Unqualified,
IsNullable=true, Order=0)]
public purchaseOrderItem[] item
{
get {
return this.itemField;
}
set {
this.itemField = value;
}
}
// .NET auto generated code from schema
public partial class purchaseOrderItem
{
private string productNameField;
public string productName {
get { return this.productNameField; }
set { this.productNameField = value; }
}
}
@XmlType - xs:all
Guideline: Avoid using XmlType(propOrder=:{}).
@XmlType(propOrder={}) maps a Java class to a
with xs:all content model. Since XML Schema
xs:all, the use of @XmlType(propOrder={}) is
XML Schema complex type
places severe restrictions on
therefore not recommended.
So, the following example shows the mapping of a Java class to xs:all, but the
corresponding .NET code generated by svcutil is omitted.