| <?php |
| |
| #***************************************************************************** |
| # |
| # amwExamples_script_xml.php |
| # |
| # Author: Freddy Allilaire, Marcos Didonet Del Fabro |
| # Date: 2006-07-17 |
| # |
| #**************************************************************************** |
| |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/gmt/resources/scripts/xml_sax_parsing_extension.php"); |
| |
| function & getAmwScenariosParsed($file_name) { |
| $handler = new ATLFileHandler(); |
| parse_xml_file($file_name, $handler); |
| return $handler->amwScenarios; |
| } |
| |
| |
| class ATLFileHandler extends XmlFileHandler { |
| var $amwScenarios; |
| |
| function get_root_element_handler() { |
| return new ATLRootHandler(); |
| } |
| |
| function end_root_element_handler($handler) { |
| $this->amwScenarios = & $handler->amwScenarios; |
| } |
| } |
| |
| |
| class ATLRootHandler extends XmlElementHandler { |
| var $amwScenarios; |
| |
| function & get_amwScenarios_handler($attributes) { |
| return new AmwScenariosHandler(); |
| } |
| |
| function end_amwScenarios_handler($handler) { |
| $this->amwScenarios = & $handler->amwScenarios; |
| } |
| } |
| |
| /* |
| * The FeedHandler class takes care of the root element in the file. |
| */ |
| class AmwScenariosHandler extends XmlElementHandler { |
| var $amwScenarios; |
| |
| function AmwScenariosHandler() { |
| $this->amwScenarios = new AmwScenarios(); |
| } |
| |
| function & get_category_handler($attributes) { |
| return new CategoryHandler(); |
| } |
| |
| function end_category_handler($handler) { |
| $this->amwScenarios->add_category($handler->category); |
| } |
| } |
| |
| |
| class CategoryHandler extends XmlElementHandler { |
| var $category; |
| |
| function CategoryHandler() { |
| $this->category = new Category(); |
| } |
| |
| function & get_name_handler($attributes) { |
| return new SimplePropertyHandler($this->category, "name"); |
| } |
| |
| function & get_description_handler($attributes) { |
| return new ComplexPropertyHandler($this->category, "description"); |
| } |
| |
| function & get_amwExample_handler($attributes) { |
| return new AmwExampleHandler(); |
| } |
| |
| function end_amwExample_handler($handler) { |
| $this->category->add_amwExample($handler->amwExample); |
| } |
| |
| |
| } |
| |
| class AmwExampleHandler extends XmlElementHandler { |
| var $amwExample; |
| |
| function AmwExampleHandler() { |
| $this->amwExample = new AmwExample(); |
| } |
| |
| function & get_shortName_handler($attributes) { |
| return new SimplePropertyHandler($this->amwExample, "shortName"); |
| } |
| function & get_name_handler($attributes) { |
| return new SimplePropertyHandler($this->amwExample, "name"); |
| } |
| function & get_docLink_handler($attributes) { |
| return new SimplePropertyHandler($this->amwExample, "docLink"); |
| } |
| function & get_sourceLink_handler($attributes) { |
| return new SimplePropertyHandler($this->amwExample, "sourceLink"); |
| } |
| function & get_description_handler($attributes) { |
| return new ComplexPropertyHandler($this->amwExample, "description"); |
| } |
| function & get_pubDate_handler($attributes) { |
| return new SimplePropertyHandler($this->amwExample, "pubDate"); |
| } |
| } |
| |
| class AmwScenarios { |
| |
| var $category; |
| |
| function AmwScenarios() { |
| $this->category = array(); |
| } |
| |
| function add_category(&$category) { |
| array_push($this->category, $category); |
| } |
| } |
| |
| |
| class Category { |
| var $name; |
| var $description; |
| var $amwExample; |
| |
| function Category() { |
| $this->amwExample = array(); |
| } |
| |
| function add_amwExample(&$amwExample) { |
| array_push($this->amwExample, $amwExample); |
| } |
| } |
| |
| |
| class AmwExample { |
| var $shortName; |
| var $name; |
| var $docLink; |
| var $sourceLink; |
| var $description; |
| var $pubDate; |
| } |
| |
| |
| |
| ?> |