j-users@xerces.apache.org
[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?

Thanks,
Marcus


=================== a.xsd ===================
<?xml version="1.0" encoding="UTF-8"?>
   <xs:schema targetNamespace="http://a.com";
       xmlns:xs="http://www.w3.org/2001/XMLSchema";
       elementFormDefault="qualified" attributeFormDefault="unqualified">
       <xs:element name="a">
           <xs:complexType>
               <xs:complexContent>
                   <xs:restriction base="xs:anyType">
                       <xs:sequence>
                           <xs:any namespace="##other"
                                   processContents="lax"
                                   minOccurs="0" maxOccurs="unbounded"/>
                       </xs:sequence>
                   </xs:restriction>
               </xs:complexContent>
           </xs:complexType>
       </xs:element>
   </xs:schema>

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

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


---------------------------------------------------------------------
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>