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

2.3 XML Schema

There are several ways to define a schema for an XML document. HydraExpress supports the W3C XML Schema definition language. XML Schema documents are themselves XML. XML Schema offers the ability to express complex document structures. The language includes a large set of primitive datatypes and allows schema designers to create new datatypes based on the primitive datatypes. The XML Schema specifications are available online at the W3C web site.

Classes in a HydraExpress XML binding closely follow the definitions in the schema. For example, given the XML Schema document below:

The default configuration of the HydraExpress code generator creates a C++ XML binding with the structure shown in Figure 2:

Figure 2: C++ classes for the greeting schema

HydraExpress creates classes that closely correspond to the definitions in the schema.

Creating an XML document from the generated classes is simple. The code sample below is a complete program that creates an XML document that follows the schema above:

The program produces the output shown below:

Reading an XML document with HydraExpress is equally simple. The code sample below unmarshals an XML document into a Greeting object, modifies the contents of the object, and then writes the object to the standard output:

The program produces the output shown below:



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.