Friday, 1 August 2014

How to create an XTR file from XML in Delphi XE4 using XML Mapper?

How to create an XTR file from XML in Delphi XE4 using XML Mapper?

By using Delphi XE4 RAD Studio, you can create an XTR file from the given XML file using XML Mapper. XML Mapper Tool is provided in RAD Studio XE4 under Tools -> XML Mapper.

Following are the steps to create an XTR file from XML in Delphi XE4 using XML Mapper:

1. Open the XML Mapper Tools from RAD Studio. 

Now load an XML. In my case I am loading following simple XML:

<?xml version="1.0" encoding="UTF-8"?>

All the nodes will appear on the left section of XML Mapper.

2. Right click on left section and select "Select All Children" option. Transformation will be created on the middle section.

3. Right click on left section again and select "Create Datapacket from XML". You will see the generated datapacket on the right section of the XML Mapper.

4. Hit "Create and Test Transformation" button in the middle section of XML Mapper.

5. Right click on the right section and select "Clear". A popup will appear asking you "Save changes to Transformation to Datapacket?".

6. Click Yes and save that XTR file.

I got following XTR file corresponding to the above XML file:

<XmlTransformation Version="1.0"><Transform Direction="ToCds" DataEncoding="UTF-8"><SelectEach dest="DATAPACKET\ROWDATA\ROW" from="\Parent"><Select dest="@Child1" from="\Child1"/><Select dest="@Child2" from="\Child2"/></SelectEach></Transform><XmlSchema RootName="Parent"><![CDATA[<xs:schema xmlns:xs="">
  <element xmlns="" name="Parent" type="ParentType"/>
  <complexType xmlns="" name="ParentType">
      <element name="Child1" type="Child1Type"/>
      <element name="Child2" type="Child2Type"/>
  <element xmlns="" name="Child1" type="Child1Type"/>
  <simpleType xmlns="" name="Child1Type">
    <restriction base="xs:string"/>
  <element xmlns="" name="Child2" type="Child2Type"/>
  <simpleType xmlns="" name="Child2Type">
    <restriction base="xs:string"/>
</xs:schema>]]></XmlSchema><CdsSkeleton/><XslTransform/><Skeleton><![CDATA[<?xml version="1.0"?><DATAPACKET Version="2.0"><METADATA><FIELDS><FIELD attrname="Child1" fieldtype="string" WIDTH="3"/><FIELD attrname="Child2" fieldtype="string" WIDTH="3"/></FIELDS><PARAMS/></METADATA><ROWDATA/><METADATA><FIELDS><FIELD attrname="Child1" fieldtype="string" WIDTH="3"/><FIELD attrname="Child2" fieldtype="string" WIDTH="3"/></FIELDS><PARAMS/></METADATA><ROWDATA/></DATAPACKET>


  1. This is a great web site. Good sparkling user interface and very informative blogs. I will be coming back in a bit, thanks for the great article. I have found it enormously useful..
    unblockedgames| unblocked games at school| friv 4 school| friv4school| free online games| free online games| tetris games| tetrisgames| monster high games| play monster high games| kizi 2| kizi

  2. A great possibility for me and it was a superb knowledge to view this site. Very difficult to uncover these beneficial web page or web site. I have many devices and achieving proper picture of these worked well and energy continues to be seeing about this weblog. Often my own intend to make my personal site as well as my own enjoyment is growing due to this page. I we do hope you may well be more effective.
    happy wheels| cool math games| 8 ball pool| sudoku| yoob| friv| monster high
    tetris| shooting games| barbie games| friv4school|

  3. Big Farm

    Big Farm is an awesome multiplayer farm management game made by the Goodgame Studios.
    Your mission is simple: Create a big farm, grow crops, breed animals,
    and become the richest farmer of the universe. Enjoy Goodgame's Big Farm!