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 » XML flattening using ESQL

Post new topic  Reply to topic
 XML flattening using ESQL « View previous topic :: View next topic » 
Author Message
akulavijay
PostPosted: Tue Jul 28, 2015 8:57 pm    Post subject: XML flattening using ESQL Reply with quote

Newbie

Joined: 17 Jul 2014
Posts: 9

Hi,
I was trying flatten a XML using ESQL SELECT clause, it appears to be working fine only when the child collection presents in the first parent but when it's missing all elements in the following collections are not selected.
Code:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:esq="http://ESQL/ESQLTesting/">
   <soapenv:Body>
      <esq:TransformationRequest>
         <collection>
            <catalog>
               <country>USA</country>
               <cd>
                  <title>Empire Burlesque</title>
                  <artist>Bob Dylan</artist>
               </cd>
               <cd>
                  <title>Greatest Hits</title>
               </cd>
            </catalog>
            <catalog>
               <country>UK</country>
               <cd>
                  <title>Hide your heart</title>
                  <artist>Dolly Parton</artist>
               </cd>
               <cd>
                  <title>One night only</title>
                  <artist>Bee Gees</artist>
               </cd>
            </catalog>
         </collection>
      </esq:TransformationRequest>
   </soapenv:Body>
</soapenv:Envelope>
wiil result in
Code:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <NS1:TransformationResponse xmlns:NS1="http://ESQL/ESQLTesting/">
         <collection>
            <cd>
               <title>Empire Burlesque</title>
            </cd>
            <cd>
               <title>Greatest Hits</title>
            </cd>
            <cd>
               <title>Hide your heart</title>
            </cd>
            <cd>
               <title>One night only</title>
            </cd>
         </collection>
      </NS1:TransformationResponse>
   </soapenv:Body>
</soapenv:Envelope>

where as
Code:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:esq="http://ESQL/ESQLTesting/">
   <soapenv:Body>
      <esq:TransformationRequest>
         <collection>
            <catalog>
               <country>USA</country>
               
            </catalog>
            <catalog>
               <country>UK</country>
               <cd>
                  <title>Hide your heart</title>
                  <artist>Dolly Parton</artist>
               </cd>
               <cd>
                  <title>One night only</title>
                  <artist>Bee Gees</artist>
               </cd>
            </catalog>
         </collection>
      </esq:TransformationRequest>
   </soapenv:Body>
</soapenv:Envelope>

will result in (CDs from UK are expected in the response but are missing)
Code:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <NS1:TransformationResponse xmlns:NS1="http://ESQL/ESQLTesting/">
         <collection/>
      </NS1:TransformationResponse>
   </soapenv:Body>
</soapenv:Envelope>

ESQL used is
Code:

DECLARE sampleMessage REFERENCE TO InputRoot.SOAP.Body.*:TransformationRequest.[1];
SET OutputRoot.XMLNSC.esq:TransformationResponse.collection.cd[] = SELECT cdRef.title FROM sampleMessage.catalog[] AS catalogRef, catalogRef.cd[] AS cdRef;

Please suggest me if there is something other than for loop to chieve the expected flattened xml
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jul 29, 2015 5:33 am    Post subject: Re: XML flattening using ESQL Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

akulavijay wrote:
Please suggest me if there is something other than for loop to chieve the expected flattened xml


A mapping node. A JCN. A .NETCn. An XSLT transformation node.

Some of these are better choices than others.
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 » XML flattening 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.