[xsd-users] toString() method for basic datatypes

Boris Kolpackov boris at codesynthesis.com
Tue Feb 26 04:05:53 EST 2013


Hi Harald,

In the future please keep your replies CC'ed to the xsd-users mailing
list as discussed in the posting guidelines:

http://www.codesynthesis.com/support/posting-guidelines.xhtml

Harald Klingel <h.klingel at gmx.net> writes:

> first of all, many thanks for the whole project. From my point of view, it
> is the best xsd to c++ converter available.

Thanks, I am glad you like it.


> Within the generated classes there are enums. As I code it by myself,
> the enum values are mapped to the value they are related to. But how
> can I get that value if I have the enum value?

The XML Schema enumeration mapping in XSD has dual interface, that of
a C++ enum and of a string.

I assume by "enum value" you mean the C++ enumerator (e.g., color::red)
and by "value they are related to" you mean the string value as in the
schema/XML (e.g., "red"). If that's the case, the you can do from/to
string conversions like this:

color r ("red");
const std::string& s (r);

Boris



More information about the xsd-users mailing list