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 » Not Able to Add element to XML Message

Post new topic  Reply to topic Goto page Previous  1, 2
 Not Able to Add element to XML Message « View previous topic :: View next topic » 
Author Message
eai_guy
PostPosted: Tue Feb 09, 2010 11:10 pm    Post subject: Reply with quote

Voyager

Joined: 18 Oct 2007
Posts: 90

Hi

I tried making use of FILEDNAMESPACE function to get namespace of below XML Message
Code:

<?xml version="1.0" encoding="UTF-8"?>
<TenantOrgMsg xmlns="http://abc.xyz.com/TenantOrigMsgSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://abc.xyz.com/TenantOrigMsgSchema TenantOrgMsg.xsd ">
<L1Element1>L1Element1</L1Element1>
 <L1Element2 L1attr="121">
  <L2Element1>L2Element1</L2Element1>
 </L1Element2>
</TenantOrgMsg>



ESQL Code - It does not store anything in X , X is always empty
Code:

DECLARE X CHARACTER;
SET X = FIELDNAMESPACE(InputRoot.xmlnsc.TenantOrgMsg )


Wildcard will be as below ?

Code:

SET X = FIELDNAMESPACE(InputRoot.xmlnsc.*);


Am I missing something ?
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Feb 10, 2010 1:51 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5543
Location: Southampton


That code is not doing what you think it's doing. Time to debug your code.
I suggest a user trace. It will tell you *why* it is going wrong ( the debugger will only show you that it is going wrong ).
Back to top
View user's profile Send private message
eai_guy
PostPosted: Wed Feb 10, 2010 12:17 pm    Post subject: Reply with quote

Voyager

Joined: 18 Oct 2007
Posts: 90

I m not able to run a user trace as I have dependency on Admin

Trace node is not giving much information........

For below message to get the namespace of TenantOrgMsg. I tried accessing the InputRoot in multilpe ways Please see below ESQLs. Have anyone used FIELDNAMSPACE, FIELDNAME functions here ?
Code:

<?xml version="1.0" encoding="UTF-8"?>
<TenantOrgMsg xmlns="http://abc.xyz.com/TenantOrigMsgSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://abc.xyz.com/TenantOrigMsgSchema TenantOrgMsg.xsd ">
<L1Element1>L1Element1</L1Element1>
 <L1Element2 L1attr="121">
  <L2Element1>L2Element1</L2Element1>
 </L1Element2>
</TenantOrgMsg>


1. SET X = FIELDNAMESPACE(InputRoot.XMLNSC.TenantOrgMsg.xmlns);

2. SET X = FIELDNAMESPACE(InputRoot.xmlnsc.TenantOrgMsg) ;

3. SET X = FIELDNAMESPACE(InputRoot.xmlnsc.*);

[code]

Can anyone please throw some light on this ?
Back to top
View user's profile Send private message
mgk
PostPosted: Wed Feb 10, 2010 12:37 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1647

use *:* as the wildcard
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
eai_guy
PostPosted: Wed Feb 10, 2010 2:30 pm    Post subject: Reply with quote

Voyager

Joined: 18 Oct 2007
Posts: 90

Thanks Everyone

Below solved it . This will always fetch namespace of root element and then I can attach new xml element to this root.

Code:

FIELDNAMESPACE(InputRoot.*[3].*[2]);
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Feb 10, 2010 2:41 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5543
Location: Southampton

Quote:
This will always fetch namespace of root element...
That looks fragile. You are assuming that
a) InputRoot.XMLNSC is always the third child of InputRoot.
b) The document root element will always be the second child of InputRoot.XMLNSC.

Neither of those assumptions should be hardcoded into your flow. What if someone supplies a message with an extra header ( e.g. an RFH2 )? What if the input message does not always have an XML declaration at the start?

I suggest this (not tested):
Code:
SET rootNamespace = FIELDNAMESPACE(InputRoot.XMLNSC.(XMLNSC.Folder)*:*);
It will return the namespace of the first element child ( i.e. the root element ) under the message body.
Back to top
View user's profile Send private message
eai_guy
PostPosted: Wed Feb 10, 2010 4:51 pm    Post subject: Reply with quote

Voyager

Joined: 18 Oct 2007
Posts: 90

Hey,

Thanks a lot.

That worked...........

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

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Not Able to Add element to XML Message
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.