在vs2010中引入了外厂家提供的一个wsdl文件,生成的代理文件中有一个TBStringType类型,由于本人对XML Schema元素定义不是很清楚,请各位帮忙解释一下下面的内容,并确定引用后生成的类定义是否正确。 wsdl文件部分内容:
<xsd:complexType name="TBStringType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="changed" type="ChangeIndicatorType" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType> <xsd:simpleType name="ChangeIndicatorType">
<xsd:annotation>
<xsd:documentation>Boolean flag identifying if a field has a new value</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:boolean">
<xsd:pattern value="1"/>
</xsd:restriction>
</xsd:simpleType>引用该服务后生成的类型
public class TBStringType
{
[System.Xml.Serialization.XmlAttributeAttribute()]
public bool ChangedField { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool ChangedFieldSpecified { get; set; }
[System.Xml.Serialization.XmlTextAttribute()]
public string ValueField { get; set; }
}
<xsd:complexType name="TBStringType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="changed" type="ChangeIndicatorType" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType> <xsd:simpleType name="ChangeIndicatorType">
<xsd:annotation>
<xsd:documentation>Boolean flag identifying if a field has a new value</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:boolean">
<xsd:pattern value="1"/>
</xsd:restriction>
</xsd:simpleType>引用该服务后生成的类型
public class TBStringType
{
[System.Xml.Serialization.XmlAttributeAttribute()]
public bool ChangedField { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool ChangedFieldSpecified { get; set; }
[System.Xml.Serialization.XmlTextAttribute()]
public string ValueField { get; set; }
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货