Author |
Message
|
telus |
Posted: Thu Nov 01, 2012 1:26 pm Post subject: Help With move |
|
|
Apprentice
Joined: 01 Nov 2012 Posts: 26
|
HI,
I am new to message broker and I am using the Large sample messging feature.
The Example XML in the sample is
<-SaleEnvelope>
+<Header>
+<SaleList>
+<SaleList>
+<SaleList>
+<SaleList>
</SaleEnvelope>
In order to Acquire the first SaleList element it is giving the statement
MOVE refEnvironmentSaleList FIRSTCHILD NAME ROOT_LEVEL;
Where ROOT_LEVEL =SaleEnvelope
In My Scenario,
The XML is of the structure like below(Just Matching with above sample)
<?xml version="1.0" encoding="UTF-8"?>
-<pi:Sales_Extract xmlns:mi="pgb:com.xyz/file">
-<pi:SaleGroup>
+<pi:Header>
+<pi:SaleList>
+<pi:SaleList>
+<pi:SaleList>
+<pi:SaleList>
+<pi:SaleList>
+<pi:SaleList>
</pi:SaleGroup>
</pi:Sales_Extract>
So in above case all the data of sales in Sales group
So If I am using the statement
MOVE refEnvironmentSaleList FIRSTCHILD NAME ROOT_LEVEL; Where ROOT_LEVEL=SaleGroup
I got the error no root element present.
Could anyone please advice |
|
Back to top |
|
 |
mqsiuser |
Posted: Thu Nov 01, 2012 9:21 pm Post subject: Re: Help With move |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
Code: |
<-SaleEnvelope>
+<Header>
+<SaleList>
+<SaleList>
+<SaleList>
+<SaleList>
</SaleEnvelope> |
MOVE refEnvironmentSaleList FIRSTCHILD NAME 'SaleEnvelope';
Code: |
<?xml version="1.0" encoding="UTF-8"?>
-<pi:Sales_Extract xmlns:mi="pgb:com.xyz/file">
-<pi:SaleGroup>
+<pi:Header>
+<pi:SaleList>
+<pi:SaleList>
+<pi:SaleList>
+<pi:SaleList>
+<pi:SaleList>
+<pi:SaleList>
</pi:SaleGroup>
</pi:Sales_Extract> |
MOVE refEnvironmentSaleList FIRSTCHILD NAME 'Sales_Extract';
MOVE refEnvironmentSaleList FIRSTCHILD NAME 'SaleGroup'; _________________ Just use REFERENCEs |
|
Back to top |
|
 |
rekarm01 |
Posted: Thu Nov 01, 2012 11:54 pm Post subject: Re: Help With move |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
telus wrote: |
So If I am using the statement
Code: |
MOVE refEnvironmentSaleList FIRSTCHILD NAME ROOT_LEVEL; Where ROOT_LEVEL=SaleGroup |
I got the error no root element present. |
What does the actual statement look like? It seems the "Where" clause would cause a syntax error, unless it were commented out. How is refEnvironmentSaleList declared? How is ROOT_LEVEL declared or set?
Whenever declaring or moving a reference variable, use LASTMOVE() to confirm that the reference is still valid. A Trace node is useful for displaying the actual message structure, and a usertrace is useful for displaying the actual error. |
|
Back to top |
|
 |
mqsiuser |
Posted: Fri Nov 02, 2012 2:25 am Post subject: Re: Help With move |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
This "Where ..." is just a comment !
There is no WHERE (in the native ESQL MOVE statement)
Code: |
MOVE refEnvironmentSaleList FIRSTCHILD NAME ROOT_LEVEL; -- Where ROOT_LEVEL=SaleGroup |
means:
Code: |
DECLARE ROOT_LEVEL CHAR 'SaleGroup';
MOVE refEnvironmentSaleList FIRSTCHILD NAME ROOT_LEVEL; |
_________________ Just use REFERENCEs |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Nov 02, 2012 3:11 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
you may need to add namespace...like in
MOVE ref first child NAMESPACE xyz NAME myname;
However I would not even worry. You could also use
MOVE ref FIRSTCHILD TYPE .... or just go to first child and then move through the siblings until you find Fieldname(ref) = myname...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqsiuser |
Posted: Fri Nov 02, 2012 3:26 am Post subject: Re: Help With move |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
Dear OP,
you are struggeling to move (into) your (own) msg-tree. So here is my tip for you:
I would attach the degugger and just look into the variables view.
And you can just spare "NAME 'xyz'" and just move into the firstchild:
Code: |
MOVE refEnvironmentSaleList FIRSTCHILD;
MOVE refEnvironmentSaleList FIRSTCHILD; |
You have one more child than the example, so you have to use "MOVE ref FIRSTCHILD" two times (instead of one). _________________ Just use REFERENCEs |
|
Back to top |
|
 |
telus |
Posted: Fri Nov 02, 2012 6:22 am Post subject: |
|
|
Apprentice
Joined: 01 Nov 2012 Posts: 26
|
Hi ,
As this is in namespace Pi but broker is not recongising this namespace.
and moreover the FIRSTCHILD NOT WORKING IN THIS CASE
THE LASTCHILD WORKS
I HAVE USED LASTCHILD TWO TIMES TO GET IT TO SaleGroup .
bUT STILL NOT DETERMINE HOW SHOULD i USE THE NAMESPACE AS IN THIS IS CASE IT IS PI.
THANKS
Last edited by telus on Sat Nov 03, 2012 4:35 am; edited 1 time in total |
|
Back to top |
|
 |
mqsiuser |
Posted: Fri Nov 02, 2012 6:51 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
Your elements have "pi:myElement", but you have not set/declared the namespace. That is not valid xml:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<pi:Sales_Extract xmlns:mi="pgb:com.xyz/file">
... |
"mi" should be "pi" ?!
Code: |
F [Xerces] The prefix "pi" for element "pi:Sales_Extract" is not bound. |
|
|
Back to top |
|
 |
jrsdm |
Posted: Fri Nov 02, 2012 9:15 am Post subject: |
|
|
Apprentice
Joined: 24 Oct 2012 Posts: 27
|
You can use
namespace tag with move |
|
Back to top |
|
 |
telus |
Posted: Sat Nov 03, 2012 4:34 pm Post subject: |
|
|
Apprentice
Joined: 01 Nov 2012 Posts: 26
|
Still it doesn't work
Any idea please ? |
|
Back to top |
|
 |
kimbert |
Posted: Sat Nov 03, 2012 5:16 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Still it doesn't work
Any idea please ? |
Yes - your code is wrong. Please explain what you did, and what happened. Remember that we cannot see your screen, so we don't know this stuff unless you explain it very clearly.
Quote the full text of any error messages. Post Trace node output from your flow. |
|
Back to top |
|
 |
rekarm01 |
Posted: Sat Nov 03, 2012 7:50 pm Post subject: Re: Help With move |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
rekarm01 wrote: |
Whenever declaring or moving a reference variable, use LASTMOVE() to confirm that the reference is still valid. A Trace node is useful for displaying the actual message structure, and a usertrace is useful for displaying the actual error. |
telus wrote: |
... and moreover the FIRSTCHILD NOT WORKING IN THIS CASE
THE LASTCHILD WORKS |
A Trace node would have helped spot that more quickly.
telus wrote: |
bUT STILL NOT DETERMINE HOW SHOULD i USE THE NAMESPACE AS IN THIS IS CASE IT IS PI. |
More precisely, "pi" (or "mi"?) is just the namespace prefix.
The InfoCenter describes how to use the MOVE statement NAMESPACE clause. |
|
Back to top |
|
 |
|