Author |
Message
|
gakd1987 |
Posted: Fri Aug 23, 2013 4:22 pm Post subject: Using XMLNSC parser - reading InputRoot coming from MQinput |
|
|
Apprentice
Joined: 20 Aug 2013 Posts: 26
|
Hi All ,
Below is sample of my XML with XMLSCHEMA declartion.
<Splitter xmlns="http://level/BelSplitter"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="tns:http://level/BelSplitter C:\Project\Dev\BelSplitter.xsd">
<Func_Group>
<GS03>sdasdda</GS03>
<GS08>452113</GS08>
<Subscriber>
<LOOP_ABC_NM1>sakjdjhasd</LOOP_ABC_NM1>
</Subscriber>
</Func_Group>
</Splitter>
I am using MQInput node to validate the XML through XMLNSC parser W.R.T a messageset which is validation it properly. I am passing the output of the MQinput node to a Comput node where I have transform the message and in turn its connected to MQOutput .
Below is the code :-
----------------------
CREATE COMPUTE MODULE TestXMLNSC_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- CALL CopyMessageHeaders();
CALL CopyEntireMessage();
RETURN TRUE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
SET OutputRoot.XMLNS.Splitter.Func_Group.GS08 VALUE = FIELDVALUE(InputRoot.XMLNSC.Splitter.Func_Group.(XMLNSC.Field)GS03);
END;
END MODULE;
The output message what I get in the MQOutput is :-
<Splitter><Func_Group><GS08></GS08></Func_Group></Splitter> .
I dont know why I am unable read the InputRoot value .
Do I have to declare the namespace's in the Compute node procedure.
Am I missing something.. |
|
Back to top |
|
 |
smdavies99 |
Posted: Fri Aug 23, 2013 9:52 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
1) Please encase you code snipets within code tags. There is a lit of common tags just above the edit box where you type your message
2) Do you have a good reason to XMLNS on the output side? Unless you have then you really need to use XMLNSC
3) Have you tried looking at the actual message namespaces as you traverse the tree.
I'd lookup the FIELNAMESPACE function. It can be incredibly helpful.
4) do you really need the FIELDVALUE and (XMLNSC.Field) bits of your statement? _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
dogorsy |
Posted: Fri Aug 23, 2013 11:09 pm Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
1- you are changing the CopyEntireMessage, which is not a good idea, as after being changed it does not what it is supposed to do anymore. so your code should be outside the procedure.
2- Get a debug user trace and that will show what the code is doing, just follow it and you will find what the problem is.
As smdavies99 said, FIELDNAMESPACE may not be needed. What do you want to do ?, adding ESQL functions without knowing what they do will not help. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Aug 24, 2013 6:43 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Yes you have to declare the namespace. Furthermore you have to use it. And in case of a default namespace, you have to use it at every node to which it applies...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
gakd1987 |
Posted: Mon Aug 26, 2013 10:32 am Post subject: |
|
|
Apprentice
Joined: 20 Aug 2013 Posts: 26
|
Hi I added the trace node and found the below :-
BIP2537I: Node 'TestXMLNSC.Compute': Executing statement ''BEGIN ... END;'' at ('.TestXMLNSC_Compute.Main', '2.2').
BIP2537I: Node 'TestXMLNSC.Compute': Executing statement ''CopyEntireMessage();'' at ('.TestXMLNSC_Compute.Main', '4.3').
BIP2538I: Node 'TestXMLNSC.Compute': Evaluating expression ''CopyEntireMessage()'' at ('.TestXMLNSC_Compute.Main', '4.8').
BIP2537I: Node 'TestXMLNSC.Compute': Executing statement ''BEGIN ... END;'' at ('.TestXMLNSC_Compute.CopyEntireMessage', '1.39').
BIP2537I: Node 'TestXMLNSC.Compute': Executing statement ''SET OutputRoot = InputRoot;'' at ('.TestXMLNSC_Compute.CopyEntireMessage', '2.3').
BIP2539I: Node 'TestXMLNSC.Compute': Evaluating expression ''InputRoot'' at ('.TestXMLNSC_Compute.CopyEntireMessage', '2.20'). This resolved to ''InputRoot''. The result was ''ROW... Root Element Type=16777216 NameSpace='' Name='Root' Value=NULL''.
BIP2568I: Node 'TestXMLNSC.Compute': Copying sub-tree from ''InputRoot'' to ''OutputRoot''.
BIP2537I: Node 'TestXMLNSC.Compute': Executing statement ''SET OutputRoot.XMLNS.Splitter.Func_Group.GS08 VALUE = FIELDVALUE(InputRoot.XMLNSC.Splitter.Func_Group.(XMLNSC.Field)GS03);'' at ('.TestXMLNSC_Compute.CopyEntireMessage', '3.9').
BIP2543I: Node 'TestXMLNSC.Compute': ('.TestXMLNSC_Compute.CopyEntireMessage', '3.74') : Failed to navigate to path element number '3' because it does not exist.
BIP2540I: Node 'TestXMLNSC.Compute': Finished evaluating expression ''FIELDVALUE(InputRoot.XMLNSC.Splitter.Func_Group.(XMLNSC.Field)GS03)'' at ('.TestXMLNSC_Compute.CopyEntireMessage', '3.63'). The result was ''NULL''.
BIP2537I: Node 'TestXMLNSC.Compute': Executing statement ''RETURN TRUE;'' at ('.TestXMLNSC_Compute.Main', '5.3').
BIP4007I: Message propagated to 'out' terminal of node 'TestXMLNSC.Compute'.
BIP2638I: The MQ output node 'TestXMLNSC.MQOutput' attempted to write a message to queue ''ESQL.SIMPLE_OUT'' connected to queue manager ''TAKPE03''. The MQCC was '0' and the MQRC was '0'.
BIP2622I: Message successfully output by output node 'TestXMLNSC.MQOutput' to queue ''ESQL.SIMPLE_OUT'' on queue manager ''TAKPE03''.
I dont know why it is not able to navigate to the third element in the inputRoot i.e. Splitter . Is it because it has the namespace, schema & schemalocation declaration in it . If thats the case how can I read it and set it to my output ?
The first element in my input is : -
<Splitter xmlns="http://kp.org/kpeg/CASplitter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="tns:http://kp.org/kpeg/CASplitter C:\Project\KPEG\Dev\Splitter\CASplitter.xsd"> |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Aug 26, 2013 10:40 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
dogorsy |
Posted: Mon Aug 26, 2013 9:47 pm Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
Even though it is not the output from a trace node, you have all the info you need to work out why it is not working. You even highlighted the relevant part:
Quote: |
Failed to navigate to path element number '3' because it does not exist.
|
and
Quote: |
''FIELDVALUE(InputRoot.XMLNSC.Splitter.Func_Group.(XMLNSC.Field)GS03)'' |
so, IF YOU CAN COUNT up to three, look at the path in the message, and you will see why it is not working. |
|
Back to top |
|
 |
ydeonia |
Posted: Mon Aug 26, 2013 9:53 pm Post subject: |
|
|
Acolyte
Joined: 29 Oct 2012 Posts: 74
|
Use
Code: |
FIELDVALUE(InputRoot.*:XMLNSC.*:Splitter.*:Func_Group.(XMLNSC.Field)GS03) |
I believe you have namespace issue. Use the Trace node with '$ROOT' parameter. You will get the XML structure the way Broker reading it. |
|
Back to top |
|
 |
dogorsy |
Posted: Mon Aug 26, 2013 10:02 pm Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
ydeonia wrote: |
Use
Code: |
FIELDVALUE(InputRoot.*:XMLNSC.*:Splitter.*:Func_Group.(XMLNSC.Field)GS03) |
I believe you have namespace issue. Use the Trace node with '$ROOT' parameter. You will get the XML structure the way Broker reading it. |
@yedonia writing the answer for the OP will not help him.
He has already been given enough info to work it out for himself.
On top of that, what you have written is wrong, XMLNSC is a parser and does not have a namespace, so it should not be *:XMLNSC.
The trace node is not going to give the OP any more detail than he already has.
Besides, you don't seem to have given consideration to the points raised by smdavies99. If you don't, you will have lots of other problems |
|
Back to top |
|
 |
ydeonia |
Posted: Tue Aug 27, 2013 12:55 am Post subject: |
|
|
Acolyte
Joined: 29 Oct 2012 Posts: 74
|
dogorsy wrote: |
@yedonia writing the answer for the OP will not help him.
He has already been given enough info to work it out for himself. |
I just tried to help him further if he is not able to find it out.
dogorsy wrote: |
On top of that, what you have written is wrong, XMLNSC is a parser and does not have a namespace, so it should not be *:XMLNSC. |
I agree I have mistakenly written that . I tried to correct that after I posted it . The forum didnt allowed me to edit it.
dogorsy wrote: |
The trace node is not going to give the OP any more detail than he already has. |
If he use the trace node he can see how the XMl is being readed. He can see XMLNSC Field Type constant like XMLNSC.Field, XMLNSC.CDataField,XMLNSC.Attribute and much more.. It will be helpful to him.
dogorsy wrote: |
Besides, you don't seem to have given consideration to the points raised by smdavies99. If you don't, you will have lots of other problems |
Yes I havent seen the points raised by the smdavies99 after I posted mine. The user can use the RCD node to reset the XMLNS to XMLNSC and still many systems uses XMLNS domain. Even for me the publisher is sending the messages of XMLNS domain. I had to use RCD to reset .
Thanks Anyway may be user got enough information now. He can fix Cheers  |
|
Back to top |
|
 |
dogorsy |
Posted: Tue Aug 27, 2013 2:56 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
ydeonia wrote: |
dogorsy wrote: |
@yedonia writing the answer for the OP will not help him.
He has already been given enough info to work it out for himself. |
I just tried to help him further if he is not able to find it out.
dogorsy wrote: |
On top of that, what you have written is wrong, XMLNSC is a parser and does not have a namespace, so it should not be *:XMLNSC. |
I agree I have mistakenly written that . I tried to correct that after I posted it . The forum didnt allowed me to edit it.
dogorsy wrote: |
The trace node is not going to give the OP any more detail than he already has. |
If he use the trace node he can see how the XMl is being readed. He can see XMLNSC Field Type constant like XMLNSC.Field, XMLNSC.CDataField,XMLNSC.Attribute and much more.. It will be helpful to him.
dogorsy wrote: |
Besides, you don't seem to have given consideration to the points raised by smdavies99. If you don't, you will have lots of other problems |
Yes I havent seen the points raised by the smdavies99 after I posted mine.
Quote: |
The user can use the RCD node to reset the XMLNS to XMLNSC and still many systems uses XMLNS domain. Even for me the publisher is sending the messages of XMLNS domain. I had to use RCD to reset . |
Thanks Anyway may be user got enough information now. He can fix Cheers  |
The bottom line is: giving wrong advice is worse than don't saying anything. For example you said:
Quote: |
The user can use the RCD node to reset the XMLNS to XMLNSC and still many systems uses XMLNS domain. |
The user DOES NOT NEED to use the RCD node. He is setting XMLNS in the OutputRoot, and he should not.
Quote: |
Even for me the publisher is sending the messages of XMLNS domain. I had to use RCD to reset .
|
The publisher DOES NOT send messages of XMLNS domain. The publisher will send XML messages, it is your flow that decides what parser to use. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Aug 27, 2013 5:01 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
ydeonia wrote: |
I just tried to help him further if he is not able to find it out. |
The OP's site bans access to the InfoCenter & Google?
ydeonia wrote: |
The forum didnt allowed me to edit it. |
And posting a separate correction never occured to you?
ydeonia wrote: |
The user can use the RCD node to reset the XMLNS to XMLNSC and still many systems uses XMLNS domain. Even for me the publisher is sending the messages of XMLNS domain. I had to use RCD to reset . |
This is completely incorrect. No message data outside the WMB software uses a domain unless it actually has an RFH2 header on it. If it does happen to have XMLNS, what of it? Did I miss the email about that being unsupported? Why bother with an RCD? This information is a mixture of wrong and misleading.
ydeonia wrote: |
may be user got enough information now. |
Maybe. Or maybe not. Or maybe he'll be back asking you for further clarification
ydeonia wrote: |
He can fix |
Or not. And in any event only until next time. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|