Scriptella: XML to DB: Insert Into from XPATH -
i have xml file looks this:
<xml> <table name='test'> <row> <field name='key'>1000</field> <field name='text'>test</field> </row> </table> </xml>
id parse xml , use within insert statement:
<query connection-id="in"> /xml/table/row <script connection-id="out"> insert x t ( t.entitykey, t.text ) values ( ???????? ); </script> </query>
how access specific field-tag within insert statement using xpath? prefer have 1 xsd takes table layouts account , not maintain n xsd each table hence field[@name] design.
thanks matthias
xpath driver exposes variable called node
provides context executing xpath expressions on returned node. can use following expression value of particular field:
<script connection-id="out"> insert x t (t.entitykey, t.text) values ( ?{node.getstring("./field[@name = 'text']")} ); </script>
Comments
Post a Comment