Names and Identifiers
HydraExpress follows the process below to convert XML names to C++ identifiers.
*XML names can contain punctuation that is not allowed in a C++ identifier. HydraExpress replaces any character that cannot be used as a C++ identifier with the _ (underscore) character.
*If the first character of the name for a complex type starts with a lower case letter, the code generator capitalizes the letter for the C++ class name.
*For any constant that identifies the XML name for use by the marshal and unmarshal methods, the code generator capitalizes the first character and appends a suffix that identifies the purpose of the constant.
*For any complex XML element that is a child of another element, named type, or named model group, the parent name is prepended to the XML element or type name to make the C++ class name. This prevents conflicts in naming when elements with the same name appear under two distinct parent structures. Here are some examples:
*An element within a parent element, such as:
<element name="foo">
<complexType>
<sequence>
<element name="bar">
<complexType>...</complexType>
</element>
HydraExpress would generate two classes, Foo, and FooBar.
*An element within a complex type, such as:
<complexType name="foo">
<sequence>
<element name="bar">
<complexType>...</complexType>
</element>
HydraExpress would generate two classes, Foo, and FooBar.
*An element within a named model group, such as:
<group name="foo">
<sequence>
<element name="bar">
<complexType>...</complexType>
</element>
HydraExpress would generate just one class, FooBar, since model groups do not result in a generated class.
*For a schema that contains a target namespace URI
*that defines a namespace with a prefix to the target namespace URI, this prefix is used as the C++ namespace for the generated classes, and a separate directory is generated for each specified namespace. For example, in the schema element declaration below, the po prefix is associated with the URI that matches the value of the targetNamespace attribute, so the classes would be generated within the po namespace.
 
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:po="http://www.example.com/PO1"
targetNamespace="http://www.example.com/PO1">
*that does not define a specific prefix, a C++ namespace is assigned using as a default the name of the schema file, and a separate directory is generated, as described above.
*As part of its internationalization support, HydraExpress allows non-ASCII XML names. See Internationalization for details.
Naming collisions may still occur due to the way that HydraExpress maps XML names to C++. The code generator attempts to work around some of these naming collisions, but does not always find a satisfactory resolution.
If the code generator does not successfully resolve a naming collision, or if the resolution results in an inconvenient name, use the HydraExpress properties file mappings element to specify the class name mapping, as described in Customizing Names and Identifiers.