[xsd-users] Question about base64-binary types

Eelko de Groot efdegroot at corp.csnet.nl
Wed Jan 4 10:00:37 EST 2006


In the XSD I have an element of type base64Binary:
<xs:element name="BinaryData" type="xs:base64Binary"/>

The xsd tool compiles this to:
namespace xml_schema
{
...
typedef ::xsd::cxx::tree::base64_binary_template< char > base64_binary;
...
}

class MessageDataType : public ::xsd::cxx::tree::type
{
   public:
...
     // BinaryData
     //
     public:
     struct _xsd_BinaryData
     {
       typedef ::xml_schema::base64_binary type_;
       typedef ::xsd::cxx::tree::traits< type_ > traits_;
     };

     public:
     struct BinaryData
     {
       typedef _xsd_BinaryData::type_ type;
     };

     _xsd_BinaryData::type_ const&
     BinaryData () const;

     _xsd_BinaryData::type_&
     BinaryData ();

     void
     BinaryData (_xsd_BinaryData::type_ const&);

     void
     BinaryData (::std::auto_ptr< _xsd_BinaryData::type_ >);
...
};

When I assign a string to the BinaryData member and after that I 
serialize the object I expect the library to encode my string to base64 
encoding. Unfortunately this does not happen.

my code:
...
std::string data("hello");
MessageDataType msg(data);
MessageData(std::cout, ..., ...);
...

How can I let the library to encode/decode the base64Binary elements? Or 
should I use my own base64 encoder/decoder?

Eelko



More information about the xsd-users mailing list