I have an xml and xsd file that is validated correctly (verified at http://xsdvalidation.utilities-online.info/ ).
However, xml does not validate xsd. I think this is because I am not correctly embedding complexType elements in xsd compared to xml. The outer element of people seems to be causing the problem ...
Here is the xml:
<?xml version = "1.0"?> <people> <person> <firstname>Joe</firstname> <lastname>Schmoe</lastname> </person> <person> <firstname>Cletus</firstname> <lastname>Jenkins</lastname> </person> </people>
... and here is xsd:
<?xml version = "1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name = "people"> <xs:complexType> <xs:sequence> <xs:element name = "person"> <xs:complexType> <xs:sequence> <xs:element name = "firstname" type = "xs:string" /> <xs:element name = "lastname" type = "xs:string" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
Ian campbell
source share