|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Extracting values from the xml |
« View previous topic :: View next topic » |
Author |
Message
|
geethgubi |
Posted: Sat Jan 10, 2009 11:34 am Post subject: Extracting values from the xml |
|
|
Apprentice
Joined: 18 Dec 2008 Posts: 44
|
I have an xml like the below. I have 2 message flows. I need some of the values of n:NameValuePair like I just need only the status and the last name in the 1st message flow and FirstName, lastname and status in my second messageflow. I am extracting these values by looping (using while loop) through all the n:NameValuePair in n:NameValuePairs and checking the value of <n:Name>Status</n:Name>
and if it is my required element I get the value of <n:Value></n:Value> element. Since its performance intensive to loop through all these n:NameValuePair just to get one or 2 values, I used like this n:NameValuePairs.n:NameValuePair[2].n:Value wherever I need whatever. But as thats not the good way of coding. I would like to know is there any generic way of extracting the value of any of the any element in esql code? As I am the newbie with Message broker. Can someone pls help me out with this query? Thanks.
<n:NameValuePairs>
<n:NameValuePair>
<n:Name>Status</n:Name>
<n:Value></n:Value>
</n:NameValuePair>
<n:NameValuePair>
<n:Name>FirstName</n:Name>
<n:Value></n:Value>
</n:NameValuePair>
<n:NameValuePair>
<n:Name>MiddleName</n:Name>
<n:Value></n:Value>
</n:NameValuePair>
<n:NameValuePair>
<n:Name>LastName</n:Name>
<n:Value></n:Value>
</n:NameValuePair>
</n:NameValuePairs> |
|
Back to top |
|
 |
mqjeff |
Posted: Sat Jan 10, 2009 1:02 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
There's no reason you should have posted this under News/Updates.
There's no reason that looping over a repeating structure in order to find specific values is "performance intensive", nor any particular reason why it's "bad coding". In order to sort items, you always have to look at all of the items at least once - where "performance intensive" or "bad coding" comes in place is in *how* you look at all the items in the list. In order to find the Name items that you are looking for, you are going to have to look at all of the Name items that occur "before" the items you are looking for.
And you can't say any piece of code is performance intensive without knowing what "good" performance" is and what "bad performance" is.
There's no reason to design an XML message like you have demonstrated. Someone who did design that should be forced to answer this question for you, and then justify their design based on the complexity of the solution you are forced to.
Being new to WMB doesn't change how you solve problems with it, nor should it. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Sat Jan 10, 2009 1:46 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Moved to WMB Forum _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
kimbert |
Posted: Sat Jan 10, 2009 1:58 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|