Author |
Message
|
WMBSAM |
Posted: Tue Dec 01, 2009 9:20 pm Post subject: Move statement issue |
|
|
 Voyager
Joined: 02 Oct 2009 Posts: 90 Location: Atlanta
|
Hello i have a issue regarding the move statement in esql
Quote: |
(0x01000000:Folder):XMLNSC = ( ['xmlnsc' : 0x730bdf8]
(0x01000000:Folder)http://www.abc.com:SearchResponse = (
(0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:p925 = 'http://www.abc.com' (CHARACTER)
(0x01000000:Folder )http://www.abc.com/:ResponseHeader = (
(0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:p820 = 'http://www.abc.com' (CHARACTER)
(0x03000000:PCDataField ):ResponseTS = '2009-10-29T02:42:22.194Z' (CHARACTER)
(0x03000000:PCDataField ):RequestMessageID = '166856749' (CHARACTER)
(0x03000000:PCDataField ):CorrelationID = '166856749' (CHARACTER)
(0x03000000:PCDataField ):ResponseMessageID = '1575' (CHARACTER)
(0x03000000:PCDataField ):NumOfRowsReturned = '4' (CHARACTER)
)
(0x01000000:Folder )http://www.abc.com:Status = (
(0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:p961 = 'http://www.abc.com' (CHARACTER)
(0x03000000:PCDataField ):StatusCode = '000' (CHARACTER)
(0x03000000:PCDataField ):StatusDesc = 'Web Service - Success' (CHARACTER)
)
(0x01000000:Folder )http://www.abc.com:ResponseData = (
(0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:p500 = 'http://www.abc.com' (CHARACTER)
(0x03000000:PCDataField ):TransID = '8910763' (CHARACTER)
(0x03000000:PCDataField ):ResponseCode = '00' (CHARACTER)
(0x03000000:PCDataField ):MessageTypeCode = 'TC05' (CHARACTER)
)
(0x01000000:Folder )http://www.abc.com:ResponseData = (
(0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:p500 = 'http://www.abc.com' (CHARACTER)
(0x03000000:PCDataField ):DataSource = 'XYZS' (CHARACTER)
(0x03000000:PCDataField ):SequenceID = '209178' (CHARACTER)
(0x03000000:PCDataField ):CpdDate = '2009-04-20' (CHARACTER)
(0x03000000:PCDataField ):CpdTime = '60553.0' (CHARACTER)
(0x03000000:PCDataField ):TransID = '289706' (CHARACTER)
)
(0x01000000:Folder )http://www.abc.com:ResponseData = (
(0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:p500 = 'http://www.abc.com' (CHARACTER)
(0x03000000:PCDataField ):DataSource = 'XYZS' (CHARACTER)
(0x03000000:PCDataField ):SequenceID = '20867' (CHARACTER)
(0x03000000:PCDataField ):CpdDate = '2009-04-20' (CHARACTER)
(0x03000000:PCDataField ):CpdTime = '60556.0' (CHARACTER)
(0x03000000:PCDataField ):TransID = '8914479' (CHARACTER)
(0x01000000:Folder )http://www.abc.com:ResponseData = (
(0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:p500 = 'http://www.abc.com' (CHARACTER)
(0x03000000:PCDataField ):DataSource = 'XYZS' (CHARACTER)
(0x03000000:PCDataField ):SequenceID = '20867' (CHARACTER)
(0x03000000:PCDataField ):CpdDate = '2009-04-20' (CHARACTER)
(0x03000000:PCDataField ):CpdTime = '60556.0' (CHARACTER)
(0x03000000:PCDataField ):TransID = '89479' (CHARACTER)
)
)
)
)
|
I have the following code:
Quote: |
DECLARE start REFERENCE TO InputRoot.XMLNSC.ns:SearchResponse;
DECLARE InputRef REFERENCE TO InputRoot.XMLNSC.ns10:SearchResponse.ns34:ResponseData[1];
MOVE InputRef NEXTSIBLING;(moves to next sibling it works)
MOVE InputRef NEXTSIBLING;(moves to next sibling again move to next sibling it works)
MOVE InputRef FIRSTCHILD Name 'ResponseData';(it doesn't work)
|
actually my requirement is that there are 64 elements of field responsdata and after traversing thru them say at 60 elements becoz of certain condition then again i have to move to responsedata[1] for which i am using the firstchild statement which doesn't work.
Any suggestions??  |
|
Back to top |
|
 |
AkankshA |
Posted: Tue Dec 01, 2009 11:01 pm Post subject: |
|
|
 Grand Master
Joined: 12 Jan 2006 Posts: 1494 Location: Singapore
|
did you try moving it first to parent and then to first child...
Code: |
DECLARE start REFERENCE TO InputRoot.XMLNSC.ns:SearchResponse;
DECLARE InputRef REFERENCE TO InputRoot.XMLNSC.ns10:SearchResponse.ns34:ResponseData[1];
MOVE InputRef NEXTSIBLING;(moves to next sibling it works)
MOVE InputRef NEXTSIBLING;(moves to next sibling again move to next sibling it works)
[b]MOVE InputRef PARENT[/b];
MOVE InputRef FIRSTCHILD Name 'ResponseData';(it doesn't work)
|
_________________ Cheers |
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 02, 2009 7:01 am Post subject: Re: Move statement issue |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
WMBSAM wrote: |
i have to move to responsedata[1] for which i am using the firstchild statement which doesn't work.
|
FIRSTCHILD would work if the reference was pointing to a high level level of which it was a child; if there was a "firstsibling" it would do what you want.
In this one specific instance, you should be ok moving the reference back by number (i.e. repointing at 1). It's absolutely correct to move through the 64 elements as you're doing it because to find the nth element by number, WMB will count through n-1 elements and NEXTSIBLING is far, far more efficient. But to find the first element, the broker doesn't have to count very far. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
WMBSAM |
Posted: Wed Dec 02, 2009 11:29 am Post subject: |
|
|
 Voyager
Joined: 02 Oct 2009 Posts: 90 Location: Atlanta
|
AkankshA wrote: |
did you try moving it first to parent and then to first child...
Code: |
DECLARE start REFERENCE TO InputRoot.XMLNSC.ns:SearchResponse;
DECLARE InputRef REFERENCE TO InputRoot.XMLNSC.ns10:SearchResponse.ns34:ResponseData[1];
MOVE InputRef NEXTSIBLING;(moves to next sibling it works)
MOVE InputRef NEXTSIBLING;(moves to next sibling again move to next sibling it works)
[b]MOVE InputRef PARENT[/b];
MOVE InputRef FIRSTCHILD Name 'ResponseData';(it doesn't work)
|
|
I have made the changes you have said and now the code looks like the below:
Code: |
DECLARE start REFERENCE TO InputRoot.XMLNSC.ns:SearchResponse;
DECLARE InputRef REFERENCE TO start.ns34:ResponseData[1];
WHILE LASTMOVE(InputRef) DO
MOVE InputRef NEXTSIBLING; (it works)
MOVE InputRef NEXTSIBLING; (it works)
MOVE InputRef PARENT;(it works)
MOVE InputRef FIRSTCHILD Name 'ResponseData';(it doesn't work)
|
there is no change in the inputref after it executes the last statement
but if i change the last statement to
Quote: |
MOVE InputRef FIRSTCHILD |
then the pointer refers to namespace as it is the first chile 'http://www.abc.com'
so is ther any way that i can reach the first element responsedata[1] without using the previous sibling right from the 64th element
and also one more question :
can someone give me an example of the following statement:
Quote: |
MOVE cursor FIRSTCHILD TYPE XML.Name 'Field1'; |
becoz i thought this statement may help in my context
i was going thru the following link:
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=/com.ibm.etools.mft.doc/ak05090_.htm |
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 02, 2009 11:42 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
WMBSAM wrote: |
but if i change the last statement to
Quote: |
MOVE InputRef FIRSTCHILD |
then the pointer refers to namespace as it is the first chile 'http://www.abc.com' |
Yes, because that literally is the first child.
WMBSAM wrote: |
so is ther any way that i can reach the first element responsedata[1] without using the previous sibling right from the 64th element |
Yes. Something like:
Code: |
SET InputRef = start.ns34:ResponseData[1] |
But...
It should work if you use XMLNSC.Name not XML.Name, because that would match the parser you've used.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
WMBSAM |
Posted: Wed Dec 02, 2009 12:24 pm Post subject: |
|
|
 Voyager
Joined: 02 Oct 2009 Posts: 90 Location: Atlanta
|
Quote: |
Yes. Something like:
Code:
SET InputRef = start.ns34:ResponseData[1]
[code] |
i did the same thing it was posted in the previous reply
Quote: |
I have made the changes you have said and now the code looks like the below:
Code:
DECLARE start REFERENCE TO InputRoot.XMLNSC.ns:SearchResponse;
DECLARE InputRef REFERENCE TO start.ns34:ResponseData[1];
WHILE LASTMOVE(InputRef) DO
MOVE InputRef NEXTSIBLING; (it works)
MOVE InputRef NEXTSIBLING; (it works)
MOVE InputRef PARENT;(it works)
MOVE InputRef FIRSTCHILD Name 'ResponseData';(it doesn't work)
|
Quote: |
It should work if you use XMLNSC.Name not XML.Name, because that would match the parser you've used |
i made use of the following code :
MOVE InputRef FIRSTCHILD TYPE XMLNSC.Name 'ResponseData';(also tried responsedata[1] but no result)
it says syntax error can you give a exact usage of the statement |
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 02, 2009 12:31 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
WMBSAM wrote: |
i made use of the following code :
MOVE InputRef FIRSTCHILD TYPE XMLNSC.Name 'ResponseData';(also tried responsedata[1] but no result)
it says syntax error can you give a exact usage of the statement |
I don't have a copy of WMB to hand atm, but according to that link you posted there should be a NAME before the 'ResponseData' _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
WMBSAM |
Posted: Wed Dec 02, 2009 12:53 pm Post subject: |
|
|
 Voyager
Joined: 02 Oct 2009 Posts: 90 Location: Atlanta
|
Vitor Believe it or not the following statement worked!!
MOVE InputRef FIRSTCHILD NAMESPACE * NAME 'ResponseData';
Thanks for the intime response Vitor thanks alot!!!
 |
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 02, 2009 1:31 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
WMBSAM wrote: |
Vitor Believe it or not the following statement worked!!
MOVE InputRef FIRSTCHILD NAMESPACE * NAME 'ResponseData'; |
Ah, right, the name's unique so you don't need a type. Should have thought of that....
WMBSAM wrote: |
Thanks for the intime response Vitor thanks alot!!!
 |
You're quite welcome. But my comment about not mixing XML & XMLNSC constants is still true, if not relevant to your problem.
Glad you got it fixed.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Dec 02, 2009 9:21 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Also when moving to NEXT/PREVIOUSSIBLING or LAST/FIRSTCHILD in XMLNSC it would be prudent to add at least some type information like
Code: |
MOVE myref TO NEXT SIBLING REPEAT TYPE; |
If you omit the type you may be in for some surprises like moving the cursor to a different type (namespace declaration, etc...) instead of an element...
You can always spell out the type like (XMLNSC.Element).
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
WMBSAM |
Posted: Thu Dec 03, 2009 4:23 pm Post subject: |
|
|
 Voyager
Joined: 02 Oct 2009 Posts: 90 Location: Atlanta
|
Quote: |
You can always spell out the type like (XMLNSC.Element). |
But when i try to do that it gives a warning saying:
Identifier "XMLNSC.Element" cannot be resolved.
here is my updated statement looks like:
Code: |
MOVE InputRef FIRSTCHILD TYPE XMLNSC.Element NAMESPACE * NAME 'ResponseData'; |
|
|
Back to top |
|
 |
Vitor |
Posted: Thu Dec 03, 2009 7:13 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
WMBSAM wrote: |
But when i try to do that it gives a warning saying:
Identifier "XMLNSC.Element" cannot be resolved.
|
Because it can't. According to the documentation here, the correct type is XMLNSC.Field.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Dec 04, 2009 2:50 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Vitor wrote: |
WMBSAM wrote: |
But when i try to do that it gives a warning saying:
Identifier "XMLNSC.Element" cannot be resolved.
|
Because it can't. According to the documentation here, the correct type is XMLNSC.Field.  |
As specified in the link the XMLNSC.Element corresponds to the Tag (container)
The XMLNSC.Field matches a tag which contains normal text and/or CData.
It will not match tags which contain child tags...
As for the syntax I thought you had to include it in () like "Type (XMLNSC.Element) "
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
deepeshk79 |
Posted: Mon Dec 28, 2009 3:19 pm Post subject: |
|
|
Apprentice
Joined: 25 Mar 2007 Posts: 45 Location: Los Angeles
|
Hi,
I tried the below code in my flow
Code: |
MOVE cursor FIRSTCHILD TYPE (XMLNSC.Element);
|
When i deploy the flow, I'm getting the below error in Event log
Code: |
The correlation name 'XMLNSC.Element' is not valid.
|
I was using XML.Element earlier and my message domain at the input node was XML. Now when i change the message domain to XMLNSC and change all XML.Element to XMLNSC.Element, it fails and shows the above error.
I'm reading my XML sequentially and to make the processing faster I want to skip reading the attributes, so im using XMLNSC.Element but its failing at that point.
Any thoughts?
Thanks,
Deepesh |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Dec 28, 2009 4:03 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
How did you managed to post in this specific thread without reading the other comments in this specific thread that directly answer your question?
 |
|
Back to top |
|
 |
|