[Top] [All Lists]

XML validation with extendable schema

Subject: XML validation with extendable schema
From: "Marcus Wejderot"
Date: Tue, 13 Mar 2007 15:09:03 +0100 CET
I have an XML document that I suspect should not pass validation, but
does. I would very much appreciate some comments on this issue. The
document and schemas are included below. The <a/> element can include any
other element. The processContent attribute is set to "lax", meaning that
content is validated if a schema is found. Since a default schema is
specified, I believe that the <b/> and <c/> element should be validated
according to this schema. In this case, only the <b/> element should be
valid, but the document is considered valid! Is it something I have
missed, or is it a bug in Xerces?


=================== a.xsd ===================
<?xml version="1.0" encoding="UTF-8"?>
   <xs:schema targetNamespace="http://a.com";
       elementFormDefault="qualified" attributeFormDefault="unqualified">
       <xs:element name="a">
                   <xs:restriction base="xs:anyType">
                           <xs:any namespace="##other"
                                   minOccurs="0" maxOccurs="unbounded"/>

=================== b.xsd =====================
<?xml version="1.0" encoding="UTF-8"?>
   <xs:schema targetNamespace="http://b.com";
       elementFormDefault="qualified" attributeFormDefault="unqualified">
       <xs:element name="b" type="xs:string"/>

=================== a.xml =====================
<?xml version="1.0" encoding="UTF-8"?>
<a:a xmlns:a="http://a.com"; xmlns="http://b.com";>

To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>