[xsd-users] Help me: Borland C++ Builder 2007 compiled program has unwanted prefix and all property values are missing.

Boris Kolpackov boris at codesynthesis.com
Mon Oct 12 05:52:21 EDT 2009


Hi James,

James Mei <jxmei3 at gmail.com> writes:

> During compilation, it prompts the follow error:
> 
> [BCC32 Error] SCL.cxx(273): E2093 'operator!' not implemented in type
> 'xsd::cxx::tree::optional<tCommunication>' for arguments of the same type

The optional container implements "conversion to bool" via conversion
to a function pointer. This is the recommended way but it is probably too
much for BCB to handle. You can try to use the simpler but more dangerous
approach by converting directly to bool. For this, change the following
lines in libxsd/xsd/cxx/tree/containers.hxx:

typedef optional self_; // Simplifier for Sun C++ 5.7.
typedef void (self_::*bool_convertible) ();

operator bool_convertible () const
{
  return x_ != 0 ? &self_::true_ : 0;
}

To this:

operator bool () const
{
  return x_ != 0;
}

Note that there are two places in containers.hxx where you need to 
change this.


> Unexpected result 1: All the tags has an "p1:" prefix.

It is automatically assigned since you haven't specified the namespace-
prefix mapping for http://www.codesynthesis.com/xsd/SCL (BTW, you probably
don't want to use www.codesynthesis.com in your XML namespaces; if you need
some dummy domain name, www.example.com is a good choice).

If you want your output XML to look similar to the input, change your
serialization code like so:

xml_schema::namespace_infomap map;
map[""].name = "http://www.codesynthesis.com/xsd/SCL";
map[""].schema = "SCL.xsd";

ofstream outfile(argv[2], ios::out);
SCL_(outfile, *h, map);


Boris



More information about the xsd-users mailing list