[xml] RelaxNG validation bug when in streaming mode?



I am having a problem with RelaxNG validation in streaming mode.

I set up the xmlReader object with a RelaxNG schema file, then started
parsing a file using streaming.

I have a node with sub-nodes, something like this:

<node>
   <first_subnode attr1="foo" attr2="bar"/>
   <second_subnode>
     <stuff/>
   </second_subnode>
</node>

and the RelaxNG schema requires <first> and optionally <second> be under
<node>.

However, the RelaxNG validator barfs when I reach </node>, and indicates
that it thinks the XML looks like:

<node>
   <second_subnode>
     <stuff/>
   </second_subnode>
</node>

Now, IF I tell the handler for <node> to expand the node, then all is
well - however then I am no longer using streaming, and for my needs I
don't think that will work.

I *think* what is happening is that the reader, upon reaching the end of
the <first_subnode>, is deleting the node, but retaining the enclosing
parent node. Then, when the end of <node> is hit, it calls the
validator, which then fails the node. IF I am correct, then what needs
to happen is that IF the reader is doing RelaxNG parsing, it needs to
save the children nodes of any open node, OR it needs to validate on the
fly and somehow record what it has seen.

Does this seem reasonable?






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