ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexWebSphere Message Broker SupportNot able to retrieve child tag from XML

Post new topicReply to topic
Not able to retrieve child tag from XML View previous topic :: View next topic
Author Message
premji
PostPosted: Tue May 15, 2018 11:06 am Post subject: Not able to retrieve child tag from XML Reply with quote

Acolyte

Joined: 01 Jul 2013
Posts: 64

Hi,

I am facing problem while retrieving data tag from below XML using ESQL, can you please help me if you get a chance?

Source XML looks like :
Code:
<tst:getRes xmlns:tst="http://wb.samples.com"><tst::getRrn>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;data xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; &gt;
&lt;ship&gt;&lt;/ship&gt;&lt;/data&gt;<tst::getRrn></tst:getRes>


Thanks in advance
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue May 15, 2018 11:16 am Post subject: Re: Not able to retrieve child tag from XML Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25250
Location: Ohio, USA

premji wrote:
I am facing problem while retrieving data tag from below XML using ESQL, can you please help me if you get a chance?


Perhaps if you shared a few extra details like:

- what your ESQL looks like
- what result you expect
- what result you're getting
- what you're tried already to resolve it
- an extract of a user trace of the ESQL in question executing

"I am facing problem" conveys nothing.

I am facing problem with desk - can you help me with that, based on that statement?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
premji
PostPosted: Tue May 15, 2018 11:22 am Post subject: Not able to retrieve child from XML Reply with quote

Acolyte

Joined: 01 Jul 2013
Posts: 64

Hi Vitor,

I wrote below ESQL to retrieve data element but payload returning null value for that.


DECLARE tst NAMESPACE 'http://wb.samples.com';

DECLARE PayLoad BLOB;
SET PayLoad= ASBITSTREAM(InputRoot.XMLNSC."{tst:getRes}"."{tst:getRrn}" ENCODING InputRoot.MQMD.Encoding CCSID InputRoot.Properties.CodedCharSetId);

And expected output would be:
<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<shipment></shipment>
</data>


Last edited by premji on Tue May 15, 2018 11:39 am; edited 2 times in total
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue May 15, 2018 11:35 am Post subject: Re: Not able to retrieve child from XML Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25250
Location: Ohio, USA

premji wrote:
I wrote below ESQL to retrieve data element but payload returning null value for that.


Are they charging you by the linebreak?


premji wrote:
DECLARE tst NAMESPACE 'http://wb.samples.com


I'm going to assume there's a closing quote and a semicolon on the running version.

premji wrote:

DECLARE PayLoad, BLOB;


and no comma between PayLoad and the type definition

premji wrote:
SET PayLoad= ASBITSTREAM(InputRoot.XMLNSC."{tst:getRes}"."{tst:getRrn}" ENCODING InputRoot.MQMD.Encoding CCSID InputRoot.Properties.CodedCharSetId);

And expected output would be:
<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<shipment></shipment>
</data>


Ok, why the double quotes around the 2 child tags?

How about you declare a reference to the data tag and pass that to ASBITSTREAM? Squander a line break.

This will also show more clearly in the user trace I asked about (HINT!) if the problem is finding the data tag or serializing the data tag.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
premji
PostPosted: Tue May 15, 2018 11:52 am Post subject: Not able to retrieve child from XML Reply with quote

Acolyte

Joined: 01 Jul 2013
Posts: 64

Thanks Vitor, I have tried with reference and it's working as expected.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue May 15, 2018 12:14 pm Post subject: Re: Not able to retrieve child from XML Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25250
Location: Ohio, USA

premji wrote:
Thanks Vitor, I have tried with reference and it's working as expected.


So you don't pass it that weird evaluated location but an actual point in the tree to start serializing from and it works? Go figure.....

But you have the result you want and all is well.


_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue May 15, 2018 2:01 pm Post subject: Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19758
Location: LI,NY

What the OP had was and embedded XML document in the XML.
The data shown lists an XML declaration plus the data specified by the user.

So the first thing was to retrieve the tagdata containing the XML. (Thanks Vitor)

The second / third moves could have been to cast that data to a BLOB (utf-8 ) and then parse it again with the XMLNSC parser...


_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportNot able to retrieve child tag from XML
Jump to:



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
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.