Re: Fwd: FW: Problem with MathML3 schema

On 08/12/2014 20:42, Autumn Cuellar wrote:
> Hi,
>
> Tom Magliery at JustSystems seems to have spotted an issue in the MathML
> 3 Schema. I believe he's correct but wouldn't claim to be an XML Schema
> expert. What say you?
>
> Thanks,
> Autumn
>
> *From:* Tom Magliery [mailto:tom.magliery@justsystems.com
> <mailto:tom.magliery@justsystems.com>]
> *Sent:* Friday, December 05, 2014 4:16 PM
> *To:* Autumn Cuellar
> *Subject:* Problem with MathML3 schema____
>
> __ __
>
> Hi Autumn,____
>
> __
>
> __
>
> We think there's an invalid definition in the XSD for MathML 3. The
> issue occurs within mathml3-strict-content.xsd.____
>
> http://www.w3.org/Math/XMLSchema/mathml3/____
>
> On line 65, they define a group, “semantics-ci” and that group includes
> itself on line 72; according to our understanding of XSD this is not
> allowed:____
>
> __ __
>
> ---------------------------------------------------------------------------------____
>
> http://www.w3.org/TR/xmlschema-1/#coss-modelGroup____
>
> __ __
>
> 2 Circular groups are disallowed. That is, within the {particles} of a
> group there must not be at any depth a particle whose {term} is the
> group itself.____
>
> ---------------------------------------------------------------------------------____
>
> __ __
>
> I guess I'll start with: are we misunderstanding something?____
>
> __ __
>
> The XSDs are not normative for MathML, but this sure seems like an error
> that someone would have discovered before. (Then again, I have been on
> the DITA TC long enough to understand/believe that something like this
> could happen.)____
>
> __ __
>
> mag____
>

Hmm reading the XSD spec (always a delight:-) it seems you are right.
I'd be interested to know how you spotted that? Thanks.

The construct is generated by trang as a translation from a recursive
pattern in the Relax NG. Trang can not translate everything and already
the conversion pipeline has some transformations that simplify the Relax
NG before doing the translation. So we could add another....

It seems it got missed because XSV and xmllint -schema (xerces) both
not only accept the schema without warning, they validate using this
construct as intended. So before changing the MathML schema I may make
some enquiries to check the XSD spec does mean to say what it appears to
say. (I am certainly no expert in XSD schema).


The intention was to make <semantics> have a context sensitive content
model so that the first child is only allowed to be semantics again,
or an element that would have been allowed at that point without the
semantics (ci here).

The simplest fix is to drop that and make the same rule as in the DTD
that the first child of semantics can be any MathML (and leave further
requirements to the text of the spec and the relax NG).

Specifically you can change the definition to

    <xs:group name="semantics-ci">
     <xs:choice>
     <xs:element ref="m:ci"/>
     <xs:group ref="m:semantics"/>
     </xs:choice>
    </xs:group>





  That successfully validates

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <bind>
   <csymbol>forall</csymbol>
   <bvar>
   <semantics>
    <ci>x</ci>
    <annotation></annotation>
   </semantics>
   </bvar>
  </bind>
</math>

but it no longer enforces that the content of bvar is a ci, possibly 
annotated, and this would be valid to the XSD (as it is to the DTD)

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <bind>
   <csymbol>forall</csymbol>
   <bvar>
   <semantics>
    <cn>2</cn>               <!-- cn here -->
    <annotation></annotation>
   </semantics>
   </bvar>
  </bind>
</math>

But with the schema as it currently both XSV and xerces declare the 
first one valid and the second invalid.


David

Received on Tuesday, 9 December 2014 11:01:44 UTC