
On Fri, Jan 18, 2013 at 05:22:32 -0500, Alon Levy wrote:
Hi Eric,
I'm having trouble with the RNG approach. I've created a test rng and test xml with xmllint that can create the problem I am seeing, specifically:
test.rng:
<?xml version="1.0"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <start> <ref name="video"/> </start> <define name="video"> <element name="video"> <optional> <element name="model"> <attribute name="type"> <choice> <value>vga</value> </choice> </attribute> <group> <attribute name="type"> <value>qxl</value> </attribute> <optional> <attribute name="ram"> </attribute> </optional> </group>
The critical part you are missing is that the attribute type=vga and the group containing attribute type=qxl need to be within a choice element. That is: <element name="model"> <choice> <!-- this is important --> <attribute name="type"> <choice> <value>vga</value> ... </choice> </attribute> <group> <attribute name="type"> <value>qxl</value> </attribute> <optional> <attribute name="ram"/> </optional> </group> </choice> ...
<optional> <attribute name="vram"> </attribute> </optional> </element> </optional> </element> </define> </grammar>
Jirka