[xsd-users] Too many anonymous types

Brian Young ARA/CFD byoung at ara.com
Fri May 23 16:37:59 EDT 2008


Boris,

After stepping up to xerces2.8 and grabbing qzilla, your schema
preprocessor ran without issue. Thank you kindly. I was able to reduce
the generated code size by over 40%, which allowed Visual Studio to
generate the dll. So, now I can start looking at the generated code more
to see if it will suit our purposes. I'll also more closely compare the
transformed schema with the original, but it looks good at first glance.

Now, for the file-per-type issue. I watched the memory usage and got the
same results twice. Slowing climbs to ~650MB, then very quickly climbs
to just under 2GB. Slowly goes back down to ~650MB, slowly backup to
~1GB. Then quickly climbs to around ~2GB before disappearing into the
night forever. So, your assumption about running out of memory may be
correct. 


-Brian Young <brian.young at ara.com>

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Friday, May 23, 2008 11:31 AM
To: Brian Young ARA/CFD
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] Too many anonymous types

Hi Brian,

Brian Young ARA/CFD <byoung at ara.com> writes:

> --file-per-type does work with the small/sample schema sent previously

> in this post. I followed the instructions for using XSD with Visual 
> Studio.
>
> My original schema is currently one big file. Is there anyway to get 
> more output from the code generator when running --file-per-type on a 
> big schema? I do not see the created files (and SLOC) listed in the 
> Visual Studio Output window as I do when running --file-per-type on 
> the small/sample schema.

No, there is no other information produced by XSD. I was running XSD in
the --file-per-type mode with your options on schemas in our schema
repository. I found one biggish schema on which XSD runs out of 2GB of
memory. While it is expected that the compiler will use more memory when
--file-per-type is specified (internally it transforms the schema graph
"as if" each type was defined in a separate schema file) though it
shouldn't use that much memory. So I am going to investigate this. Can
you also check XSD memory usage while it is compiling your big schema
with --file-per-type? If it runs out of memory and the OS kills it then
that would explain the silent failure and no output.

I've also created a sample program to transform your schema:

http://www.codesynthesis.com/~boris/tmp/simplify.zip

I've decided to use XPath to make searching for nodes easier. So you
will need the following libraries to build it:

Xerces-C++ 2.8.0 http://xerces.apache.org/xerces-c/
XQilla 2.1.2     http://xqilla.sourceforge.net/HomePage

It also uses some XSD runtime headers to simplify string conversion,
parsing and serialization. I tested it on the sample schema you provided
(also included in the .zip file) and it seems to work well.
I didn't have much time so the code is a bit hairy. Let me know if you
have any questions/problems with it. Also it would be interesting to
know if this transformation had any noticeable impact on your schema.


Boris




More information about the xsd-users mailing list