Author |
Message
|
smdavies99 |
Posted: Thu Feb 09, 2006 11:58 am Post subject: Adding more data of the same name to a message |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
This is probably a simple problem but I am not clear as to the best way to do it.
If I have an incoming message with the following structure
<Dealer_Stock>
<Dealer_Stock_List>
<Stock_Item>
<Veh_reg>SSS111G</Veh_reg>
<Veh_Type>Cortina</Veh_Type>
<Veh_Price>1195.00</Veh_Price>
</Stock_Item>
.... Repeating a variable number of times
</Dealer_Stock_List>
</Dealer_Stock>
The flow gets the message and wants to add more items of the type <Stock_Item> to the list.
I'm sure there is a simple way to do this but at the moment it seems that I may have to decostruct the emssage first
/S _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Feb 09, 2006 12:02 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You just use something like
Code: |
set OutputRoot.XML.Dealer_Stock.Dealer_Stock_List.Stock_Item[2].Veh_reg="abcdefg"; |
Where you increment the [2] for every new stock item. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Feb 09, 2006 1:00 pm Post subject: A bit more info |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Thanks for the hint. However I inadvertantly missed out a possible essential bit if info in my original post.
The Message Structue should actually look like this.
<Dealer_Stock>
<Dealer_Stock_List>
<Stock_Date>2006-02-07</Stock_Date>
<Stock_Due>12</Stock_Due>
<Stock_Item>
<Veh_Reg>JYL105N</Veh_Reg>
<Veh_Qual>Few Dents on Front</Veh_Qual>
<Veh_Type>Cortina</Veh_Type>
<Veh_Price>1195.00</Veh_Price>
</Stock_Item>
So, If I try to access the list usig your method as shown below, I get the following in the Trace output.
SET ...Dealer_Stock.Dealer_Stock_List.Stock_Item.[1].Veh_Type='Anglia';
(0x03000000):Stock_Date = DATE '2006-02-09'
(0x03000000):Stock_Due = 2
(0x01000000):Stock_Item = (
(0x03000000):Veh_Reg = 'JYL105N'
(0x03000000):Veh_Qual = 'Few Dents on Front'
(0x03000000):Veh_Type = 'Cortina'
(
(0x03000000):Veh_Type= 'Anglia'
)
)
So, it seems to have created a new tag rather than updating the existing one.
/s _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Feb 09, 2006 1:12 pm Post subject: Re: A bit more info |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
smdavies99 wrote: |
SET ...Dealer_Stock.Dealer_Stock_List.Stock_Item.[1].Veh_Type='Anglia';
|
"Stock_Item.[1]" is different than "Stock_Item[1]". _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Feb 09, 2006 1:27 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Thanks, I was seeing to many dots (before my eyes).
A Dooooooooooohhhhhhhhhhhhh Moment I'm sure
/s _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
|