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 parser issue

Post new topic  Reply to topic
 TDS parser issue « View previous topic :: View next topic » 
Author Message
leo.yue
PostPosted: Mon Mar 27, 2006 9:10 pm    Post subject: TDS parser issue Reply with quote

Acolyte

Joined: 20 Oct 2004
Posts: 52

All, there are some issues while using TDS message set.

Here is a message to be parsed.

Quote:
<CR><LF>01AAAA BBBB CCCC
<CR><LF>DDDD EEEE
<CR><LF>02Hello Blue Green White
<CR><LF>Red Yellow
<CR><LF>03Here is the Message
<CR><LF>For You
<CR><LF>04


According to the message above, we have to transform into:

Quote:
<Root>
<char>AAAA</char>
<char>BBBB</char>
<char>CCCC</char>
<char>DDDD</char>
<char>EEEE</char>
<action>Hello</action>
<content>Blue Green White<CR><LF>Red Yellow</content>
<msg>Here is the Message<CR><LF>For You</msg>
</Root>


I just created a TDS message.
. A message complex type using <CR><LF> as delimiter.
. A group: indicators is <CR><LF>01, terminators is <CR><LF>02
But how can I define delimiter for char (space or crlf)
. A group: terminators is <CR><LF>03, and delimiter is "space"
I want to make "Blue Green White<CR><LF>Red Yellow" as the value of "content", how can I do it.
A group: terminators is <CR><LF>04
This time, I do not need any delimiter, just want to make the whole conten as the value of "msg". I try it using Regular expression, but it's failed

Could you help me on this issue? Many thanks.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Mon Mar 27, 2006 9:28 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi leo.yue,

Use three different complex types.

1st Complex type:
Group Indicator: <CR><LF>01
Group Terminator: <CR><LF>02
Group Delimiter: <CR><LF>
No. of fields: 4 (1.AAAA, 2.BBBB, 3.CCCC, 4.(DDDD EEEE))

2nd Complex type:
Group Indicator: <CR><LF>02
Group Terminator: <CR><LF>03
Group Delimiter: <CR><LF>
No. of fields: 2 (1.(Hello Blue Green White), 2.(Red Yellow))

3rd complex type:
Group Indicator: <CR><LF>03
Group Terminator: <CR><LF>04
Group Delimiter: -
No. of fields: 1 (1.(Here is the Message<CR><LF>For You))

But, I think you will have a problem working with <CR><LF> within the values of the message....there was a post some months back on the same issue...you could refer to that.

Also, some of the fields have the spaces between them and you want to put them into different tags, for that use the SUBSTRING.

Regards.
Back to top
View user's profile Send private message Send e-mail
leo.yue
PostPosted: Mon Mar 27, 2006 10:19 pm    Post subject: Reply with quote

Acolyte

Joined: 20 Oct 2004
Posts: 52

Thanks for your answer. please see my comments in red. Thanks.

Use three different complex types.

1st Complex type:
Group Indicator: <CR><LF>01
Group Terminator: <CR><LF>02
Group Delimiter: <CR><LF>
No. of fields: 4 (1.AAAA, 2.BBBB, 3.CCCC, 4.(DDDD EEEE))

I think Group Delimiter should be " " (space). Can I separate every string(AAAA/BBBB/CCCC/DDDD/EEEE) totally?

2nd Complex type:
Group Indicator: <CR><LF>02
Group Terminator: <CR><LF>03
Group Delimiter: <CR><LF>
No. of fields: 2 (1.(Hello Blue Green White), 2.(Red Yellow))

Group Indicator should be null, and Group Delimiter should be " " (space).

3rd complex type:
Group Indicator: <CR><LF>03
Group Terminator: <CR><LF>04
Group Delimiter: -
No. of fields: 1 (1.(Here is the Message<CR><LF>For You))

Do you mean Group Delimiter is set to null and Group Indicator should be null, however, what Data Element Separation should we choice?.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Tue Mar 28, 2006 12:58 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi leo.yue,

Quote:
I think Group Delimiter should be " " (space). Can I separate every string(AAAA/BBBB/CCCC/DDDD/EEEE) totally?

U can use the delimiter as " "(space), but then you will have a tag CCCC<CR><LF>DDDD....I am trying to avoid getting <CR><LF> in the field values.
I did make a mistake for the first complex type...there would be only 2 fields with CRLF as delimiter.
You can seperate all by using Data Patterns, but that will eat on your performance....

Quote:
Group Indicator should be null, and Group Delimiter should be " " (space).

Yes, group indicator should be blank.
Delimiter space i am not using again for the above reasons...you willhave a White<CR><LF>Red.

Quote:
Do you mean Group Delimiter is set to null and Group Indicator should be null, however, what Data Element Separation should we choice?.

Yes, group indicator and delimiter should be blank.
Since you want the <CR><LF> to exist in the output, i suggested not using the delimiter....
For Data element separation you can use Delimited separation...without specifying any delimiter.

Regards.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Tue Mar 28, 2006 1:25 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Thanks for a really clear problem description. Here are some answers:
Quote:
how can I define delimiter for char (space or crlf)
TDS does not allow a delimiter to be defined as a choice of two different strings.
Quote:
I want to make "Blue Green White<CR><LF>Red Yellow" as the value of "content", how can I do it
You could remove the <CR><LF> delimiter from the outer complex type - if you look carefully at the message structure, it's not actually required. However, read on.
Quote:
I try it using Regular expression, but it's failed
Regular Expressions are the correct choice here, because your message structure is quite 'challenging'.

We're having a go at modelling this right now - we'll get back to you with the full answer.
Back to top
View user's profile Send private message
leo.yue
PostPosted: Tue Mar 28, 2006 2:58 am    Post subject: Reply with quote

Acolyte

Joined: 20 Oct 2004
Posts: 52

Thanks elvis_gn and kimbert.

Do you have any experience in using Hexadecimal in Regular Expressions?

Quote:
Yes, group indicator and delimiter should be blank.
Since you want the <CR><LF> to exist in the output, i suggested not using the delimiter....
For Data element separation you can use Delimited separation...without specifying any delimiter.


I just tested it. If using Delimited separation, I will have to set a delimiter

Quote:
You could remove the <CR><LF> delimiter from the outer complex type - if you look carefully at the message structure, it's not actually required. However, read on.


I don't want to remove <CR><LF>. I just want to :

<CR><LF>02Hello Blue Green White
<CR><LF>Red Yellow

==>

<action>Hello</action>
<content>Blue Green White<CR><LF>Red Yellow</content>

[/quote]
Back to top
View user's profile Send private message
juddg
PostPosted: Tue Mar 28, 2006 6:10 am    Post subject: Reply with quote

Apprentice

Joined: 22 Nov 2004
Posts: 33

Hi,
I have modelled your example as follows. All properties not mentioned are defaulted

Code:

  Message - name = root
  |
  |-- complexType - DES = Use Data Pattern
      |             Group Terminator = <CR><LF>04
      |
      |-- sequence - DES = All Elements Delimited,
      |   |          Group Indicator = <CR><LF>01
      |   |          Delimiter = <CR><LF> 
      |   |          Data Pattern =([^\r]|(\r[^\n])|(\r\n[^0])|(\r\n0[^2]))*
      |   |
      |   |-- sequence - maxOccurs = -1
      |       |          DES = All Elements Delimited
      |       |          Delimiter = <SP>
      |       |
      |       |-- element - maxOccurs = -1
                            Name = char
      |                     Type = string
      |                                                     
      |-- sequence - DES = All Elements Delimited,
      |   |          Group Indicator = <CR><LF>02
      |   |          Delimiter = <SP> 
      |   |          Data Pattern =([^\r]|(\r[^\n])|(\r\n[^0])|(\r\n0[^3]))*
      |   |
      |   |-- element - Name = action
      |   |             Type = string
      |   |
      |   |-- element - Name = content
      |                 Type = string
      |   
      |-- sequence - DES = All Elements Delimited,
          |          Group Indicator = <CR><LF>03
          |          Delimiter = <CR><LF> 
          |          Data Pattern =([^\r]|(\r[^\n])|(\r\n[^0])|(\r\n0[^4]))*
          |
          |-- element - Name = msg
                        Type = string                 



Regards,

juddg.
Back to top
View user's profile Send private message
leo.yue
PostPosted: Tue Mar 28, 2006 7:52 pm    Post subject: Reply with quote

Acolyte

Joined: 20 Oct 2004
Posts: 52

Many Many Many thanks, juddg. You are so cool!
Back to top
View user's profile Send private message
leo.yue
PostPosted: Wed Mar 29, 2006 4:20 am    Post subject: Reply with quote

Acolyte

Joined: 20 Oct 2004
Posts: 52

Hi, all

In order to transform TDS format to XML format, I add a compute node. In this node, I just write
Quote:
SET OutputRoot.Properties.MessageFormat = 'XML';


I got the XML format, but in the xml I found that

Quote:
<?xml version="1.0" encoding="ibm-437_P100-1995"?>


In fact, I want to set "UTF-8" as encoding, how can I do it?
Another issue, if I put the TDS message into the input queue, like this

Quote:
<CR><LF>01AAAA BBBB CCCC
<CR><LF>DDDD EEEE
<CR><LF>02Hello Blue Green White
<CR><LF>Red Yellow
<CR><LF>03Here is the Message
<CR><LF>For You
<CR><LF>04
<CR><LF>


I got an error while MRM parsing. [/quote]
Back to top
View user's profile Send private message
dsriksha
PostPosted: Wed Mar 29, 2006 7:30 am    Post subject: Reply with quote

Voyager

Joined: 27 Feb 2005
Posts: 95

Quote:
<CR><LF>01AAAA BBBB CCCC
<CR><LF>DDDD EEEE
<CR><LF>02Hello Blue Green White
<CR><LF>Red Yellow
<CR><LF>03Here is the Message
<CR><LF>For You
<CR><LF>04
<CR><LF>

Look here for what Kimbert said:
http://www.mqseries.net/phpBB2/viewtopic.php?t=28355
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » TDS parser issue
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.