Author |
Message
|
RAJESHRAMAKRISHNAN |
Posted: Tue Nov 30, 2004 10:50 pm Post subject: Folderbitstream |
|
|
Voyager
Joined: 01 May 2004 Posts: 96
|
Hi ,
My requirement is like this
Input:
1. <A><A1>Name</A1></A>
OR
2. <A>Name</A>
Output:
1. <payLoad><A1>Name</A1></payLoad>
2. <payLoad>Name<payLoad>
ie what ever is there with in the tags <A></A> should appear in the payLoad tag. I am currently using FolderBitstream. This works only for the first case(<A><A1>Name</A1></A>) . I want a develop a generic piece of code which can handle both the conditions.
Thanks in advance
Rajesh |
|
Back to top |
|
 |
kirani |
Posted: Tue Nov 30, 2004 11:19 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Try this,
Code: |
SET OutputRoot.XML.PayLoad = InputRoot.XML.*[1];
|
_________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
RAJESHRAMAKRISHNAN |
Posted: Thu Dec 02, 2004 5:47 am Post subject: |
|
|
Voyager
Joined: 01 May 2004 Posts: 96
|
Hi Kiran,
I am getting the same entire XML in the payLoad tag.
Out put I got was
1. <payLoad><A><A1>Name</A1></A><payLoad>
OR
2. <payLoad><A>Name</A></payLoad>
Please let me know whether there are any other methods.
Thanks |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Dec 02, 2004 5:55 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I think Kiran made a slight typo on his code.
It should be something like
Code: |
Set OutputRoot.XML.PayLoad = InputRoot.XML.[1].*; |
But maybe I'm forgetting my syntax and if you can do multiple anonymous references or not. I should spend some more time reading the manuals.
You could also set a reference to the first child of InputRoot.XML, and then take all children of that. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
RAJESHRAMAKRISHNAN |
Posted: Thu Dec 02, 2004 9:15 pm Post subject: |
|
|
Voyager
Joined: 01 May 2004 Posts: 96
|
Hi Jeff,
I am still not getting the correct output. What I am planning to do is use cardinality and have two statements
ie if there is no child for <A> then normal assignment else use folderbitstream. Please let me know if it is possible with a single statement.
Thanks
Rajesh |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Dec 03, 2004 6:31 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
RAJESHRAMAKRISHNAN wrote: |
Please let me know if it is possible with a single statement. |
I never judge code by how many lines it takes.
Just by how readable it is.
Code: |
declare thisRef reference to InputBody.[1];
set OutputRoot.XML.PayLoad = thisRef.*[]; |
Might work.
If I had more time today, I'd test it. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|