How to: |
Syntax:
com.ibi.preemit.XDXMLGpreEmitter
Description:
The iWay Transformations preemitter transforms output through the iWay Transformations tooling. Use this preemitter to transform the output into a desired user-defined format or any other format, such as comma separated values or flat file.
Parameters:
Parameter | Description |
---|---|
Template | Template for conversion. |
Encoding | How to encode output. |
The listed values in the Encoding parameter are as follows.
Name this example XML_to_XML_Sample2.
The Name and Description pane opens.
Name the preemitter XMLG1preemitter.
Add the XMLG1preemitter to the iWay Service Manager. Create an outlet named PreemitterOutlet. Add the XMLGPreemitter to this outlet.
Construct the channel PreemitChannel using a file listener case1 as inlet, a simple move route and the outlet created in the previous step.
This input to this channel is as follows.
<?xml version="1.0" encoding="UTF-8"?> <!-- edited with XML Spy v4.1 (http://www.xmlspy.com) by Tarpan Roy (Home) --> <!--This is an XML Input sample--> <Sales> <Company name="Video and Sound Card Express" type="Computer Parts"> <Year value="2001"> <Quarter value="1st"> <Product type="Video Cards"> <Item name="Ultra Video 5500" manufacturer="Ultra Video" value="234.99" sold="24"/> <Item name="Video Plus" manufacturer="Video Enterprise" value="129.99" sold="13"/> <Item name="Video Plus II" manufacturer="Video Enterprise" value="169.99" sold="1"/> <Item name="3D Max-a-mum" manufacturer="3D Visuals and Sound" value="342.99" sold="8"/> <Item name="Cheap 3D" manufacturer="Cheapies" value="45.99" sold="4"/> </Product> <Product type="Sound Cards"> <Item name="Soundz" manufacturer="Cheapies" value="99.99" sold="33"/> <Item name="Super 3D Sound Pro" manufacturer="Sound World Inc." value="199.99" sold="3"/> <Item name="Mega-Base" manufacturer="Bass.com" value="22.99" sold="0"/> <Item name="Sound Maximizer 4600" manufacturer="Sage Hardware" value="85.99" sold="11"/> </Product> </Quarter> <Quarter value="2nd"> <Product type="Video Cards"> <Item name="Ultra Video 5500" manufacturer="Ultra Video" value="199.99" sold="12"/> <Item name="Video Plus" manufacturer="Video Enterprise" value="139.99" sold="28"/> <Item name="Video Plus II" manufacturer="Video Enterprise" value="89.99" sold="0"/> <Item name="3D Max-a-mum" manufacturer="3D Visuals and Sound" value="292.99" sold="7"/> <Item name="Cheap 3D" manufacturer="Cheapies" value="39.99" sold="12"/> </Product> <Product type="Sound Cards"> <Item name="Soundz" manufacturer="Cheapies" value="79.99" sold="40"/> <Item name="Super 3D Sound Pro" manufacturer="Sound World Inc." value="159.99" sold="1"/> <Item name="Mega-Base" manufacturer="Bass.com" value="62.99" sold="2"/> <Item name="Sound Maximizer 4600" manufacturer="Sage Hardware" value="75.99" sold="8"/> </Product> </Quarter> <Quarter value="3rd"> <Product type="Video Cards"> <Item name="Ultra Video 6500" manufacturer="Ultra Video" value="345.99" sold="24"/> <Item name="Vidz Gold Edition" manufacturer="Vid World" value="169.99" sold="13"/> <Item name="Video Plus II" manufacturer="Video Enterprise" value="169.99" sold="1"/> <Item name="3D Max-a-mum" manufacturer="3D Visuals and Sound" value="342.99" sold="8"/> <Item name="Cheap 3D" manufacturer="Cheapies" value="45.99" sold="4"/> </Product> <Product type="Sound Cards"> <Item name="Soundz" manufacturer="Cheapies" value="99.99" sold="33"/> <Item name="World of Sound" manufacturer="Joe's Computer Hardware" value="199.99" sold="3"/> <Item name="Sound Maximizer 4600" manufacturer="Sage Hardware" value="85.99" sold="11"/> <Item name="Master Sound Maker 0100" manufacturer="Sound Corp" value="139.99" sold="10"/> </Product> </Quarter> </Year> <Year value="2000"> <Quarter value="1st"> <Product type="Video Cards"> <Item name="Ultra Video 3500" manufacturer="Ultra Video" value="264.99" sold="12"/> <Item name="Viz-a-o" manufacturer="Video Enterprise" value="149.99" sold="13"/> <Item name="Video Plus" manufacturer="Video Enterprise" value="99.99" sold="36"/> <Item name="3D Min-a-mum" manufacturer="3D Visuals and Sound" value="222.99" sold="6"/> <Item name="Cheap 2D" manufacturer="Cheapies" value="25.99" sold="8"/> </Product> <Product type="Sound Cards"> <Item name="Sound" manufacturer="Cheapies" value="39.99" sold="8"/> <Item name="Super 3D Sound" manufacturer="Sound World Inc." value="139.99" sold="3"/> <Item name="Base" manufacturer="Bass.com" value="62.99" sold="1"/> <Item name="Sound Maximizer 2600" manufacturer="Sage Hardware" value="95.99" sold="7"/> </Product> </Quarter> <Quarter value="2nd"> <Product type="Video Cards"> <Item name="Ultra Video 3500" manufacturer="Ultra Video" value="179.99" sold="15"/> <Item name="Video Plus" manufacturer="Video Enterprise" value="119.99" sold="18"/> <Item name="3D Min-a-mum" manufacturer="3D Visuals and Sound" value="159.95" sold="2"/> <Item name="Cheap 3D" manufacturer="Cheapies" value="39.99" sold="12"/> </Product> <Product type="Sound Cards"> <Item name="Sound" manufacturer="Cheapies" value="29.99" sold="10"/> <Item name="Super 3D Sound" manufacturer="Sound World Inc." value="159.99" sold="1"/> <Item name="Base" manufacturer="Bass.com" value="82.99" sold="1"/> <Item name="Sound Maximizer 2600" manufacturer="Sage Hardware" value="75.99" sold="11"/> </Product> </Quarter> <Quarter value="3rd"> <Product type="Video Cards"> <Item name="Ultra Video 4000" manufacturer="Ultra Video" value="229.99" sold="8"/> <Item name="Video Plus" manufacturer="Video Enterprise" value="59.99" sold="0"/> <Item name="3D Min-a-mum" manufacturer="3D Visuals and Sound" value="159.95" sold="5"/> <Item name="Cheap 3D" manufacturer="Cheapies" value="10.99" sold="15"/> </Product> <Product type="Sound Cards"> <Item name="Sound" manufacturer="Cheapies" value="59.99" sold="11"/> <Item name="Box of Sound" manufacturer="Joe's Computer Hardware" value="179.99" sold="15"/> <Item name="Sound Maximizer 2600" manufacturer="Sage Hardware" value="65.99" sold="13"/> <Item name="Master Sound Maker" manufacturer="Sound Corp" value="229.99" sold="5"/> </Product> </Quarter> <Quarter value="4th"> <Product type="Video Cards"> <Item name="Ultra Video 4500" manufacturer="Ultra Video" value="285.95" sold="32"/> <Item name="Vidz Gold Edition" manufacturer="Vid World" value="139.99" sold="15"/> <Item name="Video Plus II" manufacturer="Video Enterprise" value="119.90" sold="0"/> <Item name="3D Max-a-mum" manufacturer="3D Visuals and Sound" value="299.99" sold="16"/> <Item name="Cheap 3D" manufacturer="Cheapies" value="35.99" sold="1"/> </Product> <Product type="Sound Cards"> <Item name="Soundz" manufacturer="Cheapies" value="79.99" sold="15"/> <Item name="World of Sound" manufacturer="Joe's Computer Hardware" value="187.99" sold="4"/> <Item name="Sound Maximizer 3600" manufacturer="Sage Hardware" value="199.99" sold="6"/> <Item name="Master Sound Maker" manufacturer="Sound Corp" value="149.99" sold="5"/> </Product> </Quarter> </Year> </Company> </Sales>
The output obtained is a file a0.txt:
<?xml version="1.0" encoding="UTF-8" ?> <!-- This Transformation shows the sales for --> <!-- Cheapies based on the Input File. --> <Sales_Totals name="Cheapies" type="Manufacturer" allTimeSales="95022.00"> <ProductList year="2001" value="1st"> <Products quarter="1st"> <Name>Cheap 3D</Name> <Value>45.99</Value> <Sold>4</Sold> </Products> <Products quarter="1st"> <Name>Soundz</Name> <Value>99.99</Value> <Sold>33</Sold> </Products> </ProductList> <ProductList year="2001" value="2nd"> <Products quarter="2nd"> <Name>Cheap 3D</Name> <Value>39.99</Value> <Sold>12</Sold> </Products> <Products quarter="2nd"> <Name>Soundz</Name> <Value>79.99</Value> <Sold>40</Sold> </Products> </ProductList> <ProductList year="2001" value="3rd"> <Products quarter="3rd"> <Name>Cheap 3D</Name> <Value>45.99</Value> <Sold>4</Sold> </Products> <Products quarter="3rd"> <Name>Soundz</Name> <Value>99.99</Value> <Sold>33</Sold> </Products> </ProductList> <ProductList year="2000" value="1st"> <Products quarter="1st"> <Name>Cheap 2D</Name> <Value>25.99</Value> <Sold>8</Sold> </Products> <Products quarter="1st"> <Name>Sound</Name> <Value>39.99</Value> <Sold>8</Sold> </Products> </ProductList> <ProductList year="2000" value="2nd"> <Products quarter="2nd"> <Name>Cheap 3D</Name> <Value>39.99</Value> <Sold>12</Sold> </Products> <Products quarter="2nd"> <Name>Sound</Name> <Value>29.99</Value> <Sold>10</Sold> </Products> </ProductList> <ProductList year="2000" value="3rd"> <Products quarter="3rd"> <Name>Cheap 3D</Name> <Value>10.99</Value> <Sold>15</Sold> </Products> <Products quarter="3rd"> <Name>Sound</Name> <Value>59.99</Value> <Sold>11</Sold> </Products> </ProductList> <ProductList year="2000" value="4th"> <Products quarter="4th"> <Name>Cheap 3D</Name> <Value>35.99</Value> <Sold>1</Sold> </Products> <Products quarter="4th"> <Name>Soundz</Name> <Value>79.99</Value> <Sold>15</Sold> </Products> </ProductList> </Sales_Totals>
iWay Software |