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 Index » WebSphere Message Broker (ACE) Support » Facing issues when accessing CDATA as second child element

Post new topic  Reply to topic
 Facing issues when accessing CDATA as second child element « View previous topic :: View next topic » 
Author Message
siva reddy
PostPosted: Sat Jul 16, 2016 4:34 am    Post subject: Facing issues when accessing CDATA as second child element Reply with quote

Novice

Joined: 16 Jul 2016
Posts: 11

Hi All,

I am trying to access the content in CDATA section shown below.

<rootelement>
<sample>
<child1>hello world</child1>
<![CDATA[ I want to access the CDATA section ]]>
</sample>
</rootelement>

I am using the below ESQL Statement.

DECLARE TEST CHARACTER NULL;
SET TEST = FIELDVALUE ( InputRoot.XMLNSC.rootelement.sample.(XML.CdataSection));

As we can see the CDATA section is the second child element of sample.
is it possible to access the CDATA as second child element.

can you please help me out on this.

Thanks in Advance.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sat Jul 16, 2016 5:15 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

It looks like you have made a common mistake.

The XML.CdataSection means that you are wanting to use the XML parser not the XMLNSC Parser.

Replace XML with XMLNSC and you should make some progress.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
siva reddy
PostPosted: Sat Jul 16, 2016 10:06 am    Post subject: Reply with quote

Novice

Joined: 16 Jul 2016
Posts: 11

Thanks for the reply,I tried in that way also, but dint work out.
As you suggested if we use XMLNSC.CDATASection it wont allow to deploy the Integration Service.
When i tried i got the below error:

BIP2432E: (.contact admin.Main, 5.62) : The correlation name 'XMLNSC.CdataSection' is not valid.)

Below is the Code:

DECLARE TEST CHARACTER NULL;
SET TEST = FIELDVALUE ( InputRoot.XMLNSC.rootelement.sample.(XMLNSC.CDATASection));

My observations:
-> When I tried changing the input, CDATA as fist child element, i am able to extract CDATA section using below Syntax which i have mentioned earlier:

DECLARE TEST CHARACTER NULL;
SET TEST = FIELDVALUE ( InputRoot.XMLNSC.rootelement.sample.(XML.CDATASection));

But here the problem is we need to extract the CDATA section when it is second child element.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sat Jul 16, 2016 10:57 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

This part of the documentation should help

http://mqseries.net/phpBB/viewtopic.php?t=68359&sid=1441218c40d6a38306cf42a7a6fe722c

Please take particular note of the case of the elements in CDataSection

There are some sample asignments in the above section. Look at them closely.

Because of the way your data is structured you may have to do some other manipulation. I'd not design a message this way.
i.e. copy the message and delete the first element by setting it to NULL.

Personally, I'd also use usertrace to investigate this and not the debugger but that is just me.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
adubya
PostPosted: Sat Jul 16, 2016 12:33 pm    Post subject: Reply with quote

Partisan

Joined: 25 Aug 2011
Posts: 377
Location: GU12, UK

Tricky one this

You've got mixed content in the sample element i.e it has a child element and also element content.

By default the XMLNSC parser will discard the mixed content i.e. in this case the CDATA section.

So, in your input node where you specify the XMLNSC parser set "Retain mixed content" in the parser options property section.

Then, change yous ESQL access statement to:-

SET TEST = InputRoot.XMLNSC.rootelement.sample.(XMLNSC.CDataValue)*;

That works for me with your input message in my IIB10 environment.

To be fair to my former employer ( ) it's all in the infocenter but needs a bit of join up to piece the solution together.
_________________
Independent Middleware Consultant
andy@knownentity.com
Back to top
View user's profile Send private message Send e-mail
siva reddy
PostPosted: Sat Jul 16, 2016 10:01 pm    Post subject: Reply with quote

Novice

Joined: 16 Jul 2016
Posts: 11

Thanks for the reply,

i just tried with the suggestion @Master, as you said it is working fine.
Now i am able to extract the content in CDATA section. feeling good ''.

But i got one more issue after resolving this.

i need to pass the extracted CDATA section as a string to the next integration service.

When i used the XMLNSC or JSON It is creating tag.

ESQL statements used:
SET OutputRoot.XMLNSC.result = result;

Output Generated:
<result> extracted cdata section content </result>

is there any way to pass only the String with out any tags.

The next Integration service which is going to subscribe this message, expecting text file with out any tags(DFDL format).
Back to top
View user's profile Send private message
adubya
PostPosted: Sun Jul 17, 2016 12:06 am    Post subject: Reply with quote

Partisan

Joined: 25 Aug 2011
Posts: 377
Location: GU12, UK

Good to hear it's working.

Regarding the integration into the next service, you're currently setting your initial output to be XML based so that's what you'll get, XML.

You can instead create BLOB domain output and write the input CDATA value into the BLOB (CAST CHAR -> BLOB)

Then in your downstream integration flow, have an input node which uses the DFDL parser with the appropriate DFDL schema.
_________________
Independent Middleware Consultant
andy@knownentity.com
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Facing issues when accessing CDATA as second child element
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.