Substitution Groups
An XML Schema substitutionGroup defines one or more elements that may be used interchangeably for another element. The substitutable elements must be of the same type as, or a derived type of, the base element type. For example, elements USDate and EuroDate could be defined as belonging to the substitutionGroup for the base element Date. Anywhere in an instance document where the schema allows a Date, the allowable elements become Date, USDate, and EuroDate.
For each defined substitutionGroup, HydraExpress creates get and set methods on the base element. For the above example, the methods getDate() and setDate() would be generated. The get element returns the element value as an instance of the base element type. The set method sets the element value as an instance of the base element type.
Because the actual element name could be the name of the base element or of one of the allowable substitution elements, HydraExpress generates methods to get and set the element name. For the above example, these would be getDateName() and setDateName(). The getDateName() method could return the strings “Date”, “USDate”, or “EuroDate”, depending on the actual element name in the instance document. The setDateName() would be used to set the correct element name before marshaling an instance document.