function xml_start_element($parser, $name, $attrs) { switch (strtolower($name)) { case "shortdesc": case "desc": $this->output = null; switch ($this->stack->gettos()) { case "classmeta": case "attribute": case "method": case "signal": case "constructor": $this->flags = $this->flags | DOCMERGER_OUTPUT_ON; } /* -- Fall through -- */ /* -- Fall through -- */ case "classmeta": case "methods": case "method": case "signals": case "signal": case "attributes": case "attribute": case "constructor": $this->stack->push(strtolower($name)); break; case "function": case "signalname": if ($this->stack->gettos() == "method" || $this->stack->gettos() == "signal" || $this->stack->gettos() == "constructor") { $this->stack->push(strtolower($name)); $this->output = null; $this->flags = $this->flags | DOCMERGER_OUTPUT_ON; break; } /* -- Else Fall through -- */ /* -- Else Fall through -- */ default: if ($this->flags & DOCMERGER_OUTPUT_ON) { $this->output .= '<' . strtolower($name) . DocMerger::AttrsToString($attrs) . '>'; } } }
/** * Parses the given file. * * This method should only be called from the prepare method. * * @access private * @param string $file The path to the file to be parsed. * @reutrn void */ function parse($file) { // Try to open the file. $fp = fopen($file, "r"); if (!$fp) { die("Could not open input file"); } // Parse each line of the file. while ($data = fread($fp, 4096)) { if (!xml_parse($this->parser, $data, feof($fp))) { // Handle any errors found. DocMerger::XMLErrorHandler($this->parser); } } }