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 » Problem When Accessing XML Attribute

Post new topic  Reply to topic
 Problem When Accessing XML Attribute « View previous topic :: View next topic » 
Author Message
MB Developer
PostPosted: Fri Nov 07, 2014 1:29 am    Post subject: Problem When Accessing XML Attribute Reply with quote

Disciple

Joined: 03 Feb 2014
Posts: 179

Hi Experts,
Greetings,



Input XML :

Code:


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
 <ns:myPolicy>
               <ns:rolePlayer xsi:type="ns:Communication" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                  <ns:actualStartDate>2014-11-07T00:00:00</ns:actualStartDate>
                  <ns:communicationContents xsi:type="ns:SpecifiedContent">
                     <ns:documents xsi:type="ns:ElectronicDocument">
                        <ns:categoryName>Chinna Biging</ns:categoryName>
                        <ns:startDate>2014-11-07</ns:startDate>
                        <ns:electronicStorageLocation>YES</ns:electronicStorageLocation>
                     </ns:documents>
                     <ns:triggeringEventName>ASDFGH</ns:triggeringEventName>
                  </ns:communicationContents>
               </ns:rolePlayer>
</ns:myPolicy>
</soapenv:Body>
</soapenv:Envelope>



ESQL Code:

Code:
DECLARE ns1 NAMESPACE 'http://www.ibm.com/ima/iaa/IAAXML';
CALL CopyMessageHeaders();
      -- CALL CopyEntireMessage();

      CREATE FIELD OutputRoot.XMLNSC.ns1:myPolicy.ns:rolePlayer;
      DECLARE outRef REFERENCE TO OutputRoot.XMLNSC.ns1:myPolicy;

      SET outRef.ns:rolePlayer.ns:actualStartDate = '2014-11-07T00:00:00';
      SET outRef.ns:rolePlayer.ns:communicationContents.ns:documents.ns:categoryName = 'Chinna Biging';
      SET outRef.ns:rolePlayer.ns:communicationContents.ns:documents.ns:startDate = '2014-11-07';
      SET outRef.ns:rolePlayer.ns:communicationContents.ns:documents.ns:electronicStorageLocation = 'YES';
      SET outRef.ns:rolePlayer.ns:communicationContents.ns:triggeringEventName = 'ASDFGH';      
      
      RETURN TRUE;


OUT put XML IS :
Code:
<NS1:myPolicy xmlns:NS1="http://www.ibm.com/ima/iaa/IAAXML">
 <NS1:rolePlayer>
  <NS1:actualStartDate>2014-11-07T00:00:00</NS1:actualStartDate>
  <NS1:communicationContents>
   <NS1:documents>
    <NS1:categoryName>Chinna Biging</NS1:categoryName>
    <NS1:startDate>2014-11-07</NS1:startDate>
    <NS1:electronicStorageLocation>YES</NS1:electronicStorageLocation>
   </NS1:documents>
   <NS1:triggeringEventName>ASDFGH</NS1:triggeringEventName>
  </NS1:communicationContents>
 </NS1:rolePlayer>
</NS1:myPolicy>



I want to access xml attribute also but above code is not working then I will change code like below

Code:
CALL CopyMessageHeaders();
      -- CALL CopyEntireMessage();

      CREATE FIELD OutputRoot.XMLNSC.ns1:myPolicy.ns:rolePlayer;
      DECLARE outRef REFERENCE TO OutputRoot.XMLNSC.ns1:myPolicy;

      SET outRef.ns:rolePlayer.(XMLNSC.Attribute)type.ns:actualStartDate = '2014-11-07T00:00:00';
      SET outRef.ns:rolePlayer.(XMLNSC.Attribute)type.ns:communicationContents.ns:documents.ns:categoryName = 'Chinna Biging';
      SET outRef.ns:rolePlayer.(XMLNSC.Attribute)type.ns:communicationContents.ns:documents.ns:startDate = '2014-11-07';
      SET outRef.ns:rolePlayer.(XMLNSC.Attribute)type.ns:communicationContents.ns:documents.ns:electronicStorageLocation = 'YES';
      SET outRef.ns:rolePlayer.(XMLNSC.Attribute)type.ns:communicationContents.ns:triggeringEventName = 'ASDFGH';      
      
      RETURN TRUE;



This code also not working So please give me the solution for this problem I want expected OUT Put xml file like below :

Code:
<NS1:myPolicy xmlns:NS1="http://www.ibm.com/ima/iaa/IAAXML">
 <NS1:rolePlayer>
 [color=red]<NS1::Communication xmlns:NS1="http://www.w3.org/2001/XMLSchema-instance">[/color]
  <NS1:actualStartDate>2014-11-07T00:00:00</NS1:actualStartDate>
  <NS1:communicationContents>
  [color=red]<NS1:SpecifiedContent>[/color]
   <NS1:documents>
    <NS1:categoryName>Chinna Biging</NS1:categoryName>
    <NS1:startDate>2014-11-07</NS1:startDate>
    <NS1:electronicStorageLocation>YES</NS1:electronicStorageLocation>
   </NS1:documents>
   <NS1:triggeringEventName>ASDFGH</NS1:triggeringEventName>
   </NS1:SpecifiedContent>
  </NS1:communicationContents>
  </NS1::Communication
 </NS1:rolePlayer>
</NS1:myPolicy>
Code:
<NS1:Main Data="Some Data ,** " DTDCREATEDATE="" CREATEDate="" xmlns:NS1="http://www.allservices/make">
   <NS1:MADICAL USED="YES">
      <NS1:TABLET>
         <NS1:Name/>
         <NS1:Data/>
     

      DECLARE myRef REFERENCE TO InputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ns1:MyRefend;

      CREATE FIELD OutputRoot.XMLNSC;
      DECLARE myRef REFERENCE TO OutputRoot.XMLNSC;
      CREATE FIRSTCHILD OF myRef AS myRef NAMESPACE rb1 NAME 'Main';

      SET myRef.(XMLNSC.Attribute)Data='Some Data ,**';
      SET myRef.(XMLNSC.Attribute)CREATEDate='';
            
      
      DECLARE myRef2 REFERENCE TO OutputRoot.XMLNSC;
      CREATE FIRSTCHILD OF myRef AS myRef2 NAMESPACE rb1 NAME 'MADICAL';

      SET myRef2.(XMLNSC.Attribute)USED='YES';
      
      DECLARE tabRef REFERENCE TO myRef2;
   
      CREATE FIRSTCHILD OF tabRef AS tabRef NAMESPACE rb1 NAME 'TABLET';
      CREATE FIRSTCHILD OF tabRef AS tabRef NAMESPACE rb1 NAME 'Name';
      CREATE NEXTSIBLING OF tabRef AS tabRef NAMESPACE rb1 NAME 'Data';

_________________
Thanks....


Last edited by MB Developer on Tue Mar 10, 2015 11:22 am; edited 1 time in total
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Nov 07, 2014 8:50 am    Post subject: Reply with quote

Grand High Poobah

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

I'd say your understanding of XML is limited. You talked about using attributes but nothing in your desired output looks like attributes.

Start building the desired output one field at a time.
You see, you'll get much closer.
You may also want to look for a local mentor
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
magvlvri
PostPosted: Fri Nov 07, 2014 12:01 pm    Post subject: Reply with quote

Apprentice

Joined: 07 Nov 2014
Posts: 26

primer on XML attributes

http://www.w3schools.com/xml/xml_attributes.asp
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 » Problem When Accessing XML Attribute
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.