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

5.5 The SOAP Parsing Example

The parsing example, soap_main.cpp, demonstrates the use of rwsf::XmlReader to process content from an any element. To use this type of processing, you need to know the exact format of the XML data within the any element so you can know exactly the calls to make on the rwsf::XmlReader object.

This section describes the code in the provided example soap_main.cpp.

The example first creates an instance of the class that represents the SOAP envelope, unmarshals the SOAP document into this instance, then retrieves a string that contains the first element in the SOAP body. The example then uses an instance of rwsf::XmlReader to parse the element.

//1Constructs e as an empty EnvelopeElement instance.
//2Unmarshals xmlContents into e. Note that xmlContents holds the contents of the included soap.xml file.
//3Retrieves the BodyElement contained within e. The SOAP body element holds the content of the SOAP message.
//4Retrieves 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.
//5Retrieves the first element of the vector. The string s is an XML element with arbitrary content, which we parse with our rwsf::XmlReader class.
//6Instantiates an rwsf::XmlReader that reads from the string.
//7Reads the start of the next element in the string. The reader stores information about the element read.
//8Reads the next child node of the current element. The reader stores information about the node read.
//9Writes the qualified name of the last element name read to the standard output. This is the name of the element read on line //7.
//10Reads the next element in the string. The reader stores information about the element read.
//11Writes the qualified name of the last element name read to the standard output. This is the name of the element read on line //10.
//12Reads the next child node of the current element. The reader stores information about the content read.
//13Writes the content of the last element name read to the standard output. This is the content of the element read on line //12.
//14Reads the end of the element started on line //10.
//15Reads the end of the element started on line //7.


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.