[xsd-users] nillable="true"

Boris Kolpackov boris at codesynthesis.com
Sat Dec 31 03:02:22 EST 2011


Hi Brian,

B Hart <bhartsb at gmail.com> writes:

> I don't understand:
> 
> =::simple_nillable_type<DateTimeBase>/DateTimeBase
>
> what is DateTimeBase? There is no DateTimeBase defined anywhere.

The customization guide actually has an example of exactly this usage
right at the beginning. I don't really see any better way to explain
this, so I am just going to quote the guide:

"
Now what if all we want to do is add a simple function to the names
type? It would be too much work if we had to implement all the code
that gets generated ourselves. Fortunately we don't have to. We can
ask the compiler to generate the standard mapping with a different
name and then inherit our custom type from it:

--custom-type names=/names_base

This would result in the following C++ code:

namespace hello
{
  class names_base;
  class names;

  class names_base
  {
    ...
  };
}

Later, in our implementation of the names class, we can use names_base
as a base. Here is another example:

--custom-type names=::templates::names<names_base>/names_base

This results in the following C++ code being generated:

namespace hello
{
  class names_base;
  typedef ::templates::names<names_base> names;

  class names_base
  {
    ...
  };
}
"

Boris



More information about the xsd-users mailing list