Liquid Studio 2021
Data Mapping / Data Mapper Functions / By Category / XML / Xml Target File
In This Topic
    Xml Target File
    In This Topic
    Function Name
    XML Data Target
    Category
    XML
    Icon
    XML Target
    Description
    Define the XML target data for mapping
    Inputs
    Filename

    If this connection point is connected then each value is used as the filename for the XML document.
    Filenames must be local or UNC paths.
    Not visible in Simple View.

    Child Elements Nodes; Elements, Attributes and Values in the target XML data
    Outputs
    Data The raw XML data (does not need to be connected)
    Properties
    Encoding The text encoding applied to the XML document
    Write BOM When true a UTF Byte Order Marker (BOM) is written at the start of the file.
    Write XML Declaration When true the XML declaration ( <?xml version="1.0" ... > ) is added to the output XML data
    Execution Order If the transform contains multiple Output Components then this determines the order in which they are executed

    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.

    Usage

    Allows XML documents to created within the Data Mapper.

    Creating an XML data target

    To begin, drag the XML Target component from the XML section of the Component Palette onto a new Data Mapper file.

    XML Data Target Component

    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.

    Schema Name

    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 

    Output Directory

    The location where your schema file/files will be written.

    Encoding

    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).

    Occurrence Options

    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".

    Type Inference Option

    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 default XML Data

    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.

    Write XML data to this file

    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)

    Properties

    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.

    XML Writer Properties

    The General tab allows you to alter the name of the component within your mapping project.

    General Properties

    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.

    Structure Properties

    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.

    Output Properties

    By right-clicking the input items in your XML Writer, you can control Layout and View properties.

    Example

    Now your XML Target Data component should appear in the Mapper as the XML Writer.

    XML Writer

    You can click to expand and collapse items in the XML Writer as it appears in the Mapper.

    XML Writer

    You can make connections between the XML Reader and XML Writer once you have them both imported, by clicking and dragging between items.

    XML Reader to XML Writer

    These connections define which data items in the source are mapped to items in the target.

    Connection Between Reader and Writer

    Inputs

    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.

    Outputs

    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.

     

    See Also