2012-04-15 26 views
1

我創建了一個Web引用(也試過服務引用)的WSDL是有一個xsd裏面以下節點:VB.NET不區分大小寫的Web引用計數問題

<xs:element name="filter"> 
    <xs:complexType> 
     <xs:choice minOccurs="0" maxOccurs="unbounded"> 
     <xs:element minOccurs="0" maxOccurs="unbounded" ref="condition" /> 
     <xs:element minOccurs="0" maxOccurs="unbounded" ref="filter" /> 
     </xs:choice> 
     <xs:attribute default="and" name="type"> 
     <xs:simpleType> 
      <xs:restriction base="xs:NMTOKEN"> 
      <xs:enumeration value="and" /> 
      <xs:enumeration value="or" /> 
      <xs:enumeration value="AND" /> 
      <xs:enumeration value="OR" /> 
      </xs:restriction> 
     </xs:simpleType> 
     </xs:attribute> 
     <xs:attribute default="false" name="not" type="xs:boolean" /> 
    </xs:complexType> 
    </xs:element> 

當客戶端代理類被創建產生此:

'''<remarks/> 
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.225"), _ 
System.SerializableAttribute(), _ 
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true, [Namespace]:="urn://wsc.acme.com/dm/2010/02/02")> _ 
Public Enum filterType 

    '''<remarks/> 
    [and] 

    '''<remarks/> 
    [or] 

    '''<remarks/> 
    [AND] 

    '''<remarks/> 
    [OR] 
End Enum 

這不會建立在VB項目,因爲VB.NET不區分大小寫。我嘗試刪除一組和/或,但是當創建XML時,它只是忽略所選的值。我也嘗試在一個失敗的集合結尾附加一個X.

有沒有辦法讓這項工作?我也嘗試更新XSD,所以它只有兩個值沒有成功。有趣的是,默認設置爲「and」,並在調試時將其設置爲,它實際上並不生成剛生成的節點屬性。

回答

0

你根本不能有兩個具有相同名稱的枚舉。您可以嘗試設置AllowMultiple屬性,但您遇到的問題仍然會發生。我的建議是刪除原始XSD中的重複值並重建。