Function Name |
XML Data Target | ||||||||
Category |
XML | ||||||||
Icon |
|||||||||
Description |
Define the XML target data for mapping | ||||||||
Inputs |
|
||||||||
Outputs |
|
||||||||
Properties |
|
Debugging a Data Mapping Transform
When you debug a data mapping using 'Start Debugging F5', the global application Encoding and BOM options are used. These settings can be changed in the application Options from the Tools menu:
'Tools->Options->Environment->File Encoding' drop down list
and
'Tools->Options->Environment->Write Byte Order Marker (BOM)' checkbox
Running a Data Mapping Transform
When you run a data mapping using 'Execute Shift+F5' or when you generate source code (.dll) or an executable (.exe), the output component Encoding and BOM options are used.
Allows XML documents to created within the Data Mapper.
To begin, drag the XML Target component from the XML section of the Component Palette onto a new Data Mapper file.
This will cause the wizard to launch
You need to provide a schema to describe the data that you will be mapping, you can do this using by providing an XSD, DTD or XDR.
If you don't have a schema (i.e. you just have an xml data file) then you can infer a schema from the XML data file (see Inferring an XML Schema (XSD)).
If you infer an XSD from an XML document, then you may have to finesse the XSD manually in the XSD Editor.
The second page contains options relating to the inferring process.
The name of the schema that will be produced (there is no need to add the .xsd extension).
If more than 1 schema file needs to be created, then the schema files will be named <Schema Name>1.xsd, <Schema Name>2.xsd etc
The location where your schema file/files will be written.
The encoding that will be applied to your XML Schema (UTF-8 or UTF-16 are the most commonly used, only change this if you understand encoding).
If the Occurrence property is set to Restricted, the first time elements are encountered in the XML document, the schema declaration is inferred as minOccurs="1".
When attributes are encountered, the schema declaration is inferred as use="required". If the Occurrence property is set to Relaxed, element schema declarations are inferred as minOccurs="0", and attribute schema declarations are inferred as use="optional".
If the TypeInference property is set to Relaxed, the inferred type of elements and attributes in the XML document with simple content is always xs:string.
If the TypeInference property is set to Restricted, more specific types are inferred, such as xs:date, xs:decimal, xs:unsignedByte, and so on.
When you have selected a Schema, the next part of the Wizard will allow you to select the root element or complex type.
Types that are abstract are disabled and grayed out.
Allows you to select the output location for the XML data that this components represents.
No output filename has been provided so one must be provided within the transform using the 'Filename' input, the resulting XML data will be written to the filename taken from the value of this input.
XML Data is written to the filename provided (the filename can be an absolute path or can be a relative path which will be evaluated relative to the transform file)
You can alter the Properties of an XML Writer in the Mapper by right-clicking it and choosing Show Properties. These properties can all be set in the Wizard when you add a Target Data component to the Mapper, but if you need to alter any of them you can do so here.
The General tab allows you to alter the name of the component within your mapping project.
The Structure tab allows you to select a Schema, root element and type for your source data, as well as instructing the Mapper to validate the Schema when it loads it.
The Output tab allows you to select a file to write your mapped data to by default when the Mapper executes. Here you can also specify various aspects of the Mapper output, including tabs, spaces, indentation and encoding.
Now your XML Target Data component should appear in the Mapper as the XML Writer.
You can click to expand and collapse items in the XML Writer as it appears in the Mapper.
You can make connections between the XML Reader and XML Writer once you have them both imported, by clicking and dragging between items.
These connections define which data items in the source are mapped to items in the target.
The component has a root input called 'Filename', each value provided to this is treated as a filename and a new XML document is created.
If the 'Filename' input (and the 'Data' Output) is not connected then the "Default Target Uri" is used (see properties window).
The child inputs are all specific to the XML standard you selected when the component was created.
The Data output returns the resulting XML document as a string. This allows it to be consumed by other components rather than just being written to a file.
If the Data output is connected the Default Target Uri property is ignored.
It is an error to have connections to BOTH the Data output and the Filename input.