Page 1 of 1

Multiple XML Transactions into One Single File

Posted: Thu Jun 22, 2006 8:57 pm
by pavankvk
Hi

i have to do something like this. i need to create an Unformatted XML for each row in the database and have all of them in one big sequential file.

I used XMLOutput stage to create one single XML per row. but the problem is XMLOutput stage creates one XML file on the file system per row. As we can have millions of rows, its not possible. Instead of capturing that output in a file, i need it as a row in a file.

<?xml version="1.0" encoding="UTF-8"?><BusNameGrp><BusName>DUNKIN DONUTS</BusName><BusState>CT</BusState></BusNameGrp>
<?xml version="1.0" encoding="UTF-8"?><BusNameGrp><BusName>JACK DONUTS</BusName><BusState>C0</BusState></BusNameGrp>
<?xml version="1.0" encoding="UTF-8"?><BusNameGrp><BusName>KRISPY CREME DONUTS</BusName><BusState>CA</BusState></BusNameGrp>

Currently each XML transaction is in a separate file. i need all of them in one single file.

Any ideas?

Posted: Thu Jun 22, 2006 10:42 pm
by chulett
Select the 'Aggregate all rows' Output mode on the Transformation Settings tab.

Posted: Fri Jun 23, 2006 1:46 am
by pavankvk
chulett wrote:Select the 'Aggregate all rows' Output mode on the Transformation Settings tab. ...
Craig

that is not what i want..i know that aggregate option.but that is not what i want.

if you observe the XML lines, each of them is a individual XML and there is no key value for any element so that group of elements fall under one parent element. if i use an id attribute for the TransGrp element,i can get them in one XML.But my requirement is specifically with out using that..i will just generate one complete XML file for each record..and instead of writing each xml file to the file system, i want them to be written as rows in a file.

Posted: Fri Jun 23, 2006 6:54 am
by chulett
You've completely lost me. :?

If you are saying the current output is correct but it all needs to be in one sequential (non XML) file - have you tried an Output link from the XML Output stage to a Sequential File stage?

Posted: Fri Jun 23, 2006 7:16 am
by pavankvk
chulett wrote:You've completely lost me. :?

If you are saying the current output is correct but it all needs to be in one sequential (non XML) file - have you tried an Output link from the XML Output stage to a Sequential File stage?
Yes i did. When i have an output link from the xmloutput stage to a sequential file stage, the sequential file gets the column information of the XMLOutput stage.It contains the information of the elements that i used to form the XML.say the length of my element is 120 bytes the sequential stage also has this information.if i have 10 elements in the xmloutput stage all those 10 elements appear in the sequential file stage...the output will be truncated according to the length of each column.

it doesnt work.

Posted: Fri Jun 23, 2006 7:41 am
by chulett
I would disagree that "it doesn't work"... more correct to say you haven't gotten it working. Yet.

I suggest setting up your sequential file with one large varchar field to hold the entire record, then just use a forward slash "/" as the XPath expression. That should get you much closer.

Posted: Fri Jun 23, 2006 9:17 am
by pavankvk
chulett wrote:I would disagree that "it doesn't work"... more correct to say you haven't gotten it working. Yet.

I suggest setting up your sequential file with one large varchar field to hold the entire record, then just use a forward slash "/" as the XPath expression. That should get you much closer.
here are my xptah expressions in the xmloutput.

/IDMIdentTran/BusNameGrp/BusName/text()
/IDMIdentTran/BusNameGrp/BusState/text()

How should i map them into one single Xpath expression so that i can get the complete XML in one sequential file?

Posted: Fri Jun 23, 2006 10:12 am
by chulett
As noted - one field with a single forward slash as the XPath expression.

Posted: Fri Jun 23, 2006 11:25 am
by pavankvk
chulett wrote:As noted - one field with a single forward slash as the XPath expression. ...
Thanks a lot craig. it worked.

Posted: Fri Jun 23, 2006 11:29 am
by chulett
Cool. :D

Posted: Fri Jun 23, 2006 9:24 pm
by pavankvk
chulett wrote:Cool. :D ...
Craig

when i am trying to produce my file with real data...for some of the XMLs generated, the tags are lost or misspelt or truncated and ill formed...when i produced a data of 1800 records, i had 20 ill formed XMLs in them.. The same data looks perfectly ok in flat files. Other 1780 records are fine..I dont understand whats causing this behavior. Is it a bug in the XMLOutput stage?

Posted: Fri Jun 23, 2006 9:39 pm
by chulett
Not any behaviour I've ever seen. Probably time to call support.