Author |
Message
|
mq_pm |
Posted: Fri May 14, 2004 6:21 am Post subject: Anonymous field references |
|
|
Centurion
Joined: 27 Aug 2003 Posts: 132
|
Hi,
I have an xml message:
<Request>
<reqInfo>
<NumberValidRQ xmlns="......" xmlns:xsi="......" TimeStamp="..." EchoToken="" SequenceNmbr="0000" xsi:schemaLocation="....." Target="Production" Version="1">
I need to access sequencenmbr. For all messages the format is same except NumberValidRQ will change. I don't want it to be hard coded one.
So I tried to access sequence number as:
InputRoot.XML.Request.reqinfo.*[1].*[5]
InputRoot.XML.Request.reqinfo.*[1].(XML.attr)SequenceNmbr
But the value I get is null. Tried all options.
A/c to ESQL 2.1 ,
It is possible to refer to the array of all children of a particular entity by using a path element of "*". So, for example:
InputRoot.*[] is a path that identifies the array of all children of InputRoot.
Can anyone tell me how to refer to that value.
Thanks. |
|
Back to top |
|
 |
mq_pm |
Posted: Fri May 14, 2004 7:00 am Post subject: urgent |
|
|
Centurion
Joined: 27 Aug 2003 Posts: 132
|
sorry it was
"InputRoot"."XML"."Request"."reqinfo".*[1].*[5]
"InputRoot."XML"."Request"."reqinfo".*[1].(XML.attr)SequenceNmbr
Any help is appreciated. Thanks. |
|
Back to top |
|
 |
JT |
Posted: Fri May 14, 2004 10:42 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Quote: |
<Request>
<reqInfo>
<NumberValidRQ xmlns="......" xmlns:xsi="......" TimeStamp="..." EchoToken="" SequenceNmbr="0000" xsi:schemaLocation="....." Target="Production" Version="1"> |
Quote: |
"InputRoot"."XML"."Request"."reqinfo".*[1].*[5]
"InputRoot."XML"."Request"."reqinfo".*[1].(XML.attr)SequenceNmbr |
reqinfo/reqInfo, pick one or the other, not both. |
|
Back to top |
|
 |
mq_pm |
Posted: Fri May 14, 2004 11:18 am Post subject: |
|
|
Centurion
Joined: 27 Aug 2003 Posts: 132
|
I used only one. But neither one gave me correct value. I was trying to say that I used these two options.
I tried using MOVE operation. still not able to solve the problem.
DECLARE PATH REFERENCE TO "InputRoot"."XML"."Request"."reqInfo";
MOVE PATH FIRSTCHILD ;
SET Y = PATH.(XML.attr)SequenceNmbr ;
Is this correct??? |
|
Back to top |
|
 |
JT |
Posted: Fri May 14, 2004 11:31 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Apparently I wasn't clear. In both of your statements you reference reqinfo (lowercase i), but your XML message has reqInfo (upppercase I). Your statement should reference reqInfo, not reqinfo. |
|
Back to top |
|
 |
mq_pm |
Posted: Fri May 14, 2004 11:40 am Post subject: |
|
|
Centurion
Joined: 27 Aug 2003 Posts: 132
|
It is reqInfo. Sorry i typed it has wrong here. But in the code i mentioned reqInfo only. So you mean the syntax is correct to access the attribute??? |
|
Back to top |
|
 |
JT |
Posted: Fri May 14, 2004 12:10 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Code: |
DECLARE cursor REFERENCE TO InputRoot.XML."Request"."reqInfo".*[1].(XML.Attribute)"SequenceNmbr";
SET OutputRoot.XML."soap:Envelope"."soap:Body"."Name"."Number" = FIELDVALUE(cursor); |
The preceding code creates the output XML element Number that contains the value of the SequenceNmbr attribute:
Code: |
(0x01000010):XML = (
(0x01000000):soap:Envelope = (
(0x01000000):soap:Body = (
(0x01000000):Name = (
(0x01000000):Number = (
(0x02000000): = '0000'
)
)
)
)
)
|
Good luck ! |
|
Back to top |
|
 |
JT |
Posted: Fri May 14, 2004 12:45 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Ooops, my bad. There's another recent posting that is similar to yours relating to XML attribute values. The following code produces a value of "0000" for the variable Y.
Code: |
SET Y = InputRoot.XML."Request"."reqInfo".*[1].(XML.Attribute)"SequenceNmbr"; |
Yes, your code is also correct:
Quote: |
DECLARE PATH REFERENCE TO "InputRoot"."XML"."Request"."reqInfo";
MOVE PATH FIRSTCHILD ;
SET Y = PATH.(XML.attr)SequenceNmbr ;
Is this correct??? |
|
|
Back to top |
|
 |
kspranava |
Posted: Mon May 17, 2004 2:12 am Post subject: xml.element |
|
|
 Centurion
Joined: 27 Apr 2003 Posts: 124
|
Hi mq_pm,
Why don't you try the following code,
InputRoot.XML.Request.reqInfo.(XML.Element).(XML.attr)SequenceNmbr
This will work not only for "NumberValidRQ" but for all.
Pranava. |
|
Back to top |
|
 |
mq_pm |
Posted: Mon May 17, 2004 6:52 am Post subject: |
|
|
Centurion
Joined: 27 Aug 2003 Posts: 132
|
Hi Pranava,
Thanx alot....it worked  |
|
Back to top |
|
 |
|