| Author | 
		  Message
		 | 
		
		  | ins0mniac2 | 
		  
		    
			  
				 Posted: Wed May 16, 2007 6:55 am    Post subject: Changing name of a referenced element | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 25 Jul 2005 Posts: 33
  
  | 
		  
		    
			  
				Hi,
 
 
I am using Broker v6.
 
I wanted to know if it was possible to change the name of a referenced element upon attaching it to another part of a tree.
 
 
For example I have the following xml:
 
 
<test>
 
  <test1>test1</test1>
 
  <test2>test1</test2>
 
  <test3>test1</test3>
 
  <test4>test1</test4>
 
</test>
 
 
I would declare a reference
 
 
DECLARE myRef REFERENCE TO InputRoot.XML.test;
 
 
I then detach the reference and want to attach it to another part of XML message but name the root element differently.
 
 
<temp>
 
  <test1>test1</test1>
 
  <test2>test1</test2>
 
  <test3>test1</test3>
 
  <test4>test1</test4>
 
</temp>
 
 
Is this possible?
 
 
I tried playing with the ATTACH statement but didnt have any success, I could not find anything in documentation that would allow me to do so.  Any help would be much appriciated.
 
 
Thanx | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | marcin.kasinski | 
		  
		    
			  
				 Posted: Wed May 16, 2007 12:40 pm    Post subject: Re: Changing name of a referenced element | 
				     | 
			   
			 
		   | 
		
		
		   Sentinel
 
 Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw 
  | 
		  
		    
			  
				Hi, 
 
 
I suggest (without testing it)
 
 
 
   
	| Code: | 
   
  
	| SET myRef VALUE = 'temp'; | 
   
 
 _________________ Marcin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | ins0mniac2 | 
		  
		    
			  
				 Posted: Wed May 16, 2007 12:59 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 25 Jul 2005 Posts: 33
  
  | 
		  
		    
			  
				| Doing that resets the reference and assigns it a new value of temp losing the tree that the reference previously had. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Wed May 16, 2007 12:59 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				Really, you need to use XMLNS or XMLNSC.
 
 
Also, you don't want to change the VALUE of the element, you want to change the NAME. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | marcin.kasinski | 
		  
		    
			  
				 Posted: Wed May 16, 2007 1:11 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Sentinel
 
 Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw 
  | 
		  
		    
			  
				
   
	| jefflowrey wrote: | 
   
  
	Really, you need to use XMLNS or XMLNSC.
 
 
Also, you don't want to change the VALUE of the element, you want to change the NAME. | 
   
 
 
 
Ups sorry.
 
I wanted to post:
 
 
   
	| Code: | 
   
  
	| SET myRef NAME = 'temp'; | 
   
 
 _________________ Marcin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | ins0mniac2 | 
		  
		    
			  
				 Posted: Wed May 16, 2007 2:52 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 25 Jul 2005 Posts: 33
  
  | 
		  
		    
			  
				yes the latest piece of code worked, and  I was using XMLNSC, just trying to simplify the case.
 
Thanx a lot guys. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |