Author |
Message
|
nab054371 |
Posted: Wed Nov 15, 2006 2:58 pm Post subject: question on cardinality function behaviour |
|
|
Disciple
Joined: 15 Nov 2006 Posts: 173
|
Input XML Message:
<HTTPTest>
<URL>http://localhost:7080/svc1</URL>
<InputData>
<Data>Test</Data>
</InputData>
<InputData>
<Data>Test1</Data>
</InputData>
<OutputData>
<Data/>
</OutputData>
</HTTPTest>
Compute node esql:
CREATE COMPUTE MODULE testCARD_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- CALL CopyMessageHeaders();
CALL CopyEntireMessage();
SET OutputRoot.XML.HTTPTest.HTTPTestCARD = CARDINALITY(InputRoot.XML.HTTPTest.*[]);
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;
I was expecting SET OutputRoot.XML.HTTPTest.HTTPTestCARD = CARDINALITY(InputRoot.XML.HTTPTest.*[]); to come back with 4.However it comes up with 8.
Why?Am I missing something here? |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Nov 15, 2006 3:12 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You're using the wrong parser.
Use XMLNSC.
It's the compact parser. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
nab054371 |
Posted: Thu Nov 16, 2006 8:56 am Post subject: |
|
|
Disciple
Joined: 15 Nov 2006 Posts: 173
|
I am nto sure I agree with that.CARDINALITY function is independent of the parser used.Anyway when I do it with XMLNSC it gives me 0? |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Nov 16, 2006 9:01 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
CARDINALITY is working correctly for your Input XML message when parsed by the XML Parser, if your input data has line endings after your closing tags!
That is, there's a difference in the logical tree created for the XML "<A><b>q</b></A>" than for the XML "<A>
<b>q</b>
</A>"
The second will include more nodes to cover the line endings.
If you get zero when you use XMLNSC, then you're coding your statement wrong, or you didn't parse your data with XMLNSC. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
JosephGramig |
Posted: Thu Nov 16, 2006 12:22 pm Post subject: |
|
|
 Grand Master
Joined: 09 Feb 2006 Posts: 1244 Location: Gold Coast of Florida, USA
|
For instance, if you set the parser to XMLNSC in the MQInput node but use RfhUtil and put XML in the MQ Message Format field, you will get the XML parser.
This is because XMLNSC is the default parse and you over rode that... _________________ Joseph
Administrator - IBM WebSphere MQ (WMQ) V6.0, IBM WebSphere Message Broker (WMB) V6.1 & V6.0
Solution Designer - WMQ V6.0
Solution Developer - WMB V6.1 & V6.0, WMQ V5.3 |
|
Back to top |
|
 |
|