|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Accessing elements in XMLNS message |
« View previous topic :: View next topic » |
Author |
Message
|
Sandman |
Posted: Mon Mar 26, 2007 4:47 am Post subject: Accessing elements in XMLNS message |
|
|
Centurion
Joined: 16 Oct 2001 Posts: 134 Location: Lincoln, RI
|
Can anyone please help me understand why only the first SET statement below functions as expected? I'm a namespace noob, so I apologize for that. But the incoming XMLNS message does not prefix every element within the message. Specifically, the AddAddressResponse command wrapper has no prefix. (Should it? IOW, does everything within an XMLNS message have to contain a prefix?)
Thank you.
Code: |
DECLARE msg NAMESPACE 'http://www.amica.com/amica_messaging';
DECLARE loc NAMESPACE 'http://www.amica.com/Location';
DECLARE impl NAMESPACE 'http://www.amica.com/Implementation';
SET Environment.Variables.COMMAND = InputRoot.XMLNS.msg:Message.msg:COMMAND;
SET Environment.Variables.AddAddressResponse = InputRoot.XMLNS.msg:Message.msg:COMMAND.AddAddressResponse;
|
Sample XML:
Code: |
<msg:Message xmlns="http://www.amica.com/amica_messaging" xmlns:msg="http://www.amica.com/amica_messaging" xmlns:adrImpl="http://www.amica.com/AddressImpl" xmlns:impl="http://www.amica.com/Implementation" xmlns:loc="http://www.amica.com/Location" xmlns:obj="http://www.amica.com/Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.amica.com/amica_messaging C:\PVCSWO~1\ENTERP~2\AMICAU~1\AddressUpdate.xsd" id="1174578008875" version="1.4" bodyType="Amica-XML" sourceLogicalId="CMA" destinationLogicalId="EDB" timeStampCreated="2007-03-22T10:40:08-05:00">
<msg:COMMAND>
<AddAddressResponse cmdType="request" id="ID00001" cmdMode="alwaysRespond">
<PostalAddress id="ID00002" implRef="ID00003">
<loc:streetAddress>122 Manley Dr.</loc:streetAddress>
<loc:additionalInformation>Test</loc:additionalInformation>
<loc:city>Pascoag</loc:city>
<loc:state>RI</loc:state>
<loc:zipCode>02859</loc:zipCode>
<loc:province />
<loc:county>Providence</loc:county>
<loc:fipsCountyCode />
<loc:country>USA</loc:country>
</PostalAddress>
<AddressImpl id="ID00003">
<impl:effectiveDate>2007-03-17</impl:effectiveDate>
<impl:modifedBy>A9438</impl:modifedBy>
</AddressImpl>
</AddAddressResponse>
</msg:COMMAND>
</msg:Message> |
|
|
Back to top |
|
 |
Vitor |
Posted: Mon Mar 26, 2007 4:52 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
The XML document defines a default namespace, so unprexifed elements actually belong to this namespace.
In your example, the msg namespace appears to be identical to the default, so I'd expect msg:AddAddressResponse to suceed. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Sandman |
Posted: Mon Mar 26, 2007 5:56 am Post subject: |
|
|
Centurion
Joined: 16 Oct 2001 Posts: 134 Location: Lincoln, RI
|
You're right, Vitor. Thank you. AAMOF, the developer who created this message has recently published a modification - in which he removed this code:
Code: |
xmlns="http://www.amica.com/amica_messaging" |
|
|
Back to top |
|
 |
Vitor |
Posted: Mon Mar 26, 2007 6:02 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Sandman wrote: |
You're right, Vitor. Thank you. AAMOF, the developer who created this message has recently published a modification - in which he removed this code:
Code: |
xmlns="http://www.amica.com/amica_messaging" |
|
And thus removing the default namspace, causing your original code to be correct.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Sandman |
Posted: Mon Mar 26, 2007 6:35 am Post subject: |
|
|
Centurion
Joined: 16 Oct 2001 Posts: 134 Location: Lincoln, RI
|
Then I am so
Thanks again. |
|
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
|
|
|
|