AW: [xsde-users] invalid #include statements in generated code

Christian Sell christian at gsvitec.com
Mon Nov 10 11:04:21 EST 2014


There is no import directive like you mention. In fact, there isn't even a
schema that imports odb.xsd at all (odb imports amf, as shown in my
"diagram").

Again:

viewmodel.xsd: 
	import "vmf.xsd"
	import "amf.xsd"
vmf.xsd:
	import "amf.xsd"
odb.xsd: 
	import  "amf.xsd"

I tried to call xsde separately for odb.xsd, which avoids the invalid
#include. However, the resulting parser is then not able to detect types
defined in odb.xsd, even though they are derived from a type defined in in
amf.xsd (and part of a substitutionGroup). Am I making sense?

Thanks,
Christian

-----Ursprüngliche Nachricht-----
Von: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Gesendet: Montag, 10. November 2014 10:50
An: Christian Sell
Cc: xsde-users at codesynthesis.com
Betreff: Re: [xsde-users] invalid #include statements in generated code

Hi Christian,

Christian Sell <christian at gsvitec.com> writes:

> xsde cxx-hybrid --output-dir gen --generate-parser 
> --generate-aggregate --generate-polymorphic --generate-serializer 
> --no-long-long schema/viewmodel.xsd schema/vmf.xsd schema/amf.xsd 
> schema/odb.xsd
> 
> I get code that has include statements of the following form
>  
> #include "schema/odb_xx.h"

You get this schema/ prefix because the corresponding import directive also
contains this prefix (e.g., it looks something like "schema/odb.xsd").
By default XSD/e keeps these prefixes since that would make everything work
out of the box for multi-directory schemas if the code is generated next to
the schemas. Sometimes, however, this is not what the user wants and for
such cases there is the --include-regex option that allows you to transform
the include directives in any way you want. The example in the manual does
pretty much exactly what you would want:

http://www.codesynthesis.com/projects/xsde/documentation/xsde.xhtml

Boris




More information about the xsde-users mailing list