[xsd-users] Problem accessing basic datatypes behind XML types

Philipp Schmidt philschmidt at gmx.net
Mon Jul 2 04:06:03 EDT 2012


Hello,

I have successfully generated the code from the xsd but now I am stuck while 
trying to access the data. For example I have an optional string type

  typedef ::xml_schema::String NameType;
  typedef ::xsd::cxx::tree::optional< NameType > NameOptional;
  typedef ::xsd::cxx::tree::traits< NameType, char > NameTraits;

  const NameOptional&
  name () const;

  NameOptional&
  name ();

that I now want to store in a QString (std::string throws the same errors, I 
will now list only the std::string stuff). The way I am trying to access the 
data is as follows:

  std::string name = valueReport.name();

which results in the following compiler-error (regardless if I cast to 
std::string or not):

/.../devicemodel_valuedescription.cpp:39:50: error: conversion from ‘const 
NameOptional {aka const xsd::cxx::tree::optional<xsd::cxx::tree::string<char, 
xsd::cxx::tree::simple_type<xsd::cxx::tree::_type> > >}’ to non-scalar type 
‘std::string {aka std::basic_string<char>}’ requested


The same goes for all other datatypes which are either stored as strings or 
integers.

So how do I access the data correctly to store it in Qt4/std datatypes?

Kind regards
Philipp Schmidt


More information about the xsd-users mailing list