Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress XML Binding Development Guide

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 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. The example then uses an instance of rwsf::XmlReader to parse the element.

//1

Constructs e as an empty EnvelopeElement instance.

//2

Unmarshals xmlContents into e. Note that xmlContents holds the contents of the included soap.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, which the rwsf::XmlReader class can parse.

//6

Instantiates an rwsf::XmlReader that reads from the string.

//7

Reads the start of the next element in the string. The reader stores information about the element read.

//8

Reads the next child node of the current element. The reader stores information about the node read.

//9

Writes the qualified name of the last element name read to the standard output. This is the name of the element read on line //7.

//10

Reads the next element in the string. The reader stores information about the element read.

//11

Writes the qualified name of the last element name read to the standard output. This is the name of the element read on line //10.

//12

Reads the next child node of the current element. The reader stores information about the content read.

//13

Writes the content of the last element name read to the standard output. This is the content of the element read on line //12.

//14

Reads the end of the element started on line //10.

//15

Reads the end of the element started on line //7.



Previous fileTop of DocumentContentsNo linkNext 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.
Provide feedback to Rogue Wave about its documentation.