[xsd-users] vocabulary-specific types for simple elements

Boris Kolpackov boris at codesynthesis.com
Wed Jan 13 08:47:10 EST 2010


Hi Sumant,

Sumant Tambe <sutambe at dre.vanderbilt.edu> writes:

> I was wondering if there is a way in xsd (tool) to generate classes that  
> wrap simple content such as <xs:element name="price" type="xs:int" />
> As far as I know, the parent class of such an element gets a set of  
> overloaded price() methods that essentially return C++ int. Instead, I  
> was thinking of a class named "price".

No, there is no way to do this. It is also not clear what extra 
functionality such a class would have to justify the overhead.

You can, however, re-map XML Schema built-in types that are by
default mapped to fundamental C++ types to some user defined
types (e.g., int to, say, your class Int). For more information 
on how to do this see the C++/Tree Mapping Customization Guide 
that Bill already referred you to as well as the examples in the
examples/cxx/tree/custom/ directory in the XSD distribution.

Boris



More information about the xsd-users mailing list