Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress XML Binding Development Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

5.6 The Trade Parsing Example

The trade_main.cpp example demonstrates the use of classes generated by HydraExpress to process any elements. This example uses the trade.xsd schema to generate classes for the content of the SOAP body. This section describes the code in the example and presents instructions for running the code generator and compiling the example.

The trade example creates an instance of the class that represents the SOAP envelope, unmarshals the SOAP document into this instance, and retrieves a string that contains the first element in the SOAP body, as shown below:

//1

Constructs e as an empty EnvelopeElement instance.

//2

Unmarshals xmlContents into e. Note that xmlContents contains the text included in the trade.xml file.

//3

Retrieves the BodyElement contained within e. The SOAP body element holds the content of the SOAP message.

//4

Retrieves the vector of any elements from the SOAP body element. Since a SOAP body element can contain zero or more any elements, HydraExpress represents the contents of the SOAP body as a vector.

//5

Retrieves the first element of the vector. The string s is an XML element with arbitrary content.

//6

Constructs an empty GetLastTradePrice instance. The namespace qualifation c:: is needed because that is the defined namespace in trade.xsd.

//7

Unmarshals the string s into tp.

//8

Outputs the symbol to standard output.



Previous fileTop of DocumentContentsIndex pageNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo are registered trademarks of Rogue Wave Software, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.