[xml] Problems with schema validation
- From: Robert Schweikert <robert schweikert mathworks com>
- To: xml gnome org
- Subject: [xml] Problems with schema validation
- Date: Fri, 18 Jul 2008 10:09:44 -0400
Hi I am trying to validate xsd files and am running into a problem. I
have a negative test, i.e. a file I know is invalid, yet it passes
validation.
I used the example code from
http://wiki.njh.eu/XML-Schema_validation_with_libxml2 and wrote a short
main routine for the test.
I downloaded the http://www.w3.org/2001/XMLSchema.xsd file to my machine
to avoid any network issues.
So here is the file I am validating and I expect this to fail:
<?xml version="1.0" encoding="utf-8"?>
<!-- Invalid Schema definition used in the XML tools tests (no flip type)-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="person" type="person"/>
<xsd:complexType name="person">
<xsd:sequence>
<xsd:element name="first" type="xsd:flip"/>
<xsd:element name="last" type="xsd:string"/>
<xsd:element name="dob" type="xsd:date"/>
<xsd:element name="phone" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
XSD defines no flip type, thus the validator should complain. I have
libxml2.so.2.6.27 on my Debian 4 box.
Help is appreciated.
Thanks,
Robert
--
Robert Schweikert MAY THE SOURCE BE WITH YOU
(robert schweikert mathworks com) LINUX
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]