on 08-25-2010 9:34 AM
I have two XMLs of same structure..n i need to combine them.
For e.g The XMLs have the following structure:
<Rowsets>
<Rowset>
<Row>
<Col1>Name</Col1>
<Col2>Location</Col2>
</Row>
<Row>
<Col1>Name</Col1>
<Col2>Location</Col2>
</Row>
</Rowset>
</Rowsets>
I need to combine the {Rowsets/Rowset/Row} elements of the second XML after the first XML's last {Rowsets/Rowset/Row} element. I think Joiner can be used. But unable to get thru the syntax. Any help is appreciated.
Thanks
Anamika
HI Anamika,
You can use Union just configure Source Document 1 & 2 with your XML Inputs and take O/P of Union action.
Regards,
Manoj Bilthare
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can also achieve this with XPATH in assignment block
Take 1 XML type local parameter suppose XMLOP
Then take one assignment action block and assign your first xml as assign XML to XMLOP
Link Type: assign xml
Target XPATH: Local.XMOP
Expression: first XML file
after that assign
Link Type: append after xml
Target XPATH: Local.XMLOP{/Rowsets/Rowset}
Expression: your second xml file {/Rowsets/Rowset}
and use XMLOP it will join yor both xml files.
Regards,
Manoj Bilthare
Hi,
Please Check wheather your xml file is like following or not
<?xml version="1.0" encoding="UTF-8"?>
<Rowsets DateCreated="2010-08-25T05:51:26" EndDate="2010-08-25T05:51:26" StartDate="2010-08-25T04:51:26" Version="12.1.5 Build(77)">
<Rowset>
<Columns>
<Column Description="Col1" MaxRange="1" MinRange="0" Name="Col1" SQLDataType="93" SourceColumn="Col1"/>
<Column Description="Col2" MaxRange="95" MinRange="88" Name="Col2" SQLDataType="8" SourceColumn="Col2"/>
</Columns>
<Row>
<Col1>Name1</Col1>
<Col2>Location1</Col2>
</Row>
<Row>
<Col1>Name2</Col1>
<Col2>Location2</Col2>
</Row>
</Rowset>
</Rowsets>
If you see above they have decleared columns in XML.
if your xml file is like this than in Joiner
map your first query op to source of parent document than second query op to child document to source
than select join type as full outer
than map same parent column name with child column name.
It workes for me hope it will help you
Regards,
Manoj Bilthare
Hi Manoj,
I have tried both the options but now Iam getting the output as
<?xml version="1.0" encoding="UTF-8"?>
<Rowsets DateCreated="2010-08-25T05:51:26" EndDate="2010-08-25T05:51:26" StartDate="2010-08-25T04:51:26" Version="12.1.5 Build(77)">
<Rowset>
<Columns>
<Column Description="Col1" MaxRange="1" MinRange="0" Name="Col1" SQLDataType="93" SourceColumn="Col1"/>
<Column Description="Col2" MaxRange="95" MinRange="88" Name="Col2" SQLDataType="8" SourceColumn="Col2"/>
</Columns>
<Row>
<Col1>Name1</Col1>
<Col2>Location1</Col2>
</Row>
<Row>
<Col1>Name2</Col1>
<Col2>Location2</Col2>
</Row>
</Rowset>
<Rowset>
<Columns>
<Column Description="Col1" MaxRange="1" MinRange="0" Name="Col1" SQLDataType="93" SourceColumn="Col1"/>
<Column Description="Col2" MaxRange="95" MinRange="88" Name="Col2" SQLDataType="8" SourceColumn="Col2"/>
</Columns>
<Row>
<Col1>Name3</Col1>
<Col2>Location3</Col2>
</Row>
<Row>
<Col1>Name4</Col1>
<Col2>Location4</Col2>
</Row>
</Rowset>
</Rowsets>
However, I need the Row elements of the second xml to appended after the last Row element of the first xml. This can be achieved by applying repeater. But since I have many XMLs to combine, repeaters would cause a performance hit.
Hi,
You can use narmalise but before that you need to change the link type of assignment from Append after XML to Append XML.
have you checked your xml SQL results files they have column defination or not if they have than you can directly use joiner as i explained in my previous post.
Regards,
Manoj Bilthare
Hi Manoj,
I do have column defintion in my XML. On using a joiner the output comes as follows
<?xml version="1.0" encoding="utf-8"?>
<Rowsets DateCreated="2010-08-25T05:50:26" EndDate="2010-08-25T05:50:26" StartDate="2010-08-25T04:50:26" Version="12.0.3 Build(107)">
<Rowset>
<Columns>
<Column Description="Col1" MaxRange="1" MinRange="0" Name="Col1" SQLDataType="1" SourceColumn="Col1"/>
<Column Description="Col2" MaxRange="1" MinRange="0" Name="Col2" SQLDataType="1" SourceColumn="Col2"/>
</Columns>
<Row>
<Col1>Name1</Col1>
<Col2>Location1</Col2>
</Row>
<Row>
<Col1>Name1</Col1>
<Col2>Location1</Col2>
</Row>
<Row>
<Col1>Name2</Col1>
<Col2>Location2</Col2>
</Row>
<Row>
<Col1>Name2</Col1>
<Col2>Location2</Col2>
</Row>
</Rowset>
</Rowsets>
instead of returning
<?xml version="1.0" encoding="utf-8"?>
<Rowsets DateCreated="2010-08-25T05:50:26" EndDate="2010-08-25T05:50:26" StartDate="2010-08-25T04:50:26" Version="12.0.3 Build(107)">
<Rowset>
<Columns>
<Column Description="Col1" MaxRange="1" MinRange="0" Name="Col1" SQLDataType="1" SourceColumn="Col1"/>
<Column Description="Col2" MaxRange="1" MinRange="0" Name="Col2" SQLDataType="1" SourceColumn="Col2"/>
</Columns>
<Row>
<Col1>Name1</Col1>
<Col2>Location1</Col2>
</Row>
<Row>
<Col1>Name2</Col1>
<Col2>Location2</Col2>
</Row>
<Row>
<Col1>Name3</Col1>
<Col2>Location3</Col2>
</Row>
<Row>
<Col1>Name4</Col1>
<Col2>Location4</Col2>
</Row>
</Rowset>
</Rowsets>
Also, while configuring the joiner, i have mapped the Source and Child documents. But how do you map the source & child columns. The dropdowns are empty.
Hi,
The issue has been resolved. Iam using a joiner. The problem was since my source and child XML passed as input to the Joiner was dynamically generated, it wasnt able to retrieve the XML structure at compile time. Hence the Source and Child columns were empty. I have harcoded the XML structure in local XML variables and passing those as input to the Joiner. That resolves the issue.
User | Count |
---|---|
12 | |
7 | |
3 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.