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 » Generating XML with same tags and root tags

Post new topic  Reply to topic
 Generating XML with same tags and root tags « View previous topic :: View next topic » 
Author Message
shwe
PostPosted: Tue Apr 30, 2013 12:16 am    Post subject: Generating XML with same tags and root tags Reply with quote

Novice

Joined: 28 Dec 2012
Posts: 13

Hi All,

I have a requirement to generate an XMl file using ESQL. The source for this interface is database

The structure of the XML is such that, it has one tag called party, which should appear twice with same root tag but with different sources.

<Envelope>
<Party partyType="PSI" partyRole="sender">
</party>
<Party partyType="TDP" partyRole="receiver">
</party>
</Envelope>

and my ESQL code is
SET OutputRoot.XMLNSC.INSTAT.Envelope.Party.(XMLNSC.Attribute)partyType ='PSI';

SET OutputRoot.XMLNSC.INSTAT.Envelope.Party.(XMLNSC.Attribute)partyRole =Ref.Agent1;

SET OutputRoot.XMLNSC.INSTAT.Envelope.Party.(XMLNSC.Attribute)partyType ='TDP';
SET OutputRoot.XMLNSC.INSTAT.Envelope.Party.(XMLNSC.Attribute)partyRole =Ref.Agent2;

When I execute this code, the 'Party' tag is generated only once and it always picks up the second value, First value is getting replaced.

Is it possible to generate the XML with the above structure, If so, how can it be achieved?
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Apr 30, 2013 12:57 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Is it possible to generate the XML with the above structure?
Yes! ( I don't think message broker would be the market leading ESB if it could not write a simple XML document ).
Quote:
If so, how can it be achieved
Declare two reference variables. One to point at InputRoot.Ref, the other pointing at OutputRoot.Envelope.
Then use the CREATE statement to add new elements under the OutputRoot reference.

See http://publib.boulder.ibm.com/infocenter/wmbhelp/v8r0m0/topic/com.ibm.etools.mft.doc/ak04950_.htm
and
http://publib.boulder.ibm.com/infocenter/wmbhelp/v8r0m0/topic/com.ibm.etools.mft.doc/ak04864_.htm

There are simpler methods that involve using a loop and array indexes, but REFERENCE variables always perform better.
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 » Generating XML with same tags and root tags
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.