DR 10-0030 Schemas: Clearly state the differences between XSD schemas and RNG schemas.
MURATA Makoto (FAMILY Given)
eb2m-mrt at asahi-net.or.jp
Sun Jan 16 03:24:30 CET 2011
Dear colleagues,
I slightly modified my proposal in reply to Caroline and Chris. I am
looking forward to comments from RNG experts in WG4.
Cheers,
Makoto
In Appendix B (informative) of Part 1, add:
Differences between RELAX NG schemas and W3C XML Schema schemas in Part 1
RELAX NG schemas in Appendix B are generated from W3C XML Schema
schemas (Annex A), namespace prefix mapping (Annex D), Root Element
Locations (Annex L), automatically, and then slightly changed by
hand.
There are some important differences between the RELAX NG schemas and
XSD schemas. This annex clarifies differences in schema
organizations and those in expressed constraints.
1) Differences in schema organizations
There is a RELAX NG schema (for example, DrawingML_Chart.rnc)
dedicated to each OPC part (for example, DrawingML Chart). It
includes all RELAX NG schema modules such as dml-chart.rnc. However,
there are no such W3C XML Schema schemas dedicated to each OPC part.
Some schema modules in W3C XML Schema import other schema modules.
There is a RELAX NG schema xml.rnc, which captures xml:lang,
xml:space, xml:base, and xml:id. However, there are no such W3C XML
Schema schemas.
2) Differences in expressed constraints
The RELAX NG schemas specify root elements of each OPC part, while the
XSD schemas do not. For example, DrawingML_Chart.rnc specifies that
the root element of the OPC part DrawingML Chart is a chartSpace
element.
The RELAX NG schemas do not specify default values, while the XSD
schemas do. For example, dml-ahrt.rnc does not specify a default
value for the attribute val in dchrt_CT_Boolean, but merely provides a
comment about the default value. Meanwhile, dml-chart.xsd specifes
true as the default value of this attribute in CT_Boolean.
The RELAX NG schemas mimic minOccurs="0", minOccurs="1",
maxOccurs="1", and maxOccurs="unbounded" in XSD schemas exactly, but
do not mimic minOccurs="32" or maxOccurs="256". Such minOccurs and
maxOccurs are loosely simulated by + or *. For example, dml-chart.xsd
specifies maxOccurs="2" for the element errBars in CT_ScatterSer,
while dml-chart.rnc specifies * for this element in
dchrt_CT_ScatterSer.
The RELAX NG schemas use the & operator for allowing different
elements without specifying constraints on their sequences, but it is
not always possible to use the xsd:all construct in W3C XML Schema. For
example, wml.rnc uses the & operator in w_EG_RPrBase, but wml.xsd does
not use xsd:all in EG_RPrBase.
In Appendix B (informative) of Part 4, add:
Differences between RELAX NG schemas and W3C XML Schema schemas in Part 4
On top of the differences described in Part 1, Appendix B, there are
some other differences.
The RELAX NG schemas represent co-occurrence constraints between
elements and attributes. For example, pml.rnc specifies that the pic
element and the attribute spid in p_CT_OleObject are mutually
exclusive. Meanwhile, pml.xsd simply allows both in CT_OleObject.
VML drawing parts (Part 4, 8.1) can be validated against RELAX NG
schemas, but cannot be validated against XSD schemas. This is because
there are no XSD schemas for the unqualified xml element, which is the
root element of VML drawing parts.
Cheers,
Makoto
More information about the sc34wg4
mailing list