[xsd-users] nillable="true"
B Hart
bhartsb at gmail.com
Fri Dec 30 02:35:53 EST 2011
Hi Boris,
I'm having trouble making sense of what's in ifc.zip. Files are not
commented and there are missing xsd files.
I understand that the readme file contains three XSD command line
statements, and I now understand that files with the .options extensions
are XSD options and not related to MSVC.
The readme's first XSD command line statement:
xsd cxx-tree --options-file common.options --generate-xml-schema
xml-schema.xsd
This generates has definitions for all the schema built-in types into a
separate .hxx. I noted that the file I originally generated from my NEMSIS
EMSDataSet.xsd had the includes for all .hxx files related to schema
built-in types, and all the type defines for the C++ namespace
"xml_schema". When I regenerate EMSDataSet.hxx and EMSDataSet.cxx I see
that the xml-schema includes and typedefs are no longer embedded, rather
included indirectly via nillable-type.hxx. So I'm assuming that you
generated xml_schema stuff in a separate file just for good organization?
I now understand that ifc.options should contain just the XSD command line
parameters the I would normally use for generating .hxx and .cxx from my
NEMSIS schema. Since I don't use --generate-polymorphic or
--generate-default-ctor I'm not sure whether in my case they're needed or
not?
Per the command line statements:
xsd cxx-tree --options-file common.options --options-file ifc.options ex.xsd
xsd cxx-tree --options-file common.options --options-file ifc.options
--options-file ifc-custom.options --parts 10 IFC2X3.xsd
ex.xsd and IFC2X3.xsd are the missing files I mentioned. I'm assuming that
one of these would correspond to my EMSDataSet.xsd, but I'm not sure which
one, or why there are two steps here instead of one???
So anyway, per my modified versions of two of the files in ifc.zip (I
understand I didn't have to keep the same file names, but kept them the
same while I'm trying to make sense of this):
ifc.options:
--namespace-map http://www.nemsis.org=
--root-element EMSDataSet
#--generate-doxygen
--extern-xml-schema xml-schema.xsd
--generate-default-ctor
--hxx-prologue #include "nillable-type.hxx"
ifc-custom.options:
--custom-type DateTime=::simple_nillable_type<DateTime>
Then I combined command line statements 2 & 3 to be just:
C:\NEMSISReader\NEMSISV2Reader\NEMSIS_XSDs_v2.2.1>xsd cxx-tree
--options-file common.options --options-file ifc.options --options-file
ifc-custom.options EMSDataSet.xsd
when I re-added EMSDataSet.hxx and EMSDataSet.cxx to my project and rebuilt
I get errors like:
Error 2 error C3203: 'simple_nillable_type' : unspecialized class
template can't be used as a template argument for template parameter 'T',
expected a real type
c:\nemsisreader\nemsisv2reader\nemsisv2reader\EMSDataSet.hxx 15918
1 NEMSISV2Reader
Please help, and thanks.
Brian
On Thu, Dec 29, 2011 at 6:17 AM, Boris Kolpackov <boris at codesynthesis.com>wrote:
> Hi Brian,
>
> B Hart <bhartsb at gmail.com> writes:
>
> > The ifc.zip example project you pointed me to is specific to another XSD
> > user's project. I don't understand what exactly you are doing with in
> the
> > .options files, so can you please provide additional instructions on how
> to
> > properly use nillable-type.hxx?
> >
> > The XSDs that I must conform with are found here:
> > http://www.nemsis.org/v2/downloads/emsDataset.html
>
> Unfortunately we don't have the resources to provide detail instructions
> for each specific schema. The mailing list thread I mentioned in my
> previous reply shows how to do this for some schema and the same idea
> can be equally applied to other schemas. In short, the approach uses the
> type customization mechanism in C++/Tree[1] to wrap each type that is
> used in a nillable element with a C++ class template that provides the
> nillable semantics. Also if you have a specific question about any part
> of the implementation, please feel free to ask.
>
> [1] http://wiki.codesynthesis.com/Tree/Customization_guide
>
> Boris
>
More information about the xsd-users
mailing list