[xsd-users] Parsing the Collada 1.3.1 XSD
Boris Kolpackov
boris at codesynthesis.com
Mon Mar 13 14:40:58 EST 2006
Hi Mark,
> On Thu, 2006-01-05 at 20:04 +0200, Boris Kolpackov wrote:
>
> > Marcus writes:
> > >
> > I tried to find COLLADA schema 1.4 but all I can get is 1.3.1. I could
> > run xsd on it see if there are any warnings wrt anonymous types and code
> > bloat.
>
> The 1.4 schema will be released today I expect. It'll be at khronos.org.
We've got most of the capabilities in xsd to compile COLLADA 1.4 schema.
There are still some minor tweaks I had to do:
1. I had to remove default values in lines 4563 and 4564. Xerces-C++
has a bug in its schema processor which prevents this construct from
being handled properly. This is fixed in the Xerces repo and will appear
in the next release.
2. This is actually something that you may want to address in future
revisions: In your schema, you define a bunch of base types (bool,
dateTime, etc.) towards the end of the schema and inherit from those
types before they were defined. We call it "forward inheritance". This
is valid in XML Schema but not in C++. We detect such cases in our
compiler and ask the user to rearrange their schemas. So I moved the
Primitive Types, Container Types and Aggregate Types right on top.
After that I tried to compile it without morphing anonymous types:
$ xsd cxx-tree --generate-polymorphic --root-element-first COLLADASchema_140.xsd
There are still quite a few cases where anonymous types are used for
several elements/attributes and therefore would result in code bloat.
Here is the log which lists all the cases:
http://codesynthesis.com/~boris/tmp/COLLADASchema_140.log
Then I compiled it with --morph-anonymous option (BTW, the second tweak
above is not necessary with this option) and everything worked fine except
that the generated .cxx file was almost 5M and g++ couldn't compile it with
my 2G of RAM. So I had to split the generated code into multiple parts with
the --parts 20 option. After that I could compile individual parts one by
one and link them into one executable. Splitting the schema into several
individual schemas and xsd:include'ing them is something that would make
such splitting unnecessary and also make working with the generated code
more manageable (e.g., one can include only parts that this translation
unit needs).
BTW, COLLADA 1.31 compiles fine (with --morph-anonymous) without any
tweaks.
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/20060313/b864459b/attachment.pgp
More information about the xsd-users
mailing list