| 
									
										
										
										
											2008-03-01 17:00:45 -05:00
										 |  |  | IN: xmode.utilities.tests | 
					
						
							| 
									
										
										
										
											2008-08-27 20:27:06 -04:00
										 |  |  | USING: accessors xmode.utilities tools.test xml xml.data kernel | 
					
						
							|  |  |  | strings vectors sequences io.files prettyprint assocs | 
					
						
							|  |  |  | unicode.case ;
 | 
					
						
							| 
									
										
										
										
											2007-11-28 23:34:11 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | TUPLE: company employees type ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-04-13 16:06:27 -04:00
										 |  |  | : <company> V{ } clone f company boa ;
 | 
					
						
							| 
									
										
										
										
											2007-11-28 23:34:11 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-30 21:32:26 -04:00
										 |  |  | : add-employee employees>> push ;
 | 
					
						
							| 
									
										
										
										
											2007-11-28 23:34:11 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | <TAGS: parse-employee-tag | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TUPLE: employee name description ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TAG: employee | 
					
						
							| 
									
										
										
										
											2008-04-13 16:06:27 -04:00
										 |  |  |     employee new
 | 
					
						
							| 
									
										
										
										
											2008-08-30 21:32:26 -04:00
										 |  |  |     { { "name" f (>>name) } { f (>>description) } } | 
					
						
							| 
									
										
										
										
											2007-11-28 23:34:11 -05:00
										 |  |  |     init-from-tag swap add-employee ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TAGS> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | \ parse-employee-tag see | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : parse-company-tag | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         <company> | 
					
						
							| 
									
										
										
										
											2008-08-30 21:32:26 -04:00
										 |  |  |         { { "type" >upper (>>type) } } | 
					
						
							| 
									
										
										
										
											2007-11-28 23:34:11 -05:00
										 |  |  |         init-from-tag dup
 | 
					
						
							|  |  |  |     ] keep
 | 
					
						
							| 
									
										
										
										
											2008-08-27 20:27:06 -04:00
										 |  |  |     children>> [ tag? ] filter
 | 
					
						
							| 
									
										
										
										
											2008-01-09 17:36:30 -05:00
										 |  |  |     [ parse-employee-tag ] with each ;
 | 
					
						
							| 
									
										
										
										
											2007-11-28 23:34:11 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ | 
					
						
							|  |  |  |     T{ company f
 | 
					
						
							|  |  |  |         V{ | 
					
						
							|  |  |  |             T{ employee f "Joe" "VP Sales" } | 
					
						
							|  |  |  |             T{ employee f "Jane" "CFO" } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         "PUBLIC" | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | ] [ | 
					
						
							| 
									
										
										
										
											2009-02-15 20:53:21 -05:00
										 |  |  |     "vocab:xmode/utilities/test.xml" | 
					
						
							| 
									
										
										
										
											2008-05-06 13:37:11 -04:00
										 |  |  |     file>xml parse-company-tag | 
					
						
							| 
									
										
										
										
											2007-11-28 23:34:11 -05:00
										 |  |  | ] unit-test |