I started work on the Xmldoom argument stuff as laid out in my last diary entry. I started workng and things were going well but then I chased this red herring for much too long. The libxml2 Relax-NG validator said:
Extra element string in interleave
RNG validity error: file temp line 7 element string
It led me to believe that I had setup the <interleave/> in my schema wrong. After all, I hadn't quite figured out if I had it right. I want the ability to mix-and-match any number of column types in any order which is something I had lots of trouble with in W3C Schema. And a quick look showed something like this:
<int name="id"/>
<string name="name"/>
<int name="quantity"/>
So obviously I thought the schema wanted <int/>, <int/>, <string/> and was wondering what the hell this <string/> smack in the middle of the <int/>'s was. But alas, a quick run through Sun's MSV and I got a simple:
Element "string" is missing attribute "size".
After seeing this, it all flashed into my head: libxml2 is reported layered errors in reverse order. It has some sort of element order handler that does the <interleave/> and <choice/> tags. This handler makes sure order is good and then passes control to an element handler. This handler sees the missing attribute and says, "validity error: ... element string" and returns to the interleave which exclaims the "Extra element string in interleave." Wow, do these error messages suck. Sun's MSV is such a beautiful peice of code. Unfortunately it is written in Java and licensed under the Apache license. I could provide a hook to allow external validation but this a secondary solution. I know the last thing I need right now is to get side tracked but the best solution would be to fix libxml2. Its LGPL and written in C with a powerful Python wrapper. Everything a man could ever want!