Author |
Message
|
vairavan |
Posted: Wed Feb 25, 2009 7:23 pm Post subject: Message modeling |
|
|
Apprentice
Joined: 22 Apr 2008 Posts: 42
|
Hi,
I need to parse the below message. I just need to read EmpId's from the Message. I have given Tagged Delimted for reading Emp Id's with Identifier as 'EmpId:'. For reading the next EmpId, how can I parse it with our reading all the middle Junk lines. Help on this would be greatly appreciated?
Sample Message goes here...
-------------------------------------
EmpId: 3007 <CR><LF>
-Junk <CR><LF>
&%&^&^^*&*&*^* <CR><LF>
%^^%&%&^%&%^ <CR><LF>
EmpId: 4007 <CR><LF>
Name: Test Name <CR><LF>
-------------------------------------
Thanks,
A Message Broker Developer |
|
Back to top |
|
 |
kimbert |
Posted: Thu Feb 26, 2009 2:38 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
This can be done, but Tagged Delimited is not the correct approach. Please post an example of the message tree structure that you want to get. Then I should be able to suggest something that works. |
|
Back to top |
|
 |
vairavan |
Posted: Thu Feb 26, 2009 5:30 am Post subject: |
|
|
Apprentice
Joined: 22 Apr 2008 Posts: 42
|
This ia human readable file. There is no Message tree. What i have given as a sample is the message coming in the file. We need to read that. Is it possible to read thr Provider Id alone without reading all the junk characters...? |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Feb 26, 2009 5:44 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You can't create a partial model. The model must match the entire physical bitstream.
You can create a model that only partly matches the logical structure of the message, with BLOB fields that capture the missing pieces of the physical message and you ignore in your code. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Feb 26, 2009 6:31 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
This ia human readable file. There is no Message tree. |
I know. I was asking for a description of the message tree which you want the MRM parser to produce. You probably thought that the answer was obvious, but it's not.
Anyway, I think your reply to mqjeff has answered my question. You want your message tree to look like this:
Code: |
MRM {
EmpId = "3007"
EmpId = "4007"
Name = "Test Name"
} |
I'm afraid you will have to make do with this:
Code: |
MRM {
EmpId = "3007"
Junk = "&%&^&^^*&*&*^* "
Junk = "%^^%&%&^%&%^ "
EmpId = "4007"
Name = "Test Name"
} |
I think a message model like the one below should work. Please try it, debug it using user trace ( not using the debugger ), and let us know how you get on:
Code: |
EmployeeMessage
Complex Type Composition="Choice", maxOccurs="-1",
DataElementSeparation="Tagged Delimited", Delimiter="<CR><LF>", Repeating Element Delimiter = "<CR><LF>, "TagDataSeparator=":"
Element Name="EmpId", type="xs:string", Tag="EmpId"
Element Name="EmpId", type="xs:string", Tag="Name"
Group DataElementSeparation="All Elements Delimited", Delimiter="<CR><LF>"
Element Name="Junk", type="xs:string"
|
The idea is that the parser first looks for the tags which are known. If none of them are found, it encounters the 'All Elements Delimited' group. But it cannot know whether that group is present in the bitstream, so it must assume that it is there, and parse an instance of 'Junk'. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Feb 26, 2009 7:17 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
kimbert wrote: |
Anyway, I think your reply to mqjeff has answered my question. |
I think I missed something. |
|
Back to top |
|
 |
vairavan |
Posted: Thu Feb 26, 2009 8:11 am Post subject: |
|
|
Apprentice
Joined: 22 Apr 2008 Posts: 42
|
Here I think, I have to give the clearcut sample and it's MRM.
Sample message:
----------------------------
EmpId: 3007
&%&^&^^*&*&*^*
%^^%&%&^%&%^
%^^%&%&^%&%^
EmpId: 3007
----------------------------
MRM Message should go like this...
MRM {
EMP
EmpId = "3007"
JunkComplexType
Junk = "&%&^&^^*&*&*^*%^^%&%&^%&%^%^^%&%&^%&%^"
EMP
EmpId = "4007"
} |
|
Back to top |
|
 |
|