| Author | 
		  Message
		 | 
		
		  | Meow | 
		  
		    
			  
				 Posted: Mon Dec 15, 2003 7:19 am    Post subject: Checking the value of XML attribute | 
				     | 
			   
			 
		   | 
		
		
		    Voyager
 
 Joined: 25 Jun 2003 Posts: 95
  
  | 
		  
		    
			  
				Hi All,
 
 
how do i check the value of an xml attribute.. say i have
 
 
<query>
 
<node value-type="DATE">JOINDATE</node>
 
<node>12/15/2003</node>
 
</query>
 
 
DECLARE myRef REFERENCE TO InputRoot.XML.query
 
 
IF(myRef.node[1].(XML.Attribute)"value-type" = 'DATE') then 
 
----
 
end if;
 
 
The above If statement doesnot work properly. can you give me the correct ESQL syntax.
 
 
Thanks.
 
Paruvan | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | EddieA | 
		  
		    
			  
				 Posted: Mon Dec 15, 2003 10:07 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi
 
 Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles 
  | 
		  
		    
			  
				Do you even need the (XML.Attribute) when 'reading' a value.  Here's some actual working code:
 
 
   
	| Code: | 
   
  
	SET OutputRoot.XML.WorkOrder.Premises.(XML.Attribute)MeterLocation = InputLocalEnvironment.ACI.AMWO_ROUTE_ORDER.AMWO_METER_LOC;
 
...
 
...
 
SET OutputRoot.XML.WorkOrder.WorkOrderDetail.(XML.Attribute)MeterLocation = OutputRoot.XML.WorkOrder.Premises.MeterLocation; | 
   
 
 
 
Cheers, _________________ Eddie Atherton
 
IBM Certified Solution Developer - WebSphere Message Broker V6.1
 
IBM Certified Solution Developer - WebSphere Message Broker V7.0 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Meow | 
		  
		    
			  
				 Posted: Mon Dec 15, 2003 1:48 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Voyager
 
 Joined: 25 Jun 2003 Posts: 95
  
  | 
		  
		    
			  
				i need to check the value of attribute to take decision on some of the things. 
 
Thanks for your input. 
 
 
 
supose say i want to insert date into the database and i get an XML string 
 
 
<node value-type="DATE">2003-12-15</node> . since its a date i have to make a insert statement as 
 
 
insert into table values('2003-12-15');
 
 
can some one tell me how do i insert ' coz when i retrieve the element value it gives me something like 2003-12-15 but to perform database operation and since its of type date i need to add ' on either side. 
 
 
Please let me know.
 
Thanks
 
Paruvan | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | EddieA | 
		  
		    
			  
				 Posted: Mon Dec 15, 2003 5:50 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi
 
 Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles 
  | 
		  
		    
			  
				OK, you've changed the XML, so this is based on the last one you gave:
 
   
	| Code: | 
   
  
	DECLARE WorkDate CHARACTER;
 
 
IF InputBody.query.node."value-type" = 'DATE' THEN
 
  SET WorkDate = '''' || InputBody.query.node || '''';
 
END IF; | 
   
 
 
 
You can then use WorkDate, which contains the input date surrounded by single quotes.
 
 
Cheers, _________________ Eddie Atherton
 
IBM Certified Solution Developer - WebSphere Message Broker V6.1
 
IBM Certified Solution Developer - WebSphere Message Broker V7.0 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Meow | 
		  
		    
			  
				 Posted: Mon Dec 15, 2003 6:12 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Voyager
 
 Joined: 25 Jun 2003 Posts: 95
  
  | 
		  
		    
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |