Author |
Message
|
madhulika_desai |
Posted: Thu May 19, 2005 1:09 am Post subject: TDS Message Set problem |
|
|
Newbie
Joined: 19 May 2005 Posts: 9
|
Hi,
I am required to create a TDS message set which is required to parse data of the following format:
.........[data11~data12~data21~data22~data31~data32~data41~data42]......
I have created a local group of type sequence, which consists of a compound type, say, comp1, which in turn consists of two simple type elements. The MaxOccurs for the compund type is 15. However the repeating element delimiter and the delimiter for the compound type is the same, i.e., ~. Therefore, if the compound element occurs less that 15 times I have to have '~~' at the end of the data to indicate the end of occurrences. That is,
.........[data11~data12~data21~data22~data31~data32~data41~data42~~]......
Is there a way to avoid having to do this, i.e., adding the '~~'?
- Madhulika |
|
Back to top |
|
 |
kimbert |
Posted: Thu May 19, 2005 2:24 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I'm surprised. I would have expected that the ] would close the inner structures as well as the outer structure, thus terminating the repeats. Maybe your example message was a bit simpler than the real one? |
|
Back to top |
|
 |
madhulika_desai |
Posted: Thu May 19, 2005 2:31 am Post subject: |
|
|
Newbie
Joined: 19 May 2005 Posts: 9
|
no, the structure is more or less the same. But the ']' does not seem to be terminating the repeats. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu May 19, 2005 2:41 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I think Kimbert's suggestion was that you SHOULD use the ] to terminate the group, instead of using ~. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
madhulika_desai |
Posted: Thu May 19, 2005 3:13 am Post subject: |
|
|
Newbie
Joined: 19 May 2005 Posts: 9
|
I get a parser exception if I dont use '~~'.
By the way, this is documented in the Information Centre for Message Broker.
Quote:
If the delimiter and RED match, then two delimiters are output to indicate that the repeat is ending. So if the delimiter and RED are *, then the bitstream reads:
data1*data2**data3*data4
unquote
I wanted to know if there is a workaround to this. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu May 19, 2005 3:16 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The work around for it is to change your data model.
In your case, use the ] as your group terminator and ~ as your repeating element delimiter.
Assuming, that is, each of your groups are actually wrapped in [].
Otherwise... you have to live with ~~. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kimbert |
Posted: Thu May 19, 2005 3:34 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I need to get this straight - bear with me
1. Does your bitstream actually contain the ] at the end of the repeats, or was that just the way you wrote down the example?
2. If you are getting a parser exception, can you post the full text. (I know about the double-RED rule for terminating a set of repeats, but I also know that any enclosing markup (like the ]) should terminate all nested structures) |
|
Back to top |
|
 |
madhulika_desai |
Posted: Thu May 19, 2005 3:44 am Post subject: |
|
|
Newbie
Joined: 19 May 2005 Posts: 9
|
I have already done this. The problem is I have to give a '~~' in spite of the ']', or else I get a parseNext exception. |
|
Back to top |
|
 |
kimbert |
Posted: Thu May 19, 2005 8:13 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Did you see the questions I posted? If you provide the text of the exception, I may be able to help. |
|
Back to top |
|
 |
madhulika_desai |
Posted: Thu May 19, 2005 8:35 pm Post subject: |
|
|
Newbie
Joined: 19 May 2005 Posts: 9
|
When I track the message in the debugger, I get the following exception after the ResetContentDescriptor node (which resets the message to the message set in question) : ImbRecoverableException caught from worker -> ParseNext.
This happens after the existing compound type elements get parsed, i.e., if there is data for 4 compound type elements (when the maxoccurs has been defined as 15 in the sequence) I get the above exception after the 4th element has been parsed.
Further, after the next node (which is a trace node to extract the root tree), the data meant for the next element in the message (after the sequence) goes into the first element of a newly created compound type element (5th in this case) and I get a "The field length was greater than maxLen" exception since the data for the next field exceeds the maxLen constraint for the compound element field. |
|
Back to top |
|
 |
kimbert |
Posted: Fri May 20, 2005 1:12 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
So your model looks like this?
Code: |
Sequence ( Group indicator=[ , Group Terminator=] )
comp1 ( All Elements Delimited, Delimiter = ~ , Repeating Element Delimiter = ~)
element1
element2
|
|
|
Back to top |
|
 |
madhulika_desai |
Posted: Fri May 20, 2005 2:10 am Post subject: |
|
|
Newbie
Joined: 19 May 2005 Posts: 9
|
yes, just that the comp element has maxoccurs set to 15. |
|
Back to top |
|
 |
|