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

Mattis Fjallstrom mattis at acm.org
Mon Nov 13 18:59:24 EST 2006


Hi Boris,

Thank you very much. This is very interesting - the code I am dealing 
with is currently using Xerces, as a SAX parser, and that works. For our 
application, however, SAX is a poor choice. I'd like to switch to a data 
binding model of some sort ... that's why I wanted to use xsd.

I will see if I can find someone on the mpeg-7 side of things and inform 
them of this. They might want to know.

Again, thank you so much for your time. I really appreciate it.

Cheers,

Mattis


Boris Kolpackov wrote:
> 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



More information about the xsd-users mailing list