why is this XML not validating?
Have the following XSD:
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.org/mytypes" xmlns:tns="http://example.org/mytypes">
<xsd:complexType name="personinfo2">
<xsd:sequence>
<xsd:element name="lastname" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="employee" type="tns:personinfo2"/>
</xsd:schema>
and the following XML file:
<employee xmlns='http://example.org/mytypes'><lastname>smith</lastname></employee>
why is it failing validation with this message?:
"The element 'employee' in namespace 'http://example.org/mytypes' has invalid child element 'lastname' in namespace 'http://example.org/mytypes'. List of possible elements expected: 'lastname'."
Re: why is this XML not validating?
this might not be an issue HERE, but check the fact that you're using single quotes instead of proper quotation marks in you XML file when you declare your namespace.