Transformation settings (DataStage®)
These properties control the values that can be shared by multiple output links of the XML Input stage.
They fall into these categories:
- Requiring the repetition element
- Processing NULLs and empty values
- Processing namespaces
- Formatting extracted XML fragments
Requiring the repetition element
You must specify a repetition element. For each occurrence of the repetition element, the XML Input stage will generate a row.
Processing namespaces
XML Input requires namespace declarations when namespace prefixes are included in XPath expressions. If the input document uses namespaces, the XPath expression must be qualified. That is, a node that belongs to a namespace must have a prefix even if the namespace of the target node is the default namespace.
- Write XPath expressions with namespace prefixes in the Description property of the Columns page of the Output Link Properties page.
- Specify the namespace declarations in a space-delimited
list using the text box.
The syntax is:
xmlns:<
prefix>="<
namespace_url>"
Note: When you load a table definition from the Columns page, XML Input does not load namespace declarations.
Formatting extracted XML fragments
When an XPath expression ends with an element node, XML Input extracts and writes an XML fragment. You may want to generate XML fragments to:
- Preserve sections of the input on an output link.
- Split input that has multiple branches with implicit relationships into separate documents for subsequent processing.
Writing XML
XML Input can write the fragment on the output link as an unformatted or formatted block.
The following XPath ends with an element node:
/customers/customer/address
Unformatted output is the default for writing fragments. For example:
<address><street>1 Main</street><city>Fram</city><state>MA</state>
<zip>01701</zip></address>
Here is the same output, written as a formatted block:
<address>
<street>1 Main</street>
<city>Fram</city>
<state>MA</state>
<zip>01701</zip>
</address>
To generate a formatted fragment, select the Format extracted XML fragments box.