[xml] problem with relaxng validation
- From: Lars Oppermann <Lars Oppermann Sun COM>
 
- To: xml gnome org
 
- Subject: [xml] problem with relaxng validation
 
- Date: Tue, 30 Nov 2004 13:06:51 +0100
 
Hi,
I tried to validate some OpenOffice.org documents with xmllint with our 
relaxng schema 
(http://www.oasis-open.org/committees/download.php/6033/office-schema-1.0-cd-1.rng)
xmllint reports the following error when parsing the schema:
element ref: Relax-NG parser error : Found forbidden pattern list//ref
Although it is true, that the relaxng spec constraints refs in lists, 
constraints are only to be applied after simplification has occured. The 
simplification however would resolve the ref.
I suspect, that xmllint might try to check the constraints before the 
grammer is simplified (or the simplification of refs doesn't work as 
described in the specification)
Test case:
The following grammer should be a valid relaxng grammer but is rejected 
by the parser with the message:
test.rng:17: element ref: Relax-NG parser error : Found forbidden 
pattern list//ref
Relax-NG schema test.rng failed to compile
<?xml version="1.0" encoding="UTF-8"?>
<grammar
    xmlns="http://relaxng.org/ns/structure/1.0"
    xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
    datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<define name="pattern1">
    <data type="string">
        <param name="pattern1">-?([0-9]+(\.[0-9]*)?|\.[0-9]+)</param>
    </data>
</define>
<define name="list1">
    <optional>
        <attribute name="attr1" a:defaultValue="1.0">
            <list>
                <ref name="pattern1"/>
            </list>
        </attribute>
    </optional>
</define>
<start>
    <element name="elem1">
        <ref name="list1"/>
    </element>
</start>
</grammar>
--
Lars Oppermann <lars oppermann sun com>               Sun Microsystems
Software Engineer - StarOffice                           Sachsenfeld 4
Phone: +49 40 23646 959                                D-20097 Hamburg
Fax:   +49 40 23646 550                  http://www.sun.com/staroffice
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]