[xsd-users] Trouble getting started

Boris Kolpackov boris at codesynthesis.com
Wed Jul 14 03:06:38 EDT 2010


Hi Alex,

Alex Chamberlain <alex at alexchamberlain.co.uk> writes:
 
> 	<xs:element name="ping"> 
> 		<xs:complexType> 
> [...] 
> 		</xs:complexType> 
> 	</xs:element>
> 
> I have the following code,
> std::auto_ptr<ping_> p = ping(buffer);
> std::cout << "Code: " << p->code() << std::endl;
> 
> I get the following error (among others),
> Error: no matching function for call to ping::ping(std::istringstream&)

The 'ping' element is of an anonymous type so in the generated code
the class is named 'ping' and the parsing/serialization function
names are escaped to 'ping_'. The first line in your code fragment
then should be:

std::auto_ptr<ping> p = ping_(buffer);

 
> I used the following cmd line to generate the header files,
> xsd cxx-tree --generate-serialization --generate-element-type
> --generate-element-map --root-element-all schema.xsd

You specified the --generate-element-type option which actually
suppresses the generation of parsing/serialization functions and
instead results in element types being generated. For more
information on this, see Chapter 2.9, "Mapping for Global Elements"
in the C++/Tree Mapping User Manual: 

http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.9

There is also the 'messaging' example that shows how to use element
types and maps.

If you don't need this functionality and would rather prefer the
parsing functions (so that the above code works), then remove the
--generate-element-* options.

Boris



More information about the xsd-users mailing list