Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: New XMLInput Step available

  1. #1
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: New XMLInput Step available

    Attachment: xml input transformation.ktr.xml The "Get fields" function now also works as well as Preview.
    Seems like a very fast AND simple solution, but I'm still eager to get feedback.

    Thanks,

    Matt

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default New XMLInput Step available

    Attachment: xmlinput testfile.xml Grab your kettle.jar and try the new XML Input step now...
    Be carefull, this is the experimental stuff and not meant for production use!

    1) Specify the XML file like you would do with text file input.
    2) specify the location of the repeating part in the XML file on the second tab (content)
    3) specify the fields and their location relative to the location of the repeating part:
    Example: E=Item:1 (The first element called item)
    E=Item:2,E=SubItem=1,A=Attribute (E=Element, A=Attribute, you get the picture)
    In the future we will auto-generate this, for now just type it in...

    Sample file & transformation can be found below.

    Feeback please!!

    Regards,

    Matt


    -----------------------------------------------------------------------------------------------------------------------------------------------------------------
    <Items>
    <Item id="101001">
    <Type value="type1"/>
    <Attribute name="height">10 ft</Attribute>
    <Attribute name="weight">100</Attribute>
    <SubType>
    <SubTypeDescription>This is a description</SubTypeDescription>
    </SubType>
    <SubType>
    <SubTypeDescription>This is another description</SubTypeDescription>
    </SubType>
    </Item>
    <Item id="101002">
    <Type value="type2"/>
    <Attribute name="height">20 ft</Attribute>
    <Attribute name="weight">102</Attribute>
    <SubType>
    <SubTypeDescription>This is not a description</SubTypeDescription>
    </SubType>
    <SubType>
    <SubTypeDescription>This is not another description</SubTypeDescription>
    </SubType>
    </Item>
    </Items>
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------

    Sample transformation (copy, Spoon: Transformation / Paste transformation from clipboad )

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------
    <?xml version="1.0" encoding="UTF-8"?>
    <transformation>
    <info>
    <name></name>
    <directory>\</directory>
    <log>
    <read></read>
    <write></write>
    <input></input>
    <output></output>
    <update></update>
    <connection></connection>
    <table></table>
    <use_batchid>N</use_batchid>
    <use_logfield>N</use_logfield>
    </log>
    <maxdate>
    <connection></connection>
    <table></table>
    <field></field>
    <offset>0.0</offset>
    <maxdiff>0.0</maxdiff>
    </maxdate>
    <size_rowset>350</size_rowset>
    <dependencies>
    </dependencies>
    </info>
    <notepads>
    </notepads>
    <order>
    <hop> <from>XML Input</from><to>Dummy (do nothing)</to><enabled>Y</enabled> </hop> </order>

    <step>
    <name>Dummy (do nothing)</name>
    <type>Dummy</type>
    <description></description>
    <distribute>Y</distribute>
    <copies>1</copies>
    <GUI>
    <xloc>329</xloc>
    <yloc>145</yloc>
    <draw>Y</draw>
    </GUI>
    </step>

    <step>
    <name>XML Input</name>
    <type>XMLInput</type>
    <description></description>
    <distribute>Y</distribute>
    <copies>1</copies>
    <include>N</include>
    <include_field></include_field>
    <rownum>N</rownum>
    <rownum_field></rownum_field>
    <file>
    <name>D:\Projects\SVN\javaForge\Kettle\trunk\testfiles\xmlinput testfile.xml</name>
    <filemask></filemask>
    </file>
    <fields>
    <field>
    <name>id</name>
    <type>String</type>
    <format></format>
    <currency></currency>
    <decimal></decimal>
    <group></group>
    <length>10</length>
    <precision>-1</precision>
    <trim_type>both</trim_type>
    <repeat>N</repeat>
    <positions><position>A=id/1</position> </positions>
    </field>
    <field>
    <name>idInt</name>
    <type>Integer</type>
    <format></format>
    <currency></currency>
    <decimal></decimal>
    <group></group>
    <length>7</length>
    <precision>-1</precision>
    <trim_type>both</trim_type>
    <repeat>N</repeat>
    <positions><position>A=id/1</position> </positions>
    </field>
    <field>
    <name>heigth</name>
    <type>String</type>
    <format></format>
    <currency></currency>
    <decimal></decimal>
    <group></group>
    <length>10</length>
    <precision>-1</precision>
    <trim_type>both</trim_type>
    <repeat>N</repeat>
    <positions><position>E=Attribute/1</position> </positions>
    </field>
    <field>
    <name>heigthInt</name>
    <type>Number</type>
    <format># ft</format>
    <currency></currency>
    <decimal></decimal>
    <group></group>
    <length>7</length>
    <precision>0</precision>
    <trim_type>both</trim_type>
    <repeat>N</repeat>
    <positions><position>E=Attribute/1</position> </positions>
    </field>
    <field>
    <name>weight</name>
    <type>String</type>
    <format></format>
    <currency></currency>
    <decimal></decimal>
    <group></group>
    <length>10</length>
    <precision>-1</precision>
    <trim_type>both</trim_type>
    <repeat>N</repeat>
    <positions><position>E=Attribute/2</position> </positions>
    </field>
    <field>
    <name>weightInt</name>
    <type>Integer</type>
    <format></format>
    <currency></currency>
    <decimal></decimal>
    <group></group>
    <length>7</length>
    <precision>0</precision>
    <trim_type>both</trim_type>
    <repeat>N</repeat>
    <positions><position>E=Attribute/2</position> </positions>
    </field>
    <field>
    <name>Description1</name>
    <type>String</type>
    <format></format>
    <currency></currency>
    <decimal></decimal>
    <group></group>
    <length>100</length>
    <precision>-1</precision>
    <trim_type>both</trim_type>
    <repeat>N</repeat>
    <positions><position>E=SubType/2</position><position>E=SubTypeDescription/1</position> </positions>
    </field>
    <field>
    <name>Description2</name>
    <type>String</type>
    <format></format>
    <currency></currency>
    <decimal></decimal>
    <group></group>
    <length>100</length>
    <precision>-1</precision>
    <trim_type>both</trim_type>
    <repeat>N</repeat>
    <positions><position>E=SubType/2</position><position>E=SubTypeDescription/1</position> </positions>
    </field>
    </fields>
    <positions>
    <position>Items</position>
    <position>Item</position>
    </positions>
    <limit>0</limit>
    <GUI>
    <xloc>107</xloc>
    <yloc>145</yloc>
    <draw>Y</draw>
    </GUI>
    </step>

    </transformation>
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------

  3. #3
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: New XMLInput Step available

    (posted by amine, http://www.javaforge.com/userdata.do?user_id=3106, AGAIN edited and set to PLAIN text type...)

    hey, I try to use your example, and I have empty rows...

    2006/04/14 13:07:46 - Spoon - Transformation opened.
    2006/04/14 13:07:46 - Spoon - Excecuting transformation [null]...
    2006/04/14 13:07:46 - be.ibridge.kettle.trans.Trans - Dispatching started for filename [C:\Documents and Settings\Administrateur\Bureau\xmltest1.ktr]
    2006/04/14 13:07:46 - be.ibridge.kettle.trans.Trans - Nr of arguments detected: 10
    2006/04/14 13:07:46 - Spoon - Started.
    2006/04/14 13:07:46 - XML Input.0 - Starting to run...
    2006/04/14 13:07:46 - XML Input.0 - Opening file: C:\Documents and Settings\Administrateur\Bureau\testXml.xml
    2006/04/14 13:07:46 - XML Input.0 - Finished processing (I=0, O=0, R=0, W=1, U=0, E=0
    2006/04/14 13:07:46 - Dummy (do nothing).0 - Starting to run...
    2006/04/14 13:07:46 - Dummy (do nothing).0 - Finished processing (I=0, O=0, R=1, W=0, U=0, E=0
    2006/04/14 13:07:46 - Spoon - The transformation has finished!!

  4. #4
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: New XMLInput Step available

    Attachment: xmlinput testfile.xml It works fine for me.

    Did you use the file xmlinput testfile.xml from above?


    Thanks,

    Matt

  5. #5

    Default RE: New XMLInput Step available

    yes, I use "xmlinput testfile.xml"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.