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 » In MB how to traverse the next Child using ESQL

Post new topic  Reply to topic Goto page 1, 2  Next
 In MB how to traverse the next Child using ESQL « View previous topic :: View next topic » 
Author Message
abhivin
PostPosted: Mon Jun 28, 2010 2:55 am    Post subject: In MB how to traverse the next Child using ESQL Reply with quote

Novice

Joined: 15 Jun 2010
Posts: 10

Hi,

I am trying to do the message conversion from XML-TDS. I am getting output for the first set of elements, whereas i am unable to get the second elements.

FYI pls find the below XML:

<employee>
<name>Sample</name>
<id>2384</id>
<dept>53456</dept>
</employee>
<company>
<cname>Joeton</name>
<cid>2384</id>
<cdept>53456</dept>
</company>


Here, i am able to get the output "Sample 2384 53456" whereas the 2nd element company value is not getting.

Pls give me the idea to how to access the element and achieve the scenario.

Thanks in Advance

Regards ,
Abhi
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jun 28, 2010 3:11 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

We can't tell you how to do this until you tell us what you tried.
Back to top
View user's profile Send private message
abhivin
PostPosted: Mon Jun 28, 2010 3:28 am    Post subject: Reply with quote

Novice

Joined: 15 Jun 2010
Posts: 10

Thanks.

Below the snippet of the code i am using:


SET OutputRoot.MRM.Name = FIELDVALUE(InputRoot.XMLNSC.employee.name);
SET OutputRoot.MRM.ID = FIELDVALUE(InputRoot.XMLNSC.employee.id);
SET OutputRoot.MRM.Dept = FIELDVALUE(InputRoot.XMLNSC.employee.dept);
SET OutputRoot.MRM.CName = FIELDVALUE(InputRoot.XMLNSC.company.name);
SET OutputRoot.MRM.CID = FIELDVALUE(InputRoot.XMLNSC.company.id);
SET OutputRoot.MRM.CDept = FIELDVALUE(InputRoot.XMLNSC.company.dept);

Do let me know if you need more info reg. this.

Thanks,
Abhi
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jun 28, 2010 3:37 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Why are you trying to access InputRoot.XMLNSC.company.id when the field is named "cid" in the XML?
Back to top
View user's profile Send private message
abhivin
PostPosted: Mon Jun 28, 2010 4:03 am    Post subject: Reply with quote

Novice

Joined: 15 Jun 2010
Posts: 10

Apologize for that, typo error.

I am try to accessing the below code only

SET OutputRoot.MRM.CName = FIELDVALUE(InputRoot.XMLNSC.company.cname);
SET OutputRoot.MRM.CID = FIELDVALUE(InputRoot.XMLNSC.company.cid);
SET OutputRoot.MRM.CDept = FIELDVALUE(InputRoot.XMLNSC.company.cdept);

Thanks,
Joice.V
Back to top
View user's profile Send private message
sirsi
PostPosted: Mon Jun 28, 2010 4:29 am    Post subject: Reply with quote

Disciple

Joined: 11 Mar 2005
Posts: 177

looks like out put message set is not defined properly...! can you define the structure of ur output msg set
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jun 28, 2010 4:34 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Looking at your XML again, I'm confused.

It is not legal for an XML document to have more than one root.

So it is not legal for <employee> to be a sibling of <company> when neither of them have a common parent.

Take a user trace of your code.

Use the Trace node to output the ${Root}. Compare your code against the tree described in the Trace node output. Compare your expectations against what the usertrace says is being executed.
Back to top
View user's profile Send private message
abhivin
PostPosted: Mon Jun 28, 2010 4:43 am    Post subject: Reply with quote

Novice

Joined: 15 Jun 2010
Posts: 10

Thanks,

Yes defined properly.
I am unable to attach the screen shot of the message set.

Regards,
Joice.V


[/code]
Back to top
View user's profile Send private message
sirsi
PostPosted: Mon Jun 28, 2010 5:09 am    Post subject: Reply with quote

Disciple

Joined: 11 Mar 2005
Posts: 177

I believe he has provided part of xml, otherwise MB will throw an error...

can you take a trace, write it to a file and paste the contents here...
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Jun 28, 2010 6:42 pm    Post subject: Reply with quote

Grand High Poobah

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

Also it looks like company is not valid... there can only be one xmlroot under XMLNSC. You have employee. Company looks like it is a sibling of employee but employee is your xmlroot... This xml document is not valid...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Jun 29, 2010 2:32 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

fjb_saper wrote:
Also it looks like company is not valid... there can only be one xmlroot under XMLNSC. You have employee. Company looks like it is a sibling of employee but employee is your xmlroot... This xml document is not valid...


Well, of course, I've already *said* that. And been told "Oh, it must be that it was a partial XML".

But of course it can't be a partial XML because the ESQL path is trying to treat it as if it were a full XML.

So either the ESQL path is still not being reported correctly, or the XML is invalid.
Back to top
View user's profile Send private message
sirsi
PostPosted: Thu Jul 01, 2010 6:24 am    Post subject: Reply with quote

Disciple

Joined: 11 Mar 2005
Posts: 177

ahh, it has to do with esql... because the bad formed xml would have thrown the user an error!...
Back to top
View user's profile Send private message
anek77
PostPosted: Thu Jul 01, 2010 10:47 pm    Post subject: Reply with quote

Newbie

Joined: 04 Jun 2010
Posts: 3

The sample XML does not look correct at all.

Start and end tags does not match!

<cname>Joeton</name>
<cid>2384</id>
<cdept>53456</dept>

And as mentioned twice before, dual root elements.

Parser parses the first <employee> correct, and you get your output.

When parser tries to parse <company>, you vill get XML Parsing Errors have occurred. This error does not stop the flow, it only causes the following lines to return null.

Code:

SET OutputRoot.MRM.CName = FIELDVALUE(InputRoot.XMLNSC.company.cname);
SET OutputRoot.MRM.CID = FIELDVALUE(InputRoot.XMLNSC.company.cid);
SET OutputRoot.MRM.CDept = FIELDVALUE(InputRoot.XMLNSC.company.cdept);
Back to top
View user's profile Send private message
sirsi
PostPosted: Fri Jul 02, 2010 2:12 am    Post subject: Reply with quote

Disciple

Joined: 11 Mar 2005
Posts: 177

I have tested this before with dual root element and it fails in the input node and doesnt process further... anyway the user abhivin seems to have got this working, as he is not interested in this topic anymore...
Back to top
View user's profile Send private message
abhivin
PostPosted: Fri Jul 02, 2010 2:18 am    Post subject: Reply with quote

Novice

Joined: 15 Jun 2010
Posts: 10

Thanks for the response.

Apologise for the delay response.

I am trying to regenerate my XML, with proper root/child elements.

Will update you asap.

AbhiVin
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » In MB how to traverse the next Child using ESQL
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.