I have a supplied XSD. I do not know enough about XSD to begin modifying it.
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Dataset">
<xs:complexType>
<xs:sequence>
<xs:element name="Person">
<xs:complexType>
<xs:sequence>
<xs:element name="PayrollNumber" type="String16" maxOccurs="1" minOccurs="1" />
<xs:element name="Surname" type="String50" maxOccurs="1" />
<xs:element name="Name" type="String50" maxOccurs="1" />
<xs:element name="StreetAddress" type="String50" maxOccurs="1" />
<xs:element name="Suburb" type="String20" maxOccurs="1" />
<xs:element name="Skills">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Skill" type="String16" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="HomePhone" type="String14" maxOccurs="1" />
<xs:element name="MobilePhone" type="String14" maxOccurs="1" />
<xs:element name="PagerNumber" type="String14" maxOccurs="1" />
<xs:element name="Email" type="String80" maxOccurs="1" />
<xs:element name="RecordType" type="RecordType" maxOccurs="1" minOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="String16">
<xs:restriction base="xs:string">
<xs:maxLength value="16" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="String50">
<xs:restriction base="xs:string">
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="String20">
<xs:restriction base="xs:string">
<xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="String30">
<xs:restriction base="xs:string">
<xs:maxLength value="30" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="String14">
<xs:restriction base="xs:string">
<xs:maxLength value="14" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="String80">
<xs:restriction base="xs:string">
<xs:maxLength value="80" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="RecordType">
<xs:restriction base="xs:string">
<xs:enumeration value="A" />
<xs:enumeration value="E" />
<xs:enumeration value="D" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
I have the following XML.
<Dataset>
<Person>
<PayrollNumber>1234567</PayrollNumber>
<Surname>Denson</Surname>
<Name>John-Jaime-Winston Junior</Name>
<StreetAddress>Level 5, City Central Tower 2, 121 King William St</StreetAddress>
<Suburb>Mitcham</Suburb>
<Skills>
<Skill>Skill1</Skill>
<Skill>Skill2</Skill>
</Skills>
<HomePhone>08 8888 8888</HomePhone>
<MobilePhone>041 888 999</MobilePhone>
<PagerNumber>111111</PagerNumber>
<Email>[email protected]</Email>
<RecordType>A</RecordType>
</Person>
</Dataset>
The NET file validator works fine with XMLReader.
However if I introduce multiple Person records - ie. a collection the validation fails with Validation error: The element 'Dataset' has invalid child element 'Person'. 0 0
How can I modify my XSD?