Re: [xml] libxml2 XML Schema validation limitation

Thanks very much for your reply, Martin. We are using version 2.6.22 and are
on a shared server where I can't get upgraded to the latest version to test
this for some time. I tried searching the mailing list archives for
"redefine" but am getting results that don't even have that word in it, as
well as a message saying "we're re-building the archive search indexes
(again)" so I don't know if that means search is totally broken.

I did some more testing on very simple files that use a redefine and get the
same error messages:

# Error 1: Unimplemented block at xmlschemas.c:10264 on line 0
# Error 1845: Element '{}Book': No
matching global declaration available for the validation root. in
k/htdocs/ on line 2

It obviously can't find the second file (book.xsd). They are in the same
directory, and I even tried putting an absolute path to book.xsd to no
avail. We are also able to get validation to work just fine on an XML file
conforming to just book.xsd.

Here are the files that won't validate in libxml2 (but validate fine with

Schema #1, bookRedefine.xsd:
<xs:schema xmlns:xs="";
elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:redefine schemaLocation="book.xsd">
        <xs:complexType name="bookType">
                    <xs:extension base="bk:bookType">
                            <xs:element name="addedElement"

Schema #2, book.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="";
elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="book" type="bk:bookType"/>
    <xs:complexType name="bookType">
            <xs:element name="title" type="xs:string"/>
              <xs:element name="author" type="xs:string"/>  

XML Instance:
<?xml version="1.0" encoding="UTF-8"?>
<book xmlns=""
    <title>Great Book</title>
    <author>Joe Blow</author>

Adapted version of command used to call the function:
$xml_file = file_get_contents($_FILES['uploadedXMLFile']['tmp_name']);
$xml = new DOMDocument();


It would REALLY help me if anyone could tell me when support for xs:redefine
might be added to libxml2's schema validation.


-----Original Message-----
From: Martijn Faassen [mailto:faassen infrae com] 
Sent: Friday, October 06, 2006 2:19 AM
To: Allison Bloodworth
Cc: xml gnome org
Subject: Re: [xml] libxml2 XML Schema validation limitation


Allison Bloodworth wrote:
We are using libxml2 in our PHP 5 application to do validation of an
imported XML document against an XML schema. I am finding that when I use
one XML Schema document which redefines some elements in a second XML
document, validation always fails.

E.g. UCBEvents.xsd redefines elements in Events_1.9.xsd:

      <xs:redefine schemaLocation="Events_1.9.xsd">

Does anyone know what the limitations of libxml2 are in terms of XML
validation? Is it unable to handle redefines?

While I know nothing much about the implementation or the error you 
report, you should check this same validation with the latest release of 
libxml2 if you haven't already. Various bugs in validation have been 
checked in newer versions, and the versions of libxml2 that ship with 
common linux distributions may not yet be up to date.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]