Re: [xml] Problems with schema validation
- From: Stefan Behnel <stefan_ml behnel de>
- To: Robert Schweikert <robert schweikert mathworks com>
- Cc: xml gnome org
- Subject: Re: [xml] Problems with schema validation
- Date: Fri, 18 Jul 2008 16:26:13 +0200
Hi,
Robert Schweikert wrote:
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.
It passes for me also in 2.6.32. However, the W3C schema validator only
complains when I check the option "check as complete schema", otherwise, it
passes without complaint. Still, libxml2 might be better off considering a
schema it parses a complete one.
Does it complain when you try to validate XML documents with this schema?
Stefan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]