[xml] libxml schema validation - conflict result on attribute validation
- From: "Phuong Nguyen" <shdwstar gmail com>
- To: xml gnome org
- Subject: [xml] libxml schema validation - conflict result on attribute validation
- Date: Mon, 1 May 2006 18:01:49 -0700
I'm trying libxml on a very simple same file and got some rather
conflicting result. I'm still learning schema and libxml so any tip is
much appreciated.
Thanks.
result:
correct/test.xml:2: element sample: Schemas validity error : Element
'{http://www.test.com}sample', attribute 'abc': The attribute 'abc' is
not allowed.
correct/test.xml:2: element sample: Schemas validity error : Element
'{http://www.test.com}sample': The attribute
'{http://www.test.com}abc' is required but missing.
correct/test.xml fails to validate
xsd:
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.test.com" elementFormDefault="qualified"
xmlns ="http://www.test.com">
<xs:attribute name="abc" type="xs:integer"/>
<xs:element name="sample">
<xs:complexType>
<xs:sequence>
<xs:element name="test"/>
</xs:sequence>
<xs:attribute ref="abc" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<sample xmlns="http://www.test.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" abc="23">
<test/>
</sample>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]