Open GoogleCodeExporter opened 9 years ago
Please post a small sample RNG that you convert to DTD that can be used to
reproduce the problem (we should remove the conversion from XML Schema to Relax
NG as that is part of a different project). Add also the DTD fragment that you
expect as the result of converting that RNG file.
Original comment by georgebina76
on 8 Aug 2011 at 12:30
I think I have the same problem when converting from RNG to XSD. More
specifically, I have one attribute defined as required (i.e. not inside an
<optional> element in the RNG), which seems to override all other instances of
that attribute. In the resulting XSD, that attribute is globally defined as
@use="required", when I have set it to be optional in most elements. See also
the recent discussion on TEI-L,
<http://tei-l.970651.n3.nabble.com/ODD-problem-xml-id-missing-or-wrong-usage-in-
XSD-td4024120.html>.
Original comment by martin.d...@gmail.com
on 3 Jul 2013 at 9:54
OK, here's a snippet from my RNG:
<define name="att.global.attribute.xmlid">
<optional>
<attribute name="xml:id">
<data type="ID"/>
</attribute>
</optional>
</define>
<define name="milestone">
<element name="milestone">
<ref name="att.global.attribute.xmlid"/>
</element>
</define>
<define name="glyph">
<element name="glyph">
<attribute name="xml:id">
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"/>
<choice>
<value>x</value>
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"/>
<value>y</value>
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"/>
<value>z</value>
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"/>
</choice>
</attribute>
<empty/>
</element>
</define>
As you can see, the first element references the optional attribute @xml:id,
whereas the second element defines a required attribute @xml:id. This is what I
get when I convert the RNG to XSD via Roma (in the xml.xsd):
<xs:attributeGroup name="id">
<xs:attribute name="id" use="required" form="qualified" type="xs:ID">
<xs:annotation>
<xs:documentation>(identifier) provides a unique identifier for the element bearing the attribute.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:attributeGroup>
<xs:attributeGroup name="id1">
<xs:attribute name="id" use="required" form="qualified">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="x"/>
<xs:enumeration value="y"/>
<xs:enumeration value="z"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:attributeGroup>
So both id and id1 have @use="required", when I wanted id (the first one) to be
optional.
Original comment by martin.d...@gmail.com
on 10 Jul 2013 at 8:39
OK, here's a snippet from my RNG:
<define name="att.global.attribute.xmlid">
<optional>
<attribute name="xml:id">
<data type="ID"/>
</attribute>
</optional>
</define>
<define name="milestone">
<element name="milestone">
<ref name="att.global.attribute.xmlid"/>
</element>
</define>
<define name="glyph">
<element name="glyph">
<attribute name="xml:id">
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"/>
<choice>
<value>x</value>
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"/>
<value>y</value>
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"/>
<value>z</value>
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"/>
</choice>
</attribute>
<empty/>
</element>
</define>
As you can see, the first element references the optional attribute @xml:id,
whereas the second element defines a required attribute @xml:id. This is what I
get when I convert the RNG to XSD via Roma (in the xml.xsd):
<xs:attributeGroup name="id">
<xs:attribute name="id" use="required" form="qualified" type="xs:ID">
<xs:annotation>
<xs:documentation>(identifier) provides a unique identifier for the element bearing the attribute.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:attributeGroup>
<xs:attributeGroup name="id1">
<xs:attribute name="id" use="required" form="qualified">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="x"/>
<xs:enumeration value="y"/>
<xs:enumeration value="z"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:attributeGroup>
So both id and id1 have @use="required", when I wanted id (the first one) to be
optional.
Original comment by martin.d...@gmail.com
on 10 Jul 2013 at 8:41
OK, here's a snippet from my RNG:
<define name="att.global.attribute.xmlid">
<optional>
<attribute name="xml:id">
<data type="ID"/>
</attribute>
</optional>
</define>
<define name="milestone">
<element name="milestone">
<ref name="att.global.attribute.xmlid"/>
</element>
</define>
<define name="glyph">
<element name="glyph">
<attribute name="xml:id">
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"/>
<choice>
<value>x</value>
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"/>
<value>y</value>
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"/>
<value>z</value>
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"/>
</choice>
</attribute>
<empty/>
</element>
</define>
As you can see, the first element references the optional attribute @xml:id,
whereas the second element defines a required attribute @xml:id. This is what I
get when I convert the RNG to XSD via Roma (in the xml.xsd):
<xs:attributeGroup name="id">
<xs:attribute name="id" use="required" form="qualified" type="xs:ID">
<xs:annotation>
<xs:documentation>(identifier) provides a unique identifier for the element bearing the attribute.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:attributeGroup>
<xs:attributeGroup name="id1">
<xs:attribute name="id" use="required" form="qualified">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="x"/>
<xs:enumeration value="y"/>
<xs:enumeration value="z"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:attributeGroup>
So both id and id1 have @use="required", when I wanted id (the first one) to be
optional.
Original comment by martin.d...@gmail.com
on 10 Jul 2013 at 12:14
Original issue reported on code.google.com by
peet...@gmail.com
on 28 Apr 2011 at 7:58