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

Importing an XML Source Definition

Importing an XML Source Definition

When you import a source definition from an XML schema or DTD file, the Designer can provide an accurate definition of the data based on the description provided in the DTD or XML schema file. When you import a source definition based on an XML file without an associated DTD or XML schema, the XML Wizard determines the types and occurrences of the data based on data represented in the XML file. When you create the XML definition, you can get unexpected results. For example, the Designer might define an inaccurate scale attribute for string columns. If you export the XML source definition and import the definition with the inaccurate scale attributes, errors occur.
After you create an XML source definition, you cannot change the source definition to any other source type. Conversely, you cannot change other types of source definition to XML definitions.
The XML Wizard uses keys to relate the XML views and reconstruct the XML hierarchy. You can choose to generate views and primary keys, or you can create views and specify keys. When you create custom views, you can select roots and choose how to handle metadata expansion.
The XML Wizard saves the XML hierarchy and the view information as an XML schema in the repository. When you import an XML definition, the ability to change the cardinality and datatype of the elements in the hierarchy depends on the type of file you are importing. For example, DTD and XML files do not store datatype information. When you import these files to create an XML definition, you can configure datatype, precision, and scale in the Designer. If you import an XML schema, you can change the precision and scale.
You cannot create an XML source definition from an XML file of exported repository objects.When you import a source definition, the Designer applies a default code page to the XML definition in the repository. The code page is based on the PowerCenter Client code page. You cannot change the code page for an XML source definition, but you can change the code page for an XML target definition after you create it.
Use the XML Wizard to import XML source definitions.
To import an XML file:
  1. Click Sources > Import XML Definition.
    The Import XML Definition dialog box appears.
  2. Click Advanced Options.
    The Change XML Views Creation and Naming Options dialog box appears. Select options to specify how the Designer creates and names XML views.
    The following table describes the XML view options:
    Option
    Description
    Override all infinite lengths
    You can specify a default length for components with undefined lengths, such as strings. If you do not set a default length, the precision for these components sets to infinite. Infinite precision can cause DTM buffer size errors when you run a session with large files.
    Analyze elements/attributes in standalone XML as global declarations
    Choose this option to create global declarations of standalone XML elements or attributes. You can reuse global elements by referencing them in other parts of the schema. When you clear this option, the standalone XML is a local declaration.
    Create an XML view for an enclosure element
    You can create a separate view for an enclosure element if the element can occur more than once and the child elements can occur more than once. An enclosure element is an element that has no text content or attributes but has child elements.
    Pivot elements into columns
    You can pivot leaf elements if they have an occurrence limit. You can pivot elements in source definitions only.
    Ignore fixed element and attribute values
    You can ignore fixed values in a schema and allow other element values in the data.
    Ignore prohibited attributes
    You can declare an attribute as prohibited in an XML schema. Prohibited attributes restrict complex types. When you import the schema or file, you can choose to ignore the prohibited attributes.
    Generate names for XML columns
    You can choose to name XML columns with a sequence of numbers or with the element or attribute name from the schema. If you use names, choose from the following options:
    • When the XMLColumn refers to an attribute, prefix it with the element name. PowerCenter uses the following format for the name of the XML column:
      NameOfElement_NameOfAttribute
    • Prefix the XML view name for every XML column. PowerCenter uses the following format for the name of the XML column:
      NameOfView_NameOfElement
    • Prefix the XML view name for every foreign-key column. PowerCenter uses the following format for the name of a generated foreign key column:
      FK_NameOfView_NameOfParentView_NameOfPKColumn
    Maximum length for a column name is 80 characters. PowerCenter truncates column names longer than 80 characters. If a column name is not unique, PowerCenter adds a numeric suffix to keep the name unique.
  3. Click OK to apply changes.
  4. Choose the type of file to import. You can choose the following options:
    • Import the definition from a local XML file or a URL.
      Create a source definition from an XML, DTD, or XML schema file. If you import an XML file with an associated DTD or schema, the XML Wizard uses the DTD or schema to generate the XML document.
    • Import the definition from a non-XML source or target.
      Use this option to create a source definition from flat file or relational definitions. The new source definition contains one group for each input definition plus a root element group.
  5. Click Next to complete the XML Wizard.

0 COMMENTS

We’d like to hear from you!