Table of Contents

Search

  1. Preface
  2. XML Concepts
  3. Using XML with PowerCenter
  4. Working with XML Sources
  5. Using the XML Editor
  6. Working with XML Targets
  7. XML Source Qualifier Transformation
  8. Midstream XML Transformations
  9. Appendix A: XML Datatype Reference
  10. Appendix B: XPath Query Functions Reference

XML Guide

XML Guide

Substitution Groups

Substitution Groups

Use substitution groups to replace one element with another in an XML file. For example, if you have addresses from Canada and the United States, you can create an address type for Canada and another type for the United States. You can create a substitution group that accepts either type of address.
The following schema fragment shows an Address base type and the derived types CAN_Address and USA_Address:
<xs:complexType name="Address">    <xs:sequence>       <xs:element name="Name" type="xs:string" />       <xs:element name="Street" type="xs:string"        minOccurs="1" maxOccurs="3" />       <xs:element name="City" type="xs:string" />    </xs:sequence> </xs:complexType> <xs:element name="MailAddress" type="Address" /> <xs:complexType name="CAN_Address">    <xs:complexContent>    <xs:extension base="Address">       <xs:sequence>       <xs:element name="Province" type="xs:string" />       <xs:element name="PostalCode" type="CAN_PostalCode"/>       </xs:sequence>    </xs:extension>    </xs:complexContent> </xs:complexType> <xs:complexType name="USA_Address">    <xs:complexContent>    <xs:extension base="Address">       <xs:sequence>       <xs:element name="State" type="USPS_StateCode" />       <xs:element name="ZIP" type="USPS_ZIP"/>       </xs:sequence>    </xs:extension>    </xs:complexContent> </xs:complexType> <xs:element name="AddrCAN" type="CAN_Address" substitutionGroup="MailAddress"/> <xs:element name="AddrUSA" type="USA_Address" substitutionGroup="MailAddress"/>
CAN_Address includes Province and PostalCode, and USA_Address includes State and Zip. The MailAddress substitution group includes both address types.

0 COMMENTS

We’d like to hear from you!