| Author | 
		  Message
		 | 
		
		  | pawel_janowski | 
		  
		    
			  
				 Posted: Tue Feb 07, 2012 6:59 am    Post subject: MRM to XMLNSC migration | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 13 Dec 2006 Posts: 38
  
  | 
		  
		    
			  
				Hi!
 
We are trying to migrate from MRM to XMLNCS. In the MRM domain, the name of the root element of the input message isn't stated explicitly so I can refer to the content of the XML message (its elements) directly 
   
	| Code: | 
   
  
	| InputRoot.MRM.header.field1 | 
   
 
 regardless of the name of the root element.
 
 
Is the simple way in XMLNSC domain to do the same? I mean to obtain a general way to rewrite from InputRoot to OutputRoot elements of the message which are of the same form, as was previously coded: 
   
	| Code: | 
   
  
	| OutputRoot.MRM.header.field1 = InputRoot.MRM.header.field1  | 
   
 
 
 
Regards,
 
 
Pawel
 
 
WMB 6.1 on AIX
 _________________ Pawel Janowski | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Tue Feb 07, 2012 7:03 am    Post subject: Re: MRM to XMLNSC migration | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| pawel_janowski wrote: | 
   
  
	Is the simple way in XMLNSC domain to do the same? I mean to obtain a general way to rewrite from InputRoot to OutputRoot elements of the message which are of the same form, as was previously coded: 
   
	| Code: | 
   
  
	| OutputRoot.MRM.header.field1 = InputRoot.MRM.header.field1  | 
   
 
 | 
   
 
 
 
Have you tried:
 
 
   
	| Code: | 
   
  
	| OutputRoot.XMLNSC.header.field1 = InputRoot.XMLNSC.header.field1 | 
   
 
 _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Tue Feb 07, 2012 7:07 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				So if the input document looks like 
   
	| Code: | 
   
  
	<xml>
 
<root>
 
     <header>
 
        <field1>data</field1>
 
        <field2>data</field2>
 
    <header/>
 
    <body>
 
         <field1>data</field1>
 
....
 
    </body>
 
</root> | 
   
 
 
Then, yes, when you import the schema that describes this into an MRM model, then you will use 
 to access the field1 data from the header, and use will use 
   
	| Code: | 
   
  
	| Root.root.header.field1 | 
   
 
 to access the field1 data from the header. 
 
 
And, yes, it's easy enough to use find/replace to change all occurrances of "Root.header" to "Root.root.header". | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | pawel_janowski | 
		  
		    
			  
				 Posted: Tue Feb 07, 2012 7:14 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 13 Dec 2006 Posts: 38
  
  | 
		  
		    
			  
				
   
	| mqjeff wrote: | 
   
  
	So if the input document looks like 
   
	| Code: | 
   
  
	<xml>
 
<root>
 
     <header>
 
        <field1>data</field1>
 
        <field2>data</field2>
 
    <header/>
 
    <body>
 
         <field1>data</field1>
 
....
 
    </body>
 
</root> | 
   
 
 
Then, yes, when you import the schema that describes this into an MRM model, then you will use 
 to access the field1 data from the header, and use will use 
   
	| Code: | 
   
  
	| Root.root.header.field1 | 
   
 
 to access the field1 data from the header. 
 
 
And, yes, it's easy enough to use find/replace to change all occurrances of "Root.header" to "Root.root.header". | 
   
 
 
 
Yes, but in such case I have to know the name of the root element ("root" in this case). I ask if I can do this in situation when I don't know what I've got on input, but I know that the message on input contains "header".
 
 
Pawel _________________ Pawel Janowski | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Tue Feb 07, 2012 7:17 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| pawel_janowski wrote: | 
   
  
	| I ask if I can do this in situation when I don't know what I've got on input, but I know that the message on input contains "header". | 
   
 
 
 
Start here and keep reading. _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | pawel_janowski | 
		  
		    
			  
				 Posted: Tue Feb 07, 2012 7:20 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 13 Dec 2006 Posts: 38
  
  | 
		  
		    
			  
				
   
	| Vitor wrote: | 
   
  
	
   
	| pawel_janowski wrote: | 
   
  
	| I ask if I can do this in situation when I don't know what I've got on input, but I know that the message on input contains "header". | 
   
 
 
 
Start here and keep reading. | 
   
 
 
 
Thanx.
 
 
I did this like this:
 
   
	| Quote: | 
   
  
	
 
OutputRoot.XMLNSC.outbody.header.field1 = InputRoot.XMLNSC.(XML.Element)[1].header.field1 | 
   
 
 
 
P. _________________ Pawel Janowski | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Tue Feb 07, 2012 7:25 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| pawel_janowski wrote: | 
   
  
	I did this like this:
 
   
	| Quote: | 
   
  
	
 
OutputRoot.XMLNSC.outbody.header.field1 = InputRoot.XMLNSC.(XML.Element)[1].header.field1 | 
   
 
 | 
   
 
 
 
You might want to consider using a field type different to XML.Element. Something that starts with XMLNSC which is part of the XMLNSC domain would be my tip. _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Tue Feb 07, 2012 7:26 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				pawel_janowski: Not sure whether 
 
a) you're a genius or
 
b) the XMLNSC pages in the info center are getting quite good or
 
c) you had a lucky moment
 
 
Either way, that is exactly the right solution. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Tue Feb 07, 2012 7:26 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				It will be more performant to 
   
	| Code: | 
   
  
	Declare thisRef REFERENCE TO InputRoot.XMLNSC;
 
MOVE thisRef FIRSTCHILD FIELDTYPE(XMLNSC.Element) | 
   
 
 
 
Note that you cannot safely use XML domain constants when referring to XMLNSC elements. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Tue Feb 07, 2012 7:30 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				
   
	| kimbert wrote: | 
   
  
	|  that is exactly the right solution. | 
   
 
 
Except for that pesky "(XML.Element)" stuck in there. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Tue Feb 07, 2012 7:34 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				| mqjeff : Good point. That *must* be changed to XMLNSC.Element. I'm sure pawel_janowski knows why this is important. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | pawel_janowski | 
		  
		    
			  
				 Posted: Tue Feb 07, 2012 9:26 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 13 Dec 2006 Posts: 38
  
  | 
		  
		    
			  
				
   
	| Vitor wrote: | 
   
  
	
   
	| pawel_janowski wrote: | 
   
  
	I did this like this:
 
   
	| Quote: | 
   
  
	
 
OutputRoot.XMLNSC.outbody.header.field1 = InputRoot.XMLNSC.(XML.Element)[1].header.field1 | 
   
 
 | 
   
 
 
 
You might want to consider using a field type different to XML.Element. Something that starts with XMLNSC which is part of the XMLNSC domain would be my tip. | 
   
 
 
 
I followed your tip and used XMLNSC.Folder instead of XML.Element.
 
Thanks.
 
 
Pawel _________________ Pawel Janowski | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Tue Feb 07, 2012 12:25 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	| I followed your tip and used XMLNSC.Folder instead of XML.Element | 
   
 
XMLNSC.Element is the correct choice.
 
If your document consisted of a single root tag with a value, XMLSNC.Folder wouldn't match the root element. I know that's an unlikely input document, but XMLNSC.Element is specifically designed for matching any XML tag. Accurate code is better than code that 'just works'. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |