Title: signature
Hello,

Working on a project I just discovered an interesting "feature" in libxml2.

In version of the library prior to 2.7.4 if we had a  relaxng  schema that defines type with additional validation in regular _expression_ format in case when type validation fails library would report two errors:
XML_RELAXNG_ERR_TYPEVAL
XML_RELAXNG_ERR_CONTENTVALID

which is great

But in version starting from 2.7.4 and onwards library reports only
XML_RELAXNG_ERR_CONTENTVALID

Is there a way to get back the old behaviour?

Here is a sample xml and relaxng schema to demonstrate this:
//sample.xml start

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<root xmlns="http://www.idpf.org/2007/opf">
    <items>
        <item href="" />
        <item href="" /> 
    </items>
</root>
//sample.xml end

//sample.rng start
<?xml version="1.0"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         ns="http://www.idpf.org/2007/opf"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

<start>
  <ref name="root-element"/>
</start>

<define name="root-element">
    <element name="root">
        <ref name="items-element"/>
    </element>
</define>
        
<define name="items-content">
  <oneOrMore>
    <ref name="item-element"/>
  </oneOrMore>
</define>

<define name="item-element">
    <element name="item">
        <attribute name="href">
          <data type="anyURI">
            <param name="pattern">[^\s]+.[^\s]+</param>
          </data>
        </attribute>   
        <ref name="item-content"/>
    </element>
</define>

<define name="item-content">
  <empty/>
</define>

<define name="items-element">
    <element name="items">
        <ref name="items-content"/>
    </element>
</define>
</grammar>
//sample.rng end

command line to use:
xmllint --noout --relaxng sample.rng sample.xml

On libxml2 2.7.7 I get this
sample.xml:5: element item: Relax-NG validity error : Element item failed to validate attributes
sample.xml fails to validate

On libxml2 2.7.3 I get this:
sample.xml:5: element item: Relax-NG validity error : Type anyURI doesn't allow value 'something with spaces'
sample.xml:5: element item: Relax-NG validity error : Element item failed to validate attributes
sample.xml fails to validate

Which is a desired behaviour to me.


Thanks,
--
UVCMS logo
Darko Miletić
Chief Software Architect

UVCMS S.R.L.
Buenos Aires: +54 (11) 4831-0385/0389 - New York: +1 (646) 775-2914 - [email protected] - www.uvcms.com


_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to