[xsd-users] error processing multiple schemas at once

Boris Kolpackov boris at codesynthesis.com
Wed Nov 2 15:27:59 EDT 2011


Hi Eric,

Eric Broadbent <Eric.Broadbent at csr.com> writes:

> So I tried running XSD with multiple schemas: (same command as I used 
> originally but just added the other schemas on the end)
> 
> 	xsd cxx-parser --show-sloc --force-overwrite --show-anonymous 
> --root-element subset_root --generate-test-driver --generate-print-impl 
> --generate-validation --xml-parser expat subset_schema.xsd shared-types.xsd 
> shared-resources xsd 
> 
> This time, it didn't appear to accept the "--root-element" option"
> 
> 	xsd: error: unable to generate the test driver without a global
> element (document root)

When you specify --generate-test-driver, XSD will try to generate a
driver for each schema you passed. If there is no global element in
any of them, then you will get the above error. The solution to this
is to compile the "included/imported" schemas without this option and
then compile the "root" schema (the one that defines the global element)
separately with this option:

xsd cxx-parser --show-sloc --force-overwrite --show-anonymous 
--generate-print-impl  --generate-validation --xml-parser expat 
shared-types.xsd shared-resources.xsd 

xsd cxx-parser --show-sloc --force-overwrite --show-anonymous 
--root-element subset_root --generate-test-driver --generate-print-impl 
--generate-validation --xml-parser expat subset_schema.xsd

Boris



More information about the xsd-users mailing list