. */ require_once 'phing/parser/AbstractHandler.php'; include_once 'phing/parser/ExpatParseException.php'; include_once 'phing/parser/ProjectHandler.php'; /** * Root filter class for a phing buildfile. * * The root filter is called by the parser first. This is where the phing * specific parsing starts. RootHandler decides what to do next. * * @author Andreas Aderhold * @copyright © 2001,2002 THYRELL. All rights reserved * @version $Revision: 905 $ * @package phing.parser */ class RootHandler extends AbstractHandler { /** * The phing project configurator object */ private $configurator; /** * Constructs a new RootHandler * * The root filter is required so the parser knows what to do. It's * called by the ExpatParser that is instatiated in ProjectConfigurator. * * It recieves the expat parse object ref and a reference to the * configurator * * @param AbstractSAXParser $parser The ExpatParser object. * @param ProjectConfigurator $configurator The ProjectConfigurator object. */ function __construct(AbstractSAXParser $parser, ProjectConfigurator $configurator) { $this->configurator = $configurator; parent::__construct($parser, $this); } /** * Kick off a custom action for a start element tag. * * The root element of our buildfile is the <project> element. The * root filter handles this element if it occurs, creates ProjectHandler * to handle any nested tags & attributes of the <project> tag, * and calls init. * * @param string $tag The xml tagname * @param array $attrs The attributes of the tag * @throws ExpatParseException if the first element within our build file * is not the >project< element */ function startElement($tag, $attrs) { if ($tag === "project") { $ph = new ProjectHandler($this->parser, $this, $this->configurator); $ph->init($tag, $attrs); } else { throw new ExpatParseException("Unexpected tag <$tag> in top-level of build file.", $this->parser->getLocation()); } } }