|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Searching a field from Input XML |
« View previous topic :: View next topic » |
Author |
Message
|
aggarwal.intouch |
Posted: Mon Feb 10, 2014 4:20 am Post subject: Searching a field from Input XML |
|
|
 Acolyte
Joined: 30 May 2011 Posts: 56 Location: India
|
Hi All,
I have a requirement that I have to search some element and get its respective value from XML. There are mentioned 2 below queries:-
1)I do not know the correct XPath of that element as that element can come anywhere and at any level in the Input XML.
2)The element can be of any name 'ValidateCode', 'ValidateType', 'ValidateCodeType', 'ValidateTypeCode'. Only thing which would be common would be 'Validate' keyword will always be there in that field.. I have to find this element in XML and take out its value. At a time one XML will have only 1 'Validate' tag from all 4 options stated above.
I tried below code but it is not working:-
SET Environment.Variable.a = THE(SELECT * FROM InputRoot.XMLNSC AS I where FIELDNAME(I.*) = BEGINSWITH ('Validate'); |
|
Back to top |
|
 |
dogorsy |
Posted: Mon Feb 10, 2014 4:37 am Post subject: Re: Searching a field from Input XML |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
aggarwal.intouch wrote: |
Hi All,
I have a requirement that I have to search some element and get its respective value from XML. There are mentioned 2 below queries:-
1)I do not know the correct XPath of that element as that element can come anywhere and at any level in the Input XML.
2)The element can be of any name 'ValidateCode', 'ValidateType', 'ValidateCodeType', 'ValidateTypeCode'. Only thing which would be common would be 'Validate' keyword will always be there in that field.. I have to find this element in XML and take out its value. At a time one XML will have only 1 'Validate' tag from all 4 options stated above.
I tried below code but it is not working:-
SET Environment.Variable.a = THE(SELECT * FROM InputRoot.XMLNSC AS I where FIELDNAME(I.*) = BEGINSWITH ('Validate'); |
If the element can be anywhere in the message, then a select will not work.
Loop through the message until you locate the desired tag. You can use the navigate function ( in the infocentre, create procedure statement ) and modify it as required. |
|
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
|
|
|
|