[xsd-users] nillable="true"

B Hart bhartsb at gmail.com
Fri Dec 30 11:53:37 EST 2011


Hi Boris,

I did read the customization guide, and what was written about
--custom-type was not at all clear to me.

DateTime is a simple type defined in my schema.

simple_nillable_type is to be a templated class wrapper for DateTime.

Template instantiation syntax I'm used is written like:

vector<int> v;

The customization guide says "The *name* component specifies the name of a
type as defined in the schema being compiled", so "--custom-type DateTime="
makes sense.

I don't understand:

=::simple_nillable_type<DateTimeBase>/DateTimeBase

what is DateTimeBase?  There is no DateTimeBase defined anywhere.

The guide says: "The optional *type* component is the name of a C++ type
that should be used instead of the generated type"

That is confusing.  Is the guide saying simple_nillable_type should be used
instead of DateTime???  simple_nillable_type is the name of the class
template.  Are you meaning the name of the instantiated C++ type?  E.G.
vector<int> v; // v would be the instantiated class of vector<int>.

Everything in the schema files as written use DateTime.

E.G. Here's an element defined that is of that type:

<xs:element name="E05_13" type="DateTime" nillable="true"/>

I would expect:
simple_nillable_type<DateTime>
How or why is it DateTimeBase?

Here's the simple schema type defined:

<xs:simpleType name="DateTime">
        <xs:restriction base="xs:dateTime">
            <xs:minInclusive value="1990-01-01T00:00:00"/>
            <xs:maxInclusive value="2030-01-01T00:00:00-05:00"/>
        </xs:restriction>
    </xs:simpleType>

As you can see I'm confused.











On Fri, Dec 30, 2011 at 5:48 AM, Boris Kolpackov <boris at codesynthesis.com>wrote:

> Hi Brian,
>
> B Hart <bhartsb at gmail.com> writes:
>
> > I'm having trouble making sense of what's in ifc.zip.  Files are not
> > commented and there are missing xsd files.
>
> I believe the link to the .xsd files is in one of the earlier emails
> in this thread.
>
>
> > 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?
>
> Not exactly. The nillable-type.hxx header needs some of the built-in
> definitions (as you can see, it includes xml-schema.hxx).
>
>
> > 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?
>
> You need --generate-default-ctor for the *_nillable_type wrappers to work.
>
>
> > 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???
>
> That's how the IFC schemas are organized. You will need just one command
> line (like for ex.xsd) if you have only one schema.
>
>
> > 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>
>
> Please read the customization guide[1] to learn what the argument
> of the --custom-type option means (I realize it is easier to ask me
> to just give you the correct answer but as I mentioned in my previous
> email we don't have the resources to write your application for you).
> That option should be:
>
> --custom-type DateTime=::simple_nillable_type<DateTimeBase>/DateTimeBase
>
> Also make sure that DateTime is a simple type. Otherwise use
> complex_nillable_type.
>
> [1] http://wiki.codesynthesis.com/Tree/Customization_guide
>
> Boris
>


More information about the xsd-users mailing list