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 » Mapping multiple elements to array

Post new topic  Reply to topic
 Mapping multiple elements to array « View previous topic :: View next topic » 
Author Message
MiLi
PostPosted: Fri Mar 03, 2006 12:10 am    Post subject: Mapping multiple elements to array Reply with quote

Acolyte

Joined: 07 Oct 2005
Posts: 51

Hi, I would like some input on how solve a specific mapping issue.

I have a incoming xml where the repeted elements is represented with different names:

<DEALS>
<LOAN_1>
<AMOUNT>1234</AMOUNT>
</LOAN_1>
<LOAN_2>
<AMOUNT>5678</AMOUNT>
</LOAN_2>
<RATE>123</RATE>
</DEALS>

The messages is up to 1mb so its a question about performance.
I dont know which elements that will be repeted like this and I dont know where in the xml, so I like to build a general mapping so all elements that ends with _ + "INTEGER" is mapped to an array with an attrubute like:

<DEALS>
<LOAN sequence="1">
<AMOUNT>1234</AMOUNT>
</LOAN>
<LOAN sequence="2">
<AMOUNT>5678</AMOUNT>
</LOAN>
<RATE>123</RATE>
</DEALS>


The current soution is reading the message as a String and the use String operations like REPLACE.


Any suggestions?
_________________
IBM Certified System Administrator - WebSphere MQ V6.0
IBM Instructor - WebSphere MQ, WebSphere Message Broker
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Fri Mar 03, 2006 12:25 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi MiLi,

I am assuming that you want to pick the entire complex type where the parent complex tag has a "_".

First take a reference of the main tag.

Use a while to Check if the reference is a complex type
[list=]If the complex tag has a "_"
[list=]save the complex reference into a Array
Move the reference to the next tag in the same hierarchy(use MOVE NEXTSIBLING)[/list]
[/list]

I hope you get the logic...you can always work on customizing it.

Regards.
Back to top
View user's profile Send private message Send e-mail
elvis_gn
PostPosted: Fri Mar 03, 2006 12:28 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi MiLi,

I am assuming that you want to pick the entire complex type where the parent complex tag has a "_".

First take a reference of the main tag.

Use a while to Check if the reference is a complex type
    * If the complex tag has a "_"
      * Save the complex reference into a Array
      * Move the reference to the next tag in the same hierarchy(use MOVE NEXTSIBLING)



I hope you get the logic...you can always work on customizing it.

Regards.
Back to top
View user's profile Send private message Send e-mail
MiLi
PostPosted: Fri Mar 03, 2006 1:10 am    Post subject: Reply with quote

Acolyte

Joined: 07 Oct 2005
Posts: 51

Hi

This was the plan for a while, however:

The logic isnt so obviouse.

The element could look like: <Currencies_SwapSchedule_Loan_Payment_0 type="T">

So I must se if the is a _0 or maby _153 then I would like to cange the element name on output to <Currencies_SwapSchedule_Loan_Payment type="T" sequence="0">


1. could I copy the entire message and then loop through the OutputRoot and CHANGE the necessary element names?

2. Isnt this a very heavy operation: Take every element in the xml and do a name comparsion?

3. Any suggestion on how the logic could look like, example: Look for the last "_" and the se if the following substring is an integer?
_________________
IBM Certified System Administrator - WebSphere MQ V6.0
IBM Instructor - WebSphere MQ, WebSphere Message Broker
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Fri Mar 03, 2006 1:42 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi MiLi,

I guess the string method would have to suffice as you dont have any idea where the tags can occur in the message (though I feel this is a ***** design then).

Are there going to be other tags where you are not supposed to replace the integer ??
Is this the only operation that you need to do on this message ??

Regards.
Back to top
View user's profile Send private message Send e-mail
MiLi
PostPosted: Fri Mar 03, 2006 2:01 am    Post subject: Reply with quote

Acolyte

Joined: 07 Oct 2005
Posts: 51

As far as I can se, I can replace all element names that end with "_" + integer.

The other thing I'm doing with the message is adding a namespace, thats all.

And I agree, I cant believe what system could possibly generate this kind of xml. And thats not all. When it comes it got some extra "bonus" chars:

{ DATA 253 <DEAL>lbablalballa</DEAL> }

Nice....
_________________
IBM Certified System Administrator - WebSphere MQ V6.0
IBM Instructor - WebSphere MQ, WebSphere Message Broker
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Fri Mar 03, 2006 2:06 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Quote:
some extra "bonus" chars:

U lucky girl

Even my salary does not get me a bonus

Best of luck.

Regards.
Back to top
View user's profile Send private message Send e-mail
MiLi
PostPosted: Fri Mar 03, 2006 4:31 am    Post subject: Reply with quote

Acolyte

Joined: 07 Oct 2005
Posts: 51

I'm gonna do some experiments for performance.


Still one big issue!

I gab a substring as CHARACTER.

Is there now any way to se if its a integer?

like, IF mySubString IS NUMERIC THEN......

ESQL doesnt support try catch so I cant try to cast it!
_________________
IBM Certified System Administrator - WebSphere MQ V6.0
IBM Instructor - WebSphere MQ, WebSphere Message Broker
Back to top
View user's profile Send private message
mgk
PostPosted: Fri Mar 03, 2006 5:15 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

If you are using V6 then you can use the DEFAULT clause on the CAST to avoid an exception if the CAST fails...
_________________
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
View user's profile Send private message
MiLi
PostPosted: Fri Mar 03, 2006 5:20 am    Post subject: Reply with quote

Acolyte

Joined: 07 Oct 2005
Posts: 51

If life could be easy....

I'm running WBIMB v 5
_________________
IBM Certified System Administrator - WebSphere MQ V6.0
IBM Instructor - WebSphere MQ, WebSphere Message Broker
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 » Mapping multiple elements to array
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.