Namespace Mapping
By default, HydraExpress creates classes in a C++ namespace with the same name as the namespace prefix for the XML Schema type. You can customize this behavior to specify a different value to use for the C++ namespace, as well as an XML prefix that is independent of the C++ namespace.
Customizing the C++ Namespace
In the configuration file, use the namespace element’s attribute name to specify the mapping from the namespace URI to the C++ namespace.
The sample below maps the namespace URI http://www.roguewave.com/remap to the C++ namespace CustomNamespace:
 
<rwsf-codegen-project project-name="NamespaceMappingToCPlusPlus">
<mappings>
<namespace uri="http://www.roguewave.com/remap"
name="CustomNamespace"/>
</mappings>
</rwsf-codegen-project>
With this file, HydraExpress maps all elements in the namespace http://www.roguewave.com/remap to classes in the C++ namespace CustomNamespace, regardless of the prefix associated with http://www.roguewave.com/remap in the schema.
If the name attribute is present but empty (i.e. name=""), HydraExpress will use the default mapping.
Customizing the XML Prefix in XML Instance Documents
You can also specify a prefix to be used when marshaling your C++ objects back to XML documents. This may be useful, for instance, if you wish to retain characters in your XML document prefix that are invalid in C++. You can also choose to generate XML instance documents with no prefix at all, useful to avoid unnecessary bloat in very large documents.
Use the prefix attribute on the namespace element to specify a value for your XML prefix.
The sample below marshals the namespace for all C++ objects to an XML prefix CustomPrefix regardless of the prefix associated with http://www.roguewave.com/remap in the schema.
 
<rwsf-codegen-project project-name="NamespaceMappingToXml">
<mappings>
<namespace uri="http://www.roguewave.com/remap"
prefix="CustomPrefix"/>
</mappings>
</rwsf-codegen-project>
Alternatively, you could assign no prefix to indicate that the default namespace should be used:
 
<rwsf-codegen-project project-name="NamespaceMappingToXml">
<mappings>
<namespace uri="http://www.roguewave.com/remap"
prefix=""/>
</mappings>
</rwsf-codegen-project>
Note that overriding the C++ namespace using only the name attribute customizes it for both the C++ namespace and the XML namespace prefix.