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 » How to get XML root node name in ESQL

Post new topic  Reply to topic
 How to get XML root node name in ESQL « View previous topic :: View next topic » 
Author Message
narendra
PostPosted: Tue Oct 15, 2002 1:44 pm    Post subject: How to get XML root node name in ESQL Reply with quote

Apprentice

Joined: 04 Jun 2002
Posts: 26

HI gurus

How can I get the name of the root element of the input XML message in the compute node

Thanks in advance
Narendra
Back to top
View user's profile Send private message
lung
PostPosted: Tue Oct 15, 2002 5:32 pm    Post subject: Reply with quote

Master

Joined: 27 Aug 2002
Posts: 291
Location: Malaysia

Narendra,

lillo has posted the answer to this question in several topics in this forum.

Anyway, the answer to your question is this
Code:
InputBody.*[LAST]


Remember that the last element in the message will always be the root element, but the first element in the message may not be the root element.


_________________
lung
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
narendra
PostPosted: Wed Oct 16, 2002 6:43 am    Post subject: Reply with quote

Apprentice

Joined: 04 Jun 2002
Posts: 26

Lung

I do not get nothing with this. Empty string.

Narendra
Back to top
View user's profile Send private message
lung
PostPosted: Wed Oct 16, 2002 5:11 pm    Post subject: Reply with quote

Master

Joined: 27 Aug 2002
Posts: 291
Location: Malaysia

Narendra,

What are you trying to do here? Are you trying to put the root name of an XML message into a variable?

In terms of referencing, *[LAST] will work
_________________
lung
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
narendra
PostPosted: Thu Oct 17, 2002 10:22 am    Post subject: Reply with quote

Apprentice

Joined: 04 Jun 2002
Posts: 26

Hi Lung
You are right.
I put various topics on the input queue. The root element of the input message gives me the name of the TOPIC.
I tried the way you adviced me. But it return me empty string.
Please let me know, if i am missing any thing.

Thanks in advnce
Narendra
Back to top
View user's profile Send private message
lung
PostPosted: Thu Oct 17, 2002 6:09 pm    Post subject: Reply with quote

Master

Joined: 27 Aug 2002
Posts: 291
Location: Malaysia

Code:
SET A = FIELDNAME(InputBody.*[LAST]);


Hope this works
_________________
lung
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
ernest-ter.kuile
PostPosted: Thu Oct 17, 2002 11:37 pm    Post subject: Reply with quote

Apprentice

Joined: 13 May 2002
Posts: 49
Location: KLM Holland

narendra wrote:
Lung

I do not get nothing with this. Empty string.

Narendra


This is because the XML parser interlaces the XML tree with the formating characters found in the XML message. You have a CR a LF or an blank at the end of the xml message.

the only way I found to get the correct root XML element is this :

Code:
DECLARE cnt INTEGER;
SET cnt = CARDINALITY(InputRoot.XML.*[]);

SET A = FIELDNAME(InputRoot.XML.*[cnt]);
IF A = '' THEN
    SET A = FIELDNAME(InputRoot.XML.*[cnt - 1]);
END IF;


Actually, I would greatly appriciate if somebody provided a beter way, as I'm not sure this works in all cases, but in my tests this works if your XML is followed by CR, LF, TABs, etc...

I suspect that the root XML element will always be either the LAST or the LAST - 1. unfortunatly ...

Code:
SET A = FIELDNAME(InputBody.*[LAST - 1]);


... does not work.
Back to top
View user's profile Send private message Visit poster's website
narendra
PostPosted: Tue Oct 22, 2002 7:45 am    Post subject: Reply with quote

Apprentice

Joined: 04 Jun 2002
Posts: 26

Hi Lung Guru

The trick worked. Thank you so much
Narendra
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to get XML root node name in 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.