|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Problem When Accessing XML Attribute |
« View previous topic :: View next topic » |
Author |
Message
|
MB Developer |
Posted: Fri Nov 07, 2014 1:29 am Post subject: Problem When Accessing XML Attribute |
|
|
 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 |
|
 |
fjb_saper |
Posted: Fri Nov 07, 2014 8:50 am Post subject: |
|
|
 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 |
|
 |
magvlvri |
Posted: Fri Nov 07, 2014 12:01 pm Post subject: |
|
|
Apprentice
Joined: 07 Nov 2014 Posts: 26
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|