[xsd-users] XSD Libraries

Boris Kolpackov boris at codesynthesis.com
Thu Jul 15 10:48:54 EDT 2010


Hi Brad,

Brad Howes <howes at ll.mit.edu> writes:

> I'm working with a set of XML schema files that use GML 3.2 for their 
> base. Everything works fine, but I was wondering if it was possible 
> to generate C++ files for GML 3.2 first and build a library, and then
> when generating the C++ files for the other schema files xsd would
> somehow know to stop generating stuff when it reached GML 3.2 entities
> that have already been generated in the previous step.

This is, of course, trivially possible if one uses the file-per-schema
mode (which is the default). This is just a clarification for other
folks who may be reading this and wondering what's the big deal. The
problem is that GML 3.2 can only be compiled in the file-per-type
mode.

I think it should also be possible in this case provided that your
schemas that reference the GML 3.2 schema do that via the "official
entry point" (e.g., gml.xsd), that is, they only import the GML 
schema files that are complete wrt GML import/include (one of the
reasons why GML 3.2 cannon be compiled in the file-per-schema mode
is that some of its schema files are not valid by themselves; they
reference declarations without the corresponding include/import
statements and which are made "visible" only if these files are
loaded indirectly via the "official entry points").

If this requirement is satisfied, then you can do the following:

1. Compile the GML 3.2 schemas with the --file-per-type options
   and place the generated code into a library.

2. Compile you schemas without the --file-per-type option. The
   resulting generated code will reference header files 
   corresponding to the "official entry point" generated on
   step 1.

Boris



More information about the xsd-users mailing list