|   | 
	 
  
    | 
RSS Feed - WebSphere MQ Support
 | 
RSS Feed - Message Broker Support
 |   
 
  
	     | 
	 | 
   
 
  
	|  A complex MessageSet | 
	« View previous topic :: View next topic »  | 
   
  
  	
	  
		
		
		  | Author | 
		  Message
		 |  
		
		  | drano | 
		  
		    
			  
				 Posted: Wed May 28, 2008 6:24 am    Post subject: A complex MessageSet | 
				     | 
			   
			 
		   | 
		 
		
		   Novice
 
 Joined: 02 May 2002 Posts: 15 Location: Serv'N Data 
  | 
		  
		    
			  
				Hi all,
 
 
I have a complex messageset to define. I am trying to use TDS. 
 
 
The format:
 
LineRecord (Mandatory, and with tag in the 4 first characters)
 
Data (0 to 10 occurences, without a tag
 
LineRecord...
 
 
I have created a messageset for it with choice group and two elements in this group: 
 
* LineRecord with a rule "Tag Fixed Length" with the tag name
 
* Data without a rule
 
My choice is unbounded (Max occurences -1)
 
 
This messageset is ok. But difficult to use mapping node to map in this format:
 
Record
 
  LineRecord
 
  Data
 
  Data
 
Record
 
  LineRecord
 
  Data
 
...
 
 
Do you know how to change this messageset to keep the real tree structure ? Or maybe use it in the mapping node ? I think that I could create my own ESQL instead of Mapping. But for maintenance reasons, I'd rather to use Mapping node.
 
 
Thanks
 
Didier Rano | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | kimbert | 
		  
		    
			  
				 Posted: Wed May 28, 2008 6:53 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	| Do you know how to change this messageset to keep the real tree structure ? | 
   
 
   You just need to replace your groups with elements.
 
Elements in the message definition map to elements in the message tree. Groups map to nothing at all in the message tree, so their members appear as members of the nearest parent element ( in your case, the message itself! ) | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | drano | 
		  
		    
			  
				 Posted: Wed May 28, 2008 7:11 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Novice
 
 Joined: 02 May 2002 Posts: 15 Location: Serv'N Data 
  | 
		  
		    
			  
				Ok, I add Record instead of my choice group (In fact my choice group is inside the Record). This Record is unbounded (max occurences -1), and not for my choice group (max occurences 1).
 
 
Then, the result:
 
Record
 
  Line
 
Record
 
  Data
 
Record
 
  Data
 
Record
 
  Line
 
...
 
 
It it not easier to map in the XML destination:
 
Line
 
  Data
 
  Data
 
Line
 
   ... | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | kimbert | 
		  
		    
			  
				 Posted: Thu May 29, 2008 3:56 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				The shape of the message tree is determined by the shape ( the element structure ) of your message definition. You have chosen an unnatural shape for your message definition. I expect you did that because you could not make the message parse successfully any other way.
 
 
The obvious logical structure for your data would be
 
   
	| Code: | 
   
  
	Message
 
    Line maxOccurs=-1
 
        LineRecord minOccurs=1, maxOccurs=1
 
        Data minOccurs=0, maxOccurs=-1
 
 | 
   
 
Please note the use of Code tags to preserve the indentation - makes it much easier to read doesn't it  
 
 
Next problem is how to retain that logical structure and still parse your input message successfully. The trick is to detect the tag of LineRecord on the Line element, using a Data Pattern. 
 
 
Assuming that your 4-character tag is 'ABCD',  we need
 
   
	| Code: | 
   
  
	Message
 
    complexType DataElementSeparation="Use Data Pattern"
 
        Line maxOccurs=-1, Data Pattern="([^A]|(A[^B])|(AB[^C])|(ABC[^D]))*"
 
            complexType DataElementSeparation="All Elements Delimited", Delimiter=<CR>, GroupTerminator=<CR>, Group Indicator='ABCD'
 
                LineRecord minOccurs=1, maxOccurs=1
 
                Data minOccurs=0, maxOccurs=-1, Repeating Element Delimiter=<CR>
 
 | 
   
 
 
 
- The data pattern is complex because it must match and select the entire Line element, up to ( but not including ) the next tag.
 
- We are consuming the tag on LineRecord using the Group Indicator on Line.
 
 
Warning : this is not tested. If it does not work first time, please take a user trace and read the entire text of all messages emitted from the TDS parser. If you need to ask further questions, please take time to supply all required information. | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | 
		    
		   | 
		 
	   
	 | 
   
 
  
	     | 
	 | 
	Page 1 of 1 | 
   
 
 
 
  
  	
	  
		
		  
 
  | 
		  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
  | 
  		 
	   
	 | 
   
 
  	 | 
	  |