xsd validation error
Posted: Wed Aug 06, 2003 12:16 am
Hi I am trying to validate this document:
<?xml version="1.0" encoding="UTF-8"?>
<contact xmlns="http://www.hunterfam.com/xml/contact"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hunterfam.com/xml/contact
file:/D:/Development/projects/xmlschema/contact.xsd">
<name>Bob Smith</name>
<phone>(123) 456-7890</phone>
</contact>
with this schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.hunterfam.com/xml/contact"
xmlns="http://www.hunterfam.com/xml/contact"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="contact">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="phone" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I am getting this error:
- [ contact.xml] E cvc-complex-type.2.4.a: Invalid content starting with element 'name'. One of '{"":name}' is expected. (4:1)
Can you tell me why?
Thanks,
Whitney Hunter
<?xml version="1.0" encoding="UTF-8"?>
<contact xmlns="http://www.hunterfam.com/xml/contact"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hunterfam.com/xml/contact
file:/D:/Development/projects/xmlschema/contact.xsd">
<name>Bob Smith</name>
<phone>(123) 456-7890</phone>
</contact>
with this schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.hunterfam.com/xml/contact"
xmlns="http://www.hunterfam.com/xml/contact"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="contact">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="phone" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I am getting this error:
- [ contact.xml] E cvc-complex-type.2.4.a: Invalid content starting with element 'name'. One of '{"":name}' is expected. (4:1)
Can you tell me why?
Thanks,
Whitney Hunter