Author |
Message
|
Kumar4 |
Posted: Wed Sep 19, 2007 10:07 am Post subject: Accessing Pipe Delimiter inside XML Message |
|
|
Apprentice
Joined: 12 Aug 2007 Posts: 27
|
Hi Folks,
I have a incoming message where the value of the field is something like
<XML FIELD> VALUE1 | VALUE2 | ID1| ID2 </XML FIELD>
Can some one guide me on accessing the ID2 Value from the message(XML FIELD) inside message broker using ESQL.I'm using XMLNS parser to parse the Input Message.
Thanks In Advance |
|
Back to top |
|
 |
Vitor |
Posted: Wed Sep 19, 2007 10:20 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Why do you have delimited values inside an XML element?
If you're using XMLNS you'll need to hand crank some code. AFAIK there's no ESQL equivalent of strtok (or likewise). _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
elvis_gn |
Posted: Wed Sep 19, 2007 10:26 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi Kumar4,
Use SUBSTRING function with (POSITION and REPEAT).
Look up the ESQL doc for the syntax.
Regards. |
|
Back to top |
|
 |
Kumar4 |
Posted: Wed Sep 19, 2007 10:37 am Post subject: |
|
|
Apprentice
Joined: 12 Aug 2007 Posts: 27
|
Thanks for the reply,
BUt how can you determine the position of the Value, The value will be at the last pipe delimitter, The position might be changing if any of values before to this changes. and also the value might be of different lenght.
I think this can work of any function which can read the pipe delmitters, so that it can access the 3 rd pipe delimitter value.
Thanks again |
|
Back to top |
|
 |
elvis_gn |
Posted: Wed Sep 19, 2007 10:41 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi Kumar4,
Position of pipe = POSITION("|" IN xmlField REPEAT 3);
Starting position of ID2 = position of pipe + 1;
So, ID2 = SUBSTRING(xmlField FROM Starting position of ID2);
Now, convert the above into 1 line of code
Regards. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Sep 19, 2007 10:43 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
String manipulation in ESQL works just like string manipulation in any other programming language.
If you really felt like it, you could define a TDS message definition to parse the contents of this field, and then use CREATE FIELD... PARSE to get a logical tree. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|