Re: [xml] libxml2 behaves differently on actual <attribute> vs attribute inserted using <ref>



Hi Belgabor,

Thanks for trying this with your validator.

I agree it seems like a bug / inconsistency in libxml2.

I would still be interested to hear comment about this
from other folks.

Regards,
= jatayu



On Thu, Apr 3, 2008 at 3:27 PM, Belgabor <belgabor gmx de> wrote:
Sounds like a bug. My own validator based on rnv tells your snippet xml is valid and the validator that uses libxml2's engine gives me the same error.

Jatayu schrieb:
Hi all,

I used <ref> to reference a predefined attribute in my Relax NG schema,
but I received this error from libxml2:

    "Invalid attribute Title for element Book"

See below schema and xml snippets (notice the <ref name="TitleAttribute"/>
under "Book" element.

I did not get the same error if I directly specify the <attribute>
under "Book", i.e: without using <ref>.

Anyone know why this is the case or what I'm missing?

Any help/comment is very much appreciated.

Regards,
jatayu

=========== test.rng ====================
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
 datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

 <start>
   <element name="Book">
     <ref name="TitleAttribute"/>  <!-- NOTE: I think using ref here
generates error. -->
     <interleave>
       <zeroOrMore>
         <element name="Author">
           <text/>
         </element>
       </zeroOrMore>
     </interleave>
   </element>
 </start>

 <define name="TitleAttribute">
   <attribute name="Title">
     <data type="token"/>
   </attribute>
 </define>

</grammar>
===============================================

=============== test.xml =========================

<Book Title="History101">
 <Author>Joe Joe</Author>
 <Author>Jill Jill</Author>
</Book>

================================================



------------------------------------------------------------------------

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




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