[xsd-users] Accessing xml:base: Migration to xsd 3.2.0

Boris Kolpackov boris at codesynthesis.com
Mon Dec 1 07:06:20 EST 2008


Hi Jeroen,

Jeroen N. Witmond [Bahco] <jnw at xs4all.nl> writes:

> - In file custom-xmlbase/xml-base.cpp[1, item 3][3] I noticed that in
>   constructor 'xml_base::xml_base(::xsd::cxx::tree::type& type,
>   ::xml_schema::flags f)' the call to '::xsd::cxx::xml::dom::parser<
>   wchar_t > p' now takes two additional boolean arguments. I assume
>   based on the code generated by xsd for program explicit[1, top left]
>   that in this case these booleans should be true.  Is this correct?

This is what happens when you rely on implementation details. The
dom::parser class is not really meant for public use. We have made
some optimizations for 3.2.0 and its c-tor has changed to include
two flags indicating whether the element being parsed is expected
to have elements and attributes, respectively.


> - When compiling the sources for programs parser-datamodel[2, bottom
>   left] and parser-anytype[2, bottom right] I get warnings and errors
>   like:
> 
> [...]
> 
>     'xsd::cxx::parser::parser_base<char>' is an ambiguous base of
>     'metadox::foo_type_pimpl'

Hm, this is the result of our work on reducing the use of virtual
inheritance. While it helped a lot in minimizing object code size,
it made the technique that you are using unavailable. I can see
two ways to resolve this off the top of my head. First would be to
override _start_element() and _end_element() in each _pimpl class.

The second approach is to use a class template, for example:

template <typename B>
struct common_base: virtual B
{
  virtual void
  _start_element (const xml_schema::ro_string& ns,
                  const xml_schema::ro_string& n);

  virtual void
  _end_element (const xml_schema::ro_string& ns,
                const xml_schema::ro_string& n);
};

You would then add it to your _pimpl classes like so:

class foo_pimpl: common_base<foo_pskel>
{
  ...
};

Boris




More information about the xsd-users mailing list