|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
accessing namespaced elements in XMLNS |
« View previous topic :: View next topic » |
Author |
Message
|
dweller |
Posted: Tue Mar 13, 2007 4:51 am Post subject: accessing namespaced elements in XMLNS |
|
|
Apprentice
Joined: 31 Oct 2006 Posts: 28
|
Hi,
i know there are old topics with the same problem, but nothing there helped me. I am trying to access element in xml message, which has namespaces.
Input message:
<?xml version="1.0" encoding="UTF-8"?>
<GeneralTDS:GeneralTDS xmlns:GeneralTDS="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/GeneralTDS" xmlns:MO_GeneralTDSAttributes="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MO_GeneralTDSAttributes" verb="Create">
<GeneralTDS:Attributes>
<MO_GeneralTDSAttributes:MO_GeneralTDSAttributes version="3.0.0" verb="Create" locale="en_US" delta="false">
<MO_GeneralTDSAttributes:FileWriteMode>o</MO_GeneralTDSAttributes:FileWriteMode>
<MO_GeneralTDSAttributes:OutFileName>20070313143211593.dat</MO_GeneralTDSAttributes:OutFileName>
</MO_GeneralTDSAttributes:MO_GeneralTDSAttributes>
</GeneralTDS:Attributes>
<GeneralTDS:Data>dsfsdfsd</GeneralTDS:Data>
</GeneralTDS:GeneralTDS>
Trace:
( 0 x 0 1 0 0 0 0 1 0 ) : X M L N S = (
( 0 x 0 5 0 0 0 0 1 8 ) : = (
( 0 x 0 6 0 0 0 0 1 1 ) : = ' 1 . 0 '
( 0 x 0 6 0 0 0 0 1 2 ) : = ' U T F - 8 '
)
( 0 x 0 1 0 0 0 0 0 0 ) : G e n e r a l T D S : G e n e r a l T D S = (
( 0 x 0 7 0 0 0 0 1 2 ) x m l n s : G e n e r a l T D S = ' h t t p : / / w w w . i b m . c o m / w e b s p h e r e / c r o s s w o r l d s / 2 0 0 2 / B O S c h e m a / G e n e r a l T D S '
( 0 x 0 7 0 0 0 0 1 2 ) x m l n s : M O _ G e n e r a l T D S A t t r i b u t e s = ' h t t p : / / w w w . i b m . c o m / w e b s p h e r e / c r o s s w o r l d s / 2 0 0 2 / B O S c h e m a / M O _ G e n e r a l T D S A t t r i b u t e s '
( 0 x 0 3 0 0 0 0 0 0 ) : v e r b = ' C r e a t e '
( 0 x 0 1 0 0 0 0 0 0 ) : G e n e r a l T D S : A t t r i b u t e s = (
( 0 x 0 1 0 0 0 0 0 0 ) : M O _ G e n e r a l T D S A t t r i b u t e s : M O _ G e n e r a l T D S A t t r i b u t e s = (
( 0 x 0 3 0 0 0 0 0 0 ) : v e r s i o n = ' 3 . 0 . 0 '
( 0 x 0 3 0 0 0 0 0 0 ) : v e r b = ' C r e a t e '
( 0 x 0 3 0 0 0 0 0 0 ) : l o c a l e = ' e n _ U S '
( 0 x 0 3 0 0 0 0 0 0 ) : d e l t a = ' f a l s e '
( 0 x 0 1 0 0 0 0 0 0 ) : M O _ G e n e r a l T D S A t t r i b u t e s : F i l e W r i t e M o d e = (
( 0 x 0 2 0 0 0 0 0 0 ) : = ' o '
)
( 0 x 0 1 0 0 0 0 0 0 ) : M O _ G e n e r a l T D S A t t r i b u t e s : O u t F i l e N a m e = (
( 0 x 0 2 0 0 0 0 0 0 ) : = ' 2 0 0 7 0 3 1 3 1 4 2 0 4 6 2 8 1 . d a t '
)
)
)
( 0 x 0 1 0 0 0 0 0 0 ) : G e n e r a l T D S : D a t a = (
( 0 x 0 2 0 0 0 0 0 0 ) : = ' d s f s d f s d '
)
)
)
How did i try:
DECLARE NS1 NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/GeneralTDS';
--DECLARE NS1 NAMESPACE 'GeneralTDS';
SET OutputRoot.XMLNS.envelope.attachment = InputRoot.XMLNS.NS1:GeneralTDS.Data;
SET OutputRoot.XMLNS.envelope.attachment0 = InputRoot.XMLNS.NS1:GeneralTDS.NS1:Data;
SET OutputRoot.XMLNS.envelope.attachment1 = InputRoot.XMLNS.GeneralTDS.NS1:Data;
SET OutputRoot.XMLNS.envelope.attachment2 = InputRoot.XMLNS.GeneralTDS.Data;
SET OutputRoot.XMLNS.envelope.attachment3 = InputRoot.XMLNS;
SET OutputRoot.XMLNS.envelope.attachment4 = InputRoot.XMLNS.(XML.Element)*.(XML.Element)NS1:Data;
SET OutputRoot.XMLNS.envelope.attachment5 = InputRoot.XMLNS.(XML.Element)NS1:GeneralTDS.(XML.Element)NS1:Data;
Result:
<envelope>
<attachment3>
<GeneralTDS:GeneralTDS xmlns:GeneralTDS="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/GeneralTDS" xmlns:MO_GeneralTDSAttributes="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MO_GeneralTDSAttributes" verb="Create">
<GeneralTDS:Attributes>
<MO_GeneralTDSAttributes:MO_GeneralTDSAttributes version="3.0.0" verb="Create" locale="en_US" delta="false">
<MO_GeneralTDSAttributes:FileWriteMode>o</MO_GeneralTDSAttributes:FileWriteMode>
<MO_GeneralTDSAttributes:OutFileName>20070313143211593.dat</MO_GeneralTDSAttributes:OutFileName>
</MO_GeneralTDSAttributes:MO_GeneralTDSAttributes>
</GeneralTDS:Attributes>
<GeneralTDS:Data>dsfsdfsd</GeneralTDS:Data>
</GeneralTDS:GeneralTDS>
</attachment3>
</envelope>
What am i missing?
wmb 5.0.9 |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Tue Mar 13, 2007 5:09 am Post subject: Re: accessing namespaced elements in XMLNS |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
Hm
I dont know but for me this:
Code: |
SET OutputRoot.XMLNS.envelope.attachment0 = InputRoot.XMLNS.NS1:GeneralTDS.NS1:Data; |
should work
Marcin |
|
Back to top |
|
 |
dweller |
Posted: Tue Mar 13, 2007 5:09 am Post subject: |
|
|
Apprentice
Joined: 31 Oct 2006 Posts: 28
|
ok so i've found the reason, the problem was input xml  |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Tue Mar 13, 2007 5:17 am Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
dweller wrote: |
ok so i've found the reason, the problem was input xml  |
What was it ?
For me it should work with input message which you showed us here.
Marcin |
|
Back to top |
|
 |
dweller |
Posted: Tue Mar 13, 2007 5:21 am Post subject: |
|
|
Apprentice
Joined: 31 Oct 2006 Posts: 28
|
well it's not input message, i get this message generated in the middle of the flow. and it was generated like this:
DECLARE NS1 NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/GeneralTDS';
DECLARE NS2 NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MO_GeneralTDSAttributes';
DECLARE ref_GeneralTDS REFERENCE TO "OutputRoot"."XMLNS"."GeneralTDS:GeneralTDS";
SET ref_GeneralTDS."GeneralTDS:Data" = CAST (InputRoot.BLOB.BLOB AS CHARACTER CCSID 819 ENCODING MQENC_NATIVE);
so as i understand, this isn't really an xml with correct namespaces, so this is how i access it:
InputRoot.XMLNS."GeneralTDS:GeneralTDS"."GeneralTDS:Data"; |
|
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
|
|
|
|