Author |
Message
|
Surya123 |
Posted: Tue Jan 27, 2004 9:41 am Post subject: Problem while referencing fields |
|
|
Newbie
Joined: 27 Jan 2004 Posts: 5
|
Hello-
I am unable to anonymously reference xml fields using ESQL. The xml structure is as follows-
<top>
|_<ctarea>
. |_<childx>
.
|_<data>
|_<childy>
....
I am using Root.xml.*[1].data.*[1] to access "childy" element but somehow it errored out. Please let me know if I am doing anything wrong. Thanks.
Surya |
|
Back to top |
|
 |
Missam |
Posted: Tue Jan 27, 2004 10:22 am Post subject: |
|
|
Chevalier
Joined: 16 Oct 2003 Posts: 424
|
Use
Root.XML.*[LAST].data.*[1] to access childy
because the last field of XML will be your actual message body |
|
Back to top |
|
 |
Surya123 |
Posted: Tue Jan 27, 2004 2:30 pm Post subject: |
|
|
Newbie
Joined: 27 Jan 2004 Posts: 5
|
-
I don't think that's the way the parser works. Actually Root.*[LAST] will give the body. Any other suggestions ?.. Thanks.
Surya |
|
Back to top |
|
 |
mgk |
Posted: Wed Jan 28, 2004 12:57 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
You syntax may not be working because of white space elements in the XML input tree (caused by the presence of CRLF's, blank lines, spaces etc in the input message). To see if this is the case, trace ${ROOT} in a trace node.
However the best way to do anonymous tree navigation is with Reference variables. I suggest you look up the syntax for these (DECLARE REFERENCE TO... , MOVE, LASTMOVE and friends)
Cheers, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
Surya123 |
Posted: Wed Jan 28, 2004 9:43 am Post subject: |
|
|
Newbie
Joined: 27 Jan 2004 Posts: 5
|
When I traced the Root I don't see any spaces. Also, I am able to access the element (childy) using "Root.xml.*[1].data.childy". So I don't think white spaces might be a problem right. Thanks.
Surya |
|
Back to top |
|
 |
EddieA |
Posted: Wed Jan 28, 2004 12:44 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
What mgk was referring to were extra 'elements' in the tree caused by spaces and CRs. Not additional spaces in the tag name or value.
If you DO have these 'additional' elements, then using 'childy' WILL work, but '*[1]' will NOT.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
Surya123 |
Posted: Sat Jan 31, 2004 11:52 pm Post subject: |
|
|
Newbie
Joined: 27 Jan 2004 Posts: 5
|
|
Back to top |
|
 |
|