| Author | 
		  Message
		 | 
		
		  | Djeyli | 
		  
		    
			  
				 Posted: Mon Jul 08, 2002 6:46 am    Post subject: Using ESQL to get XML Property Set ? | 
				     | 
			   
			 
		   | 
		
		
		    Apprentice
 
 Joined: 03 Apr 2002 Posts: 28 Location: New Zealand 
  | 
		  
		    
			  
				Hi all
 
 
I am VERY new to ESQL and have a bit of a problem. I have looked thru the literature, but as many of you know it is not all that friendly !!
 
 
I have an XML Input file like this:
 
 
<Mercedes>
 
 <vehicle MessageID="1B-3RG" Service="Breakdown" Person="JSmith"/>
 
</Mercedes>
 
 
I need the following as output:
 
 
<ContactPerson>JSmith</ContactPerson>
 
 
I need to know how to do this in the ESQL for example :
 
 
SET OutputRoot.XML."ContactPerson" = InputRoot.XML. ??? ;
 
 
I am sure its pretty easy, but I can't find it anywhere !
 
 
Thanks
 
J | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kirani | 
		  
		    
			  
				 Posted: Mon Jul 08, 2002 7:15 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Jedi Knight
 
 Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA 
  | 
		  
		    
			  
				Try this,
 
 
SET OutputRoot.XML.ContactPerson = InputRoot.XML.Mercedes.vehicle.(XML.Attribute)Person; _________________ Kiran
 
 
 
IBM Cert. Solution Designer & System Administrator - WBIMB V5
 
IBM Cert. Solutions Expert - WMQI
 
IBM Cert. Specialist - WMQI, MQSeries
 
IBM Cert. Developer - MQSeries
 
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Djeyli | 
		  
		    
			  
				 Posted: Mon Jul 08, 2002 11:36 pm    Post subject: Not quite right | 
				     | 
			   
			 
		   | 
		
		
		    Apprentice
 
 Joined: 03 Apr 2002 Posts: 28 Location: New Zealand 
  | 
		  
		    
			  
				Hi Kiran
 
 
It hasn't worked quite right. I am getting the information as an attribute in my final file. Eg:
 
 
<Dealer ContactPerson="JSmith">
 
</Dealer> 
 
 
Where it should be:
 
 
<Dealer>
 
  <ContactPerson>JSmith</ContactPerson>
 
</Dealer>
 
 
 
Regards
 
J | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kirani | 
		  
		    
			  
				 Posted: Tue Jul 09, 2002 7:42 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Jedi Knight
 
 Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA 
  | 
		  
		    
			  
				Hi J,
 
 
Use this,
 
DECLARE CPerson CHAR;
 
SET CPerson = InputRoot.XML.Mercedes.vehicle.(XML.Attribute)Person;
 
SET OutputRoot.XML.Dealer.ContactPerson = CPerson; _________________ Kiran
 
 
 
IBM Cert. Solution Designer & System Administrator - WBIMB V5
 
IBM Cert. Solutions Expert - WMQI
 
IBM Cert. Specialist - WMQI, MQSeries
 
IBM Cert. Developer - MQSeries
 
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mpuetz | 
		  
		    
			  
				 Posted: Tue Jul 09, 2002 8:42 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 05 Jul 2001 Posts: 149 Location: IBM/Central WebSphere Services 
  | 
		  
		    
			  
				Hi,
 
 
the recommended way of getting rid of the attribute in WMQI 2.1 is
 
to use the VALUE = statement.
 
 
SET OutputRoot.XML.Dealer.ContactPerson VALUE = InputRoot.XML.Mercedes.vehicle.(XML.Attribute)Person;
 
 
Explanation:
 
The normal assignment = does an assignment both to element VALUE and TYPE. 
 
If you don't qualify the element with e.g. (XML.Element) or (XML.Attribute) (or others) MQSI matches on element name only:
 
- for reading InputRoot.XML.Mercedes.vehicle.Person
 
  would give you the first element below vehicle with Name Person.
 
  In your case it would find (XML.Attribute)Person
 
- for writing, if the element does not exist it creates a new one with
 
  the given name and the type of the element on the right hand side.
 
  If no type is given, the XML parser creates an element of type
 
  (XML.Element) _________________ Mathias Puetz
 
 
IBM/Central WebSphere Services
 
WebSphere Business Integration Specialist | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Djeyli | 
		  
		    
			  
				 Posted: Wed Jul 10, 2002 1:16 am    Post subject: Thanks | 
				     | 
			   
			 
		   | 
		
		
		    Apprentice
 
 Joined: 03 Apr 2002 Posts: 28 Location: New Zealand 
  | 
		  
		    
			  
				Hi Kiran, Mathias
 
 
Thanks for the help !
 
Both ways work perfectly !
 
 
Regards
 
J | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |