I’ve getting a very strange behavior when generating my proxy from XSD. Let suppose I’ve following XSD (assume schema tag already placed). I'm using Add Service Reference option to generate proxy.
<xs:complexType name="Segment"><xs:sequence><xs:element name="Legs"><xs:complexType><xs:sequence><xs:element maxOccurs="unbounded" name="Leg"><xs:complexType><xs:sequence><xs:element name="Ticket" type="xs:string" /></xs:sequence></xs:complexType></xs:element></xs:sequence></xs:complexType></xs:element></xs:sequence></xs:complexType>
Now when generating proxy from above XSD I’m getting Types as follows
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.233")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.saffr.com/schema/itinerary")]
public partial class Segment : object, System.ComponentModel.INotifyPropertyChanged {
private SegmentLeg[] legsField;
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=5)]
[System.Xml.Serialization.XmlArrayItemAttribute("Leg", IsNullable=false)]
public SegmentLeg[] Legs {
get {
return this.legsField;
}
set {
this.legsField = value;
this.RaisePropertyChanged("Legs");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
Now problem rose here, I’m expecting that instead of SegmentLeg type it should be Leg. Actually parser is concatenate Segment (main complex type) with child types.
I'm not sure what I'm doing wrong. Any suggestion would be highly appreciable.
/Rizwan