[xsd-users] Parsing the Collada 1.3.1 XSD

Lucas Magder lucasmagder at rogers.com
Sat Dec 3 17:21:07 EST 2005


Thanks for the practically instant and helpful response!

If you can send the prerelease version that would be great, since I could
get started with my importer while I wait for 1.7.0. As for the duplicate
source element, the spec states that there must be at least one source
before any number of sources and vertices entries. I can easily remove the
second one as you did since it will still accept all correct files. Also,
thanks for the --morph-anonymous tip.

-Lucas

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Saturday, December 03, 2005 4:42 PM
To: Lucas Magder
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] Parsing the Collada 1.3.1 XSD

Lucas,

Lucas Magder <lucasmagder at rogers.com> writes:

> COLLADASchema.xsd:3079:29: ice: element 'node' is in unexpected condition

This appears to be a bug in xsd. The 'node' element was recursively
referencing itself and xsd was not prepared to handle such a case.
After fixing this bug I could compile the schema though there was
one more problem. Here is the relevant fragment (line 870):

<xs:element name="mesh">
  <xs:complexType>
    <xs:sequence>
      <xs:element ref="source" minOccurs="1" maxOccurs="unbounded"/>
      <xs:element ref="vertices" minOccurs="1" maxOccurs="1"/>
      <xs:element ref="source" minOccurs="0" maxOccurs="unbounded"/>

      ...

    </xs:sequence>

As you can see, there are two definitions of the 'source' element.
I am not sure if this is intentional or a typo. While it is valid per
XML Schema (though a questionable design), xsd does not yet support
such constructs. If I comment the second reference to 'source' out,
I can compile the schema and then compile the generated code without
any problems. BTW, the schema uses a lot of anonymous types and is
heavily recursive so to avoid code bloat I used --morph-anonymous
options:

$ xsd cxx-tree --morph-anonymous COLLADASchema.xsd


We are planning to release xsd 1.7.0 (which will include the fix for
the bug you found) in a couple of days. If you would like, I can also
send you a pre-release (just let me know if it is ok to send the .zip
via email).

hth,
-boris




More information about the xsd-users mailing list