How do you string a series of xml records together ?
How do you string a series of xml records together ?
I have a group of xml records....
<rec>111</rec>
<rec>222</rec>
<rec>333</rec>
<rec>444</rec>
<rec>555</rec>
I can extract them, but I want to string them together like this....
<rec>111</rec><rec>222</rec><rec>333</rec><rec>444</rec>>rec>555</rec>
Any help is appreciated.
Thanks.
<rec>111</rec>
<rec>222</rec>
<rec>333</rec>
<rec>444</rec>
<rec>555</rec>
I can extract them, but I want to string them together like this....
<rec>111</rec><rec>222</rec><rec>333</rec><rec>444</rec>>rec>555</rec>
Any help is appreciated.
Thanks.
If I did this the way you said, it didn't have any impact.
My input is a group with many records and no delimiters.
My output rule is =F_String(PACKAGE(DummyRec:Input01)).
The output still comes out like this:
<rec>111</rec>
<rec>222</rec>
<rec>333</rec>
<rec>444</rec>
<rec>555</rec>
Even though my input file looks like xml, is it possible that I should treat
it as a flat file ? I'm new at this, no training yet. Thanks for your help.
I intend to keep experimenting.
My input is a group with many records and no delimiters.
My output rule is =F_String(PACKAGE(DummyRec:Input01)).
The output still comes out like this:
<rec>111</rec>
<rec>222</rec>
<rec>333</rec>
<rec>444</rec>
<rec>555</rec>
Even though my input file looks like xml, is it possible that I should treat
it as a flat file ? I'm new at this, no training yet. Thanks for your help.
I intend to keep experimenting.
jazzer1 wrote:If I did this the way you said, it didn't have any impact.
My input is a group with many records and no delimiters.
My output rule is =F_String(PACKAGE(DummyRec:Input01)).
The output still comes out like this:
<rec>111</rec>
<rec>222</rec>
<rec>333</rec>
<rec>444</rec>
<rec>555</rec>
Even though my input file looks like xml, is it possible that I should treat
it as a flat file ? I'm new at this, no training yet. Thanks for your help.
I intend to keep experimenting.
Actually you may want to try a much simpler way the use of PACKAGE will pass along the initiator and terminator of the record you can use TEXT instead which leaves out the initiator and terminator.
Well that's my .2 cents worth.
Bob Lopez
boblopez1@hotmail.com
boblopez1@hotmail.com
I was actually able to string the data together by doing this:
=LEAVEPRINT(DummyRecs)
I used this against the group and did not need the F_Map. I just got
lucky and stumbled into this command thanks to JanHess pointing me
in the right direction.
The new twist is that the xml tags are not consistent. Anything between
<abc> and </abc> is game.
So the input is:
<abc>
<rec>111</rec>
<dddec>222</dddrec>
<xrec>333</xrec>
<sss>444</sss>
</abc>
And the output has to be:
111|222|333|444 etc.
Thanks all for your help.
=LEAVEPRINT(DummyRecs)
I used this against the group and did not need the F_Map. I just got
lucky and stumbled into this command thanks to JanHess pointing me
in the right direction.
The new twist is that the xml tags are not consistent. Anything between
<abc> and </abc> is game.
So the input is:
<abc>
<rec>111</rec>
<dddec>222</dddrec>
<xrec>333</xrec>
<sss>444</sss>
</abc>
And the output has to be:
111|222|333|444 etc.
Thanks all for your help.
Great, glad that works for you, did you try TEXT, cause I believe that would have given you the same result , reason being that TEXT would be the correct funtion to use in that scenario.jazzer1 wrote:I was actually able to string the data together by doing this:
=LEAVEPRINT(DummyRecs)
I used this against the group and did not need the F_Map. I just got
lucky and stumbled into this command thanks to JanHess pointing me
in the right direction.
The new twist is that the xml tags are not consistent. Anything between
<abc> and </abc> is game.
So the input is:
<abc>
<rec>111</rec>
<dddec>222</dddrec>
<xrec>333</xrec>
<sss>444</sss>
</abc>
And the output has to be:
111|222|333|444 etc.
Thanks all for your help.
Have a great day.
Bob Lopez
boblopez1@hotmail.com
boblopez1@hotmail.com
The use of TEXT will remove the Tags from the Record Object only, now if you want the tags to be removed from the individual fields you can:jazzer1 wrote:I guess I said that wrong.....I still need to figure out how to strip the xml
tags from the data.
I can do this:
<abc><rec>111</rec><dddec>222</dddrec><xrec>333</xrec> etc.
But not this:
111|222|333|444 etc.
Any suggestions ?
Thank you all very much.
A) Change the output type tree to define each individual field without initiators or terminators and then map each field seperately which will give you what you want.
B) If you are mapping the XML rec to a Text BLOB you may consider contatenating =TEXT(field1)+TEXT(field2)+TEXT(field3)+etc. Again the TEXT will remove the tags since they are defined as initiators and terminators, do not use PACKAGE.
That's all I got for now, I'm working on a map right now but If I get a chance to try something on my end, I will respond back. give the concat a try if your not dealing with too many fields but I believe that may work, faster than defining a whole record as I suggested in A).
Kind Regards,
Bob Lopez
Bob Lopez
boblopez1@hotmail.com
boblopez1@hotmail.com
Unfortunetly the functions SUBSTITUTE and/or SQUEEZE will not work because the tags are not consistent. If the tags were consistent such as <data1><data2><data3> like a delimiter than you can use SUBSTITUTE or if they were pairs like HEX pairs <<>> then you can use SQUEEZE, try concatenate with TEXT again this should work.
Kind Regards,
Bob
Kind Regards,
Bob
Bob Lopez
boblopez1@hotmail.com
boblopez1@hotmail.com
Have you tried the SERIESTOTEXT function?
Hopefully, this would produce your desired result of:
1111|2222|3333|4444|
You might need to remove the trailing pipe though. I don't have time to check it out this morning. Let us know if it works.
John
Code: Select all
=SERIESTOTEXT(DummyRec:Input01+"|")
1111|2222|3333|4444|
You might need to remove the trailing pipe though. I don't have time to check it out this morning. Let us know if it works.
John