如果在XSD restriction 上 容許 mix restriction (mix data type) 呢? 解決方法: 我們可以建立一個simpleType 之後在simpleType 入面使用 union 再把多個simpleType union 在一起 e.g. <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:simpleType name="NumberOrSpecificString"> <xs:union> <xs:simpleType> <xs:restriction base="xs:integer"/> </xs:simpleType> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="HongKong"/> <xs:enumeration value="London"/> <xs:enumeration value="Oxford"/> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType> </xs:schema> Hope you find it useful
2019-10-23
最近公司有一個 project 是要用另外一間公司的 XML Interface 既 Webservice 去做 exchange data. 其實只要這間公司提供 WSDL 既 Address 給我們 這個 project 便很容易完成" 很可惜這間公司不願提供 WDSL file 所以最後便要自己學怎樣在 VB.Net 入面 post XML 去 HTTP 了 便這了這篇筆記了 還記得之前用 WSDL 時 當我 Add 了 Service Reference Visual Studio 便會自動產生了和這 Web service 有關的 .NET Object 和 Connection End Point 一切都十分方便"
2009-08-18