ExpatParser::__construct PHP Method

__construct() public method

The constructor accepts a PhingFile object that represents the filename for the file to be parsed. It sets up php's internal expat parser and options.
public __construct ( Reader $reader, string $filename = null )
$reader Reader The Reader Object that is to be read from.
$filename string Filename to read.
    function __construct(Reader $reader, $filename = null)
    {
        $this->reader = $reader;
        if ($filename !== null) {
            $this->file = new PhingFile($filename);
        }
        $this->parser = xml_parser_create();
        $this->buffer = 4096;
        $this->location = new Location();
        xml_set_object($this->parser, $this);
        xml_set_element_handler($this->parser, array($this, "startElement"), array($this, "endElement"));
        xml_set_character_data_handler($this->parser, array($this, "characters"));
    }