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



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>

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


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