-1
我創建針對輸入的XML在我的主要要求是做一個模式或者ParcelNumber
或WorkArea
強制性所以這裏是我的輸入XMLXSD架構錯誤無效的含量被發現開始元素,無子元素,預計在這一點上
<?xml version="1.0" encoding="utf-8"?>
<NOCPlantMapRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<NOCTypeID>0</NOCTypeID>
<WorkLocation>
<ParcelNumber>4545</ParcelNumber>
<Roads>
<WorkLocationRoad>
<RoadName>chennai road</RoadName>
</WorkLocationRoad>
</Roads>
<WorkArea>
<WorkArea>
<Coordinates>
<WorkLocationCoordinate>
<CoordinateX>56</CoordinateX>
<CoordinateY>23</CoordinateY>
</WorkLocationCoordinate>
</Coordinates>
<Communities />
</WorkArea>
</WorkArea>
</WorkLocation>
</NOCPlantMapRequest>
和以下是我創建驗證XML
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified"
elementFormDefault="qualified">
<xsd:element name="NOCPlantMapRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="NOCReference" minOccurs="0" type="xsd:string" />
<xsd:element name="NOCTypeID" minOccurs="0" type="xsd:unsignedByte" />
<xsd:element name="NOCTypeName" minOccurs="0" type="xsd:string" />
<xsd:element name="ApplicationName" minOccurs="0" type="xsd:string" />
<xsd:element name="Applicationtype" minOccurs="0" type="xsd:string" />
<xsd:element name="RelatedNOCRefNumber" minOccurs="0" type="xsd:string" />
<xsd:element name="WorkLocation" minOccurs="1" maxOccurs="1" type="LocationType">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="LocationType">
<xsd:choice>
<xsd:sequence>
<xsd:element name="ParcelNumber" type="ParcelNumberType" />
</xsd:sequence>
<xsd:sequence>
<xsd:element name="WorkArea" type="WorkAreaType" />
</xsd:sequence>
</xsd:choice>
</xsd:complexType>
<xsd:simpleType name="ParcelNumberType">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:complexType name="WorkAreaType">
<xsd:sequence>
<xsd:element name="WorkArea" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Coordinates" minOccurs="1" type="CoordinatesType" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CoordinatesType">
<xsd:sequence>
<xsd:element name="WorkLocationCoordinate" type="WorkLocationCoordinateType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="WorkLocationCoordinateType">
<xsd:sequence>
<xsd:element name="CoordinateX" type="xsd:string" />
<xsd:element name="CoordinateY" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
架構但像
IAM得到錯誤我檢查Visual Studio和xml-xsd validation tool
難道你沒有[**只是問這個問題**](http://stackoverflow.com/q/33183835/290085)?如果所有來自Abel的人都非常善於幫助解決XSD問題,但無法解決您的問題,您應該重新檢查您是如何提出問題的。 stackoverflow.com/help/how-to-ask)。 – kjhughes