ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » TDS --> XML Element Order

Post new topic  Reply to topic
 TDS --> XML Element Order « View previous topic :: View next topic » 
Author Message
alastor52
PostPosted: Fri May 12, 2006 7:56 am    Post subject: TDS --> XML Element Order Reply with quote

Apprentice

Joined: 09 May 2006
Posts: 37

I have a message defined that includes an 'address' element of type 'address'. My 'address' type includes street, city, state, ZIP, and county. The problem I'm having is that my incoming TDS message could have ZIP and county in any position. I would like all the address related information under one tag instead of seperate 'address' tags. I've played around with various combinations of the Local Group Composition for the message and the 'address' type but I haven't had any luck. Help me Obi-Wan Kenobi, you're my final hope!

Incomming Message:
NAME:LAST/FIRST/MIDDLE/.STREET:1234 TEST DR.CITY:NOWHERE.STATE:CA.ID:123456789.ZIP:12345.OPERATOR:SMITH.COUNTY:AA.

What I want:
<person>
<name>
<lastName>LAST</lastName>
<firstName>FIRST</firstName>
<middleName>MIDDLE</middleName>
</name>
</person>
<address>
<street>1234 TEST DR</street>
<city>NOWHERE</city>
<state>CA</state>
<zip>12345</zip>
<county>AA</county>
</address>
<id>123456789</id>
<operator>SMITH</operator>

What I get:
<person>
<name>
<lastName>LAST</lastName>
<firstName>FIRST</firstName>
<middleName>MIDDLE</middleName>
</name>
</person>
<address>
<street>1234 TEST DR</street>
<city>NOWHERE</city>
<state>CA</state>
</address>
<personNum>123456789</personNum>
<address>
<zip>12345</zip>
</address>
<operator>SMITH</operator>
<address>
<county>AA</county>
</address>

Thanks!
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Sun May 14, 2006 7:57 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi alastor52,

If you have the tag names coming along with the data, it should not be a problem to design this

Have u tried the unordered set....define complex type address as one, and then the elements under it to have the same names as the tags....it should work...and at the output side, the ouput sequence will depend on which field you populate first..

Regards.
Back to top
View user's profile Send private message Send e-mail
shalabh1976
PostPosted: Sun May 14, 2006 9:00 pm    Post subject: Reply with quote

Partisan

Joined: 18 Jul 2002
Posts: 381
Location: Gurgaon, India

elvis_gn,
alastor52 may have performance issues if unordered set is used. Yes, I agree that his solution possibly lies in using unordered set but he should be careful if he is processing large messages using unordered set.
I once obtained a 600% improvement in performance by changing my unordered set to ordered. However this may not be an option for alastor_52.
_________________
Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kimbert
PostPosted: Mon May 15, 2006 1:03 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Hi alastor,

You'll have to do this in two stages.
1. Create a message definition with a flat structure ( all the fields in a single complex type, with Composition 'UnorderedSet' ). That should be simple enough to parse.
2. Create another message definition ( in the same message set ) with your desired output structure. Use a mapping node to map from one to the other.

If you don't want to use the mapping node, you could skip step 2 and just assemble the output message using a Compute node and some hand-crafted ESQL. That would be harder to maintain, though.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon May 15, 2006 1:05 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
alastor52 may have performance issues if unordered set is used
No he won't. The TDS parser will be almost exactly as fast whether he uses Sequence or UnorderedSet. Your scenario must have included writing, and may have involved CWF.
Back to top
View user's profile Send private message
alastor52
PostPosted: Mon May 15, 2006 4:32 am    Post subject: Reply with quote

Apprentice

Joined: 09 May 2006
Posts: 37

elvis_gn wrote:

Have u tried the unordered set....define complex type address as one


I did have my address type configured as an unordered set and it didn't seem to matter. I also had the message type that contained the address type set to unordered set, choice, all - nothing worked the way the documentation made it seem it should work.

kimbert wrote:

You'll have to do this in two stages.


I was hoping to be able to do this all in one step. Why doen't setting Composition to Unordered Set work they way it would seem to indicate? You were spot on with your Message Group and Message Alias answer to my previous question so I'll trust your assessment. This might also solve some other issues.

I've give the "two stage" approach a try. Thanks.
Back to top
View user's profile Send private message
alastor52
PostPosted: Mon May 15, 2006 4:43 am    Post subject: Reply with quote

Apprentice

Joined: 09 May 2006
Posts: 37

kimbert wrote:

You'll have to do this in two stages.


Is there a way I could have all my fields for all my messages in one message definition and then use the MessageIdentity and Message Alias to map the values into the individual message structures?
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon May 15, 2006 4:44 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I was hoping to be able to do this all in one step. Why doen't setting Composition to Unordered Set work they way it would seem to indicate?
To answer that question, you have to think about the logical structure of your input message. This is not actually about ordered-ness, so using UnorderedSet is not enough (on its own) to fix it.

Case1:
Message definition:
Code:
message
  A
  B
  C
  D
  E


Input message: EDCBA

In this case, using UnorderedSet allows the input message to match the logical structure that you wanted.

Case2:
Message definition:
Code:
message
  A
    |-- B
    |-- C
  D
    |-- E


Input message: ADEBC

In this case, the child elements of structure A arrive after A has gone out of scope. That's a logical re-structure, not a problem with ordered-ness.
Back to top
View user's profile Send private message
alastor52
PostPosted: Mon May 15, 2006 4:50 am    Post subject: Reply with quote

Apprentice

Joined: 09 May 2006
Posts: 37

kimbert wrote:

In this case, the child elements of structure A arrive after A has gone out of scope. That's a logical re-structure, not a problem with ordered-ness.


Is there a way to tell the broker to loop through the definition until all the input elements are assigned?

On another note, if a input element cannot be matched to an element in the definition is there a way to tell the Broker to ignore it and not copy it to the output?
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon May 15, 2006 5:12 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Is there a way to tell the broker to loop through the definition until all the input elements are assigned?
You mean, 'make multiple passes over the bitstream until everything in the message definition has been filled in'. Short answer: No. Long answer: Fraught with hazards ( what if some of the fields are optional, what if a field is accidentally missed out ( infinite loop). etc
Quote:
On another note, if a input element cannot be matched to an element in the definition is there a way to tell the Broker to ignore it and not copy it to the output?
Not sure exactly what you mean. If the input bitstream contains tagged delimited (because otherwise this scneario cannot occur) elements which are not in the message definition, they will be put into the tree as 'self-defining' elements. You cannot switch off this behaviour, but you can trap extraneous elements by switching on logical validation.
Back to top
View user's profile Send private message
alastor52
PostPosted: Thu May 18, 2006 9:16 am    Post subject: Reply with quote

Apprentice

Joined: 09 May 2006
Posts: 37

Once again Kimbert you have been a great help. I followed your suggestion and implemented a flat structure for my TDS -> XML transformation and then used a map to transform from the flat structure to the desired message format. All my problems have been solved - at least for now

Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » TDS --> XML Element Order
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.