Author |
Message
|
lung |
Posted: Tue Aug 27, 2002 1:27 am Post subject: XML Question |
|
|
 Master
Joined: 27 Aug 2002 Posts: 291 Location: Malaysia
|
Hi.
I am new to WMQI, and I have a question on XML messages.
Here is the scenario...
I have multiple XML messages, each tagged with a different XML root name. However, each of these messages share a similarity in having the same fields under a particular 'header'.
Here is the structure of the message...
<XMLRootName> <-- Different for all my XML messages
<Header> <-- Same
<TCode>01</TCode> <-- Same
...
...
...
Here is the problem. I am trying to access the TCode value in the message, but how do I so? I understand that usually it will just be 'XMLRootName.Header.TCode', but it does not work in this case since all my messages are having different XML root names!
I have tried 'InputBody.*[1].Header.TCode' and it works. However, it will not work when there are additional fields before the XML root name (this applies to those '<?xml version="1.0"?>' and '<!--MRM Generated XML Output on...--> fields).
So how do I address this issue? Is there an alternative method?
Thanks.  _________________ lung |
|
Back to top |
|
 |
lillo |
Posted: Tue Aug 27, 2002 3:51 am Post subject: |
|
|
Master
Joined: 11 Sep 2001 Posts: 224
|
Try the following code 'InputBody.*[LAST].Header.TCode'
I hope this help you.
Cheers, _________________ Lillo
IBM Certified Specialist - WebSphere MQ |
|
Back to top |
|
 |
lung |
Posted: Tue Aug 27, 2002 4:50 pm Post subject: |
|
|
 Master
Joined: 27 Aug 2002 Posts: 291 Location: Malaysia
|
lillo wrote: |
Try the following code 'InputBody.*[LAST].Header.TCode'
|
But that will point to the last field in the message. I'm trying to point to the first field under 'header'. Thanks.  _________________ lung |
|
Back to top |
|
 |
lillo |
Posted: Tue Aug 27, 2002 9:54 pm Post subject: |
|
|
Master
Joined: 11 Sep 2001 Posts: 224
|
You are right, InputBody.*[LAST] will point to the last field in the XML message. Let see an example without header and with header.
1.- Without header: your message should look like
<XMLRootName> <-- Different for all my XML messages
<Header> <-- Same
<TCode>01</TCode> <-- Same
...
...
</XMLRootName>
Then InputBody.*[LAST] will refer to XMLRootName
2.- With header: your message should look like
<?xml version="1.0"?>
<XMLRootName> <-- Different for all my XML messages
<Header> <-- Same
<TCode>01</TCode> <-- Same
...
...
</XMLRootName>
Then InputBody.*[LAST] will refer again to XMLRootName
I hope this clarify you something. Tell me if it does not help you.
Cheers, _________________ Lillo
IBM Certified Specialist - WebSphere MQ |
|
Back to top |
|
 |
lung |
Posted: Tue Aug 27, 2002 10:42 pm Post subject: |
|
|
 Master
Joined: 27 Aug 2002 Posts: 291 Location: Malaysia
|
lillo,
Thanks for trying to help me here, but...
I am trying to refer to the 'TCode' field, not the 'XMLRootName'.
<?xml version="1.0"?> <-- may not be present in message
<XMLRootName>
<Header>
<TCode>01</Tcode> <-- present in all messages, i am trying to refer to this field
</Header>
... <-- all the other fields in the message, varies in length for all the messages
...
...
</XMLRootName>
So I don't think I can use InputBody.*[LAST] here...  _________________ lung |
|
Back to top |
|
 |
lung |
Posted: Tue Aug 27, 2002 10:48 pm Post subject: |
|
|
 Master
Joined: 27 Aug 2002 Posts: 291 Location: Malaysia
|
Wait a minute...
lillo, I think I get what you mean.
I can use InputBody.*[LAST].Header.TxnCode , right?
Gotta try this now! Thanks!!  _________________ lung |
|
Back to top |
|
 |
|