# ExpatParser

Extends \AbstractSAXParser

This class is a wrapper for the PHP's internal expat parser.

It takes an XML file represented by a abstract path name, and starts parsing the file and calling the different "trap" methods inherited from the AbstractParser class.

Those methods then invoke the represenatative methods in the registered handler classes.

author | Andreas Aderhold andi@binarycloud.com
copyright | 2001,2002 THYRELL. All rights reserved
version | $Id: 0e78856d8464d655550baa5a20b235b4049625f8 $
package | phing.parser

### Methods

## Constructs a SAX parser

    __construct()

inherited

## Method that gets invoked when the parser runs over CDATA.

    characters(resource $parser, string $data)

inherited

This method is called by PHP's internal parser functions and registered in the actual parser implementation.

It gives control to the current active handler object by calling the `characters()` method. That processes the given CDATA.

throws | Exceptions may be thrown by the Handler

### Arguments

#### $parser

`resource`

php's internal parser handle.

#### $data

`string`

the CDATA

## Method that gets invoked when the parser runs over a XML close element.

    endElement( $parser,  $name)

inherited

This method is called by PHP's internal parser funcitons and registered in the actual parser implementation.

It gives control to the current active handler object by calling the `endElement()` method.

throws | Exceptions may be thrown by the Handler

### Arguments

#### $parser

``

#### $name

``

## Returns the location object of the current parsed element. It describes the location of the element within the XML file (line, char)

    getLocation() : object

### Response

`object`

the location of the current parser

## Entrypoint for parser. This method needs to be implemented by the child classt that utilizes the concrete parser

    parse()

inherited abstract

## Sets options for PHP interal parser. Must be implemented by the parser class if it should be used.

    parserSetOption( $opt,  $val) :

inherited abstract

### Arguments

#### $opt

``

#### $val

``

### Response

``

## Sets the current element handler object for this parser. Usually this is an object using extending "AbstractHandler".

    setHandler(\AbstractHandler $obj)

inherited

### Arguments

#### $obj

`\AbstractHandler`

The handler object.

## Method that gets invoked when the parser runs over a XML start element.

    startElement( $parser,  $name,  $attribs)

inherited

This method is called by PHP's internal parser functions and registered in the actual parser implementation. It gives control to the current active handler object by calling the `startElement()` method.

throws | Exceptions may be thrown by the Handler

### Arguments

#### $parser

``

#### $name

``

#### $attribs

``

### Properties

## parser

    parser : resource

var |

### Type(s)

`resource`

## reader

    reader : \Reader

var |

### Type(s)

`\Reader`

## file

    file :

### Type(s)

``

## buffer

    buffer :

### Type(s)

``

## error_string

    error_string :

### Type(s)

``

## line

    line :

### Type(s)

``

## Current cursor pos in XML file.

    location : \Location

var | Current cursor pos in XML file.

### Type(s)

`\Location`

## The AbstractHandler object.

    handler :

inherited

### Type(s)

``