[xsd-users] Mpeg-7 schema support? Problem:

Boris Kolpackov boris at codesynthesis.com
Mon Nov 13 11:11:41 EST 2006


Hi Mattis,


Mattis Fjallstrom <mattis at acm.org> writes:

> Thank you. I understand the problem much better now. I'm still surprised
> that the mpeg-7 schema would have a problem like this ... it is supposed
> to be some sort of standard, after all. :-) I'll see if I can find an
> email address to ask an expert on mpeg-7 as well. If I find something,
> I'll let you know.

I finally got around to checking the mpeg-7 schemas and it seems they
indeed violate the UPA rule. Consider this fragment from mds-2001.xsd,
line 3999:

<sequence>
  <choice>
    <element name="CompositionShot" type="mpeg7:CompositionShotType"/>
    <element name="CompositionShotRef" type="mpeg7:ReferenceType"/>
  </choice>
  <sequence minOccurs="0" maxOccurs="unbounded">
    <choice>
      <element name="CompositionTransition" type="mpeg7:CompositionTransitionType"/>
      <element name="CompositionTransitionRef" type="mpeg7:ReferenceType"/>
    </choice>
    <choice>
      <element name="CompositionShot" type="mpeg7:CompositionShotType"/>
      <element name="CompositionShotRef" type="mpeg7:ReferenceType"/>
    </choice>
  </sequence>
  <choice minOccurs="0">
    <element name="CompositionTransition" type="mpeg7:CompositionTransitionType"/>
    <element name="CompositionTransitionRef" type="mpeg7:ReferenceType"/>
  </choice>
</sequence>

In particular the last sequence and choice. When parser sees a
CompositionTransition element it does not know (without looking ahead)
which branch it happens to belong (sequence of choice).

It is interesting to note that quite a few XML Schema processors report
that this schema is valid. In particular I tried Xerces-J, Jing, and MSV
from this service:

http://www.mel.nist.gov/msid/validation/

All three of them reported that the schema is valid. I was wondering how
they were going to handle an instance for such a schema so I created a
small test schema that reproduces the questionable structure found in
the mpeg-7 schemas:

<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:t="test"
        targetNamespace="test">

<complexType name="ShotEditingTemporalDecompositionType">
  <sequence>
    <sequence minOccurs="0" maxOccurs="unbounded">
      <choice>
        <element name="CompositionTransition" type="string"/>
        <element name="CompositionTransitionRef" type="string"/>
      </choice>
      <choice>
        <element name="CompositionShot" type="string"/>
        <element name="CompositionShotRef" type="string"/>
      </choice>
    </sequence>
    <choice minOccurs="0">
      <element name="CompositionTransition" type="string"/>
      <element name="CompositionTransitionRef" type="string"/>
    </choice>
  </sequence>
</complexType>

<element name="root" type="t:ShotEditingTemporalDecompositionType"/>

</schema>

And a test XML instance document:

<?xml version="1.0"?>
<t:root xmlns:t="test"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="test test.xsd">

  <CompositionTransition>a</CompositionTransition>

</t:root>

Again, the above three processors all reported that the schema is valid.
However, when I tried to validate the instance against the schema all of
them failed saying that the instance is not valid (all of them assumed
the first branch and expected to see CompositionShot or CompositionShotRef
elements). Strangely enough, after reporting that the instance is not
valid, Jing also reported that the schema violates the UPA rule:

~/test.xsd:4:58: error: cos-nonambig: "":CompositionTransition and
"":CompositionTransition (or elements from their substitution group)
violate "Unique Particle Attribution".


hth,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061113/84447f8f/attachment.pgp


More information about the xsd-users mailing list