# classes/phing/parser/ExpatParser.php

## \ExpatParser
jump to top

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.

Extends from
  \AbstractSAXParser
access
  public
author
  Andreas Aderhold
copyright
  © 2001,2002 THYRELL. All rights reserved
package
  phing.parser
version
  $Revision: 526 $ $Date: 2009-08-11 14:11:17 +0200 (Tue, 11 Aug 2009) $

### Properties

`$buffer= '4096'`
Default value `4096` Details

Type

`$error_string= ''`
Details

Type

`$file= ''`
Details

Type

`$line= '0'`
Default value `0` Details

Type

`\Location $location= ''`

Current cursor pos in XML file.
Details

Type
  \Location

`resource $parser= ''`

Details

Type
  resource

`\Reader $reader= ''`

Details

Type
  \Reader

### Methods

`__construct( \Reader $reader, string $filename = null ) :`
Constructs a new ExpatParser object.

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.

Parameters

Name | Type | Description
--- | --- | ---
$reader | \Reader | The Reader Object that is to be read from.
$filename | string | Filename to read.

Details

throws
  if the given argument is not a PhingFile object

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

Type | Description
--- | ---
object |

Details

access
  public

`parse( ) : int`
Starts the parsing process.
Returns

Type | Description
--- | ---
int |

Details

access
  public
throws
  if something gone wrong during parsing
throws
  if XML file can not be accessed

`parserSetOption( string $opt, $val ) : boolean`
Override PHP's parser default settings, created in the constructor.
Parameters

Name | Type | Description
--- | --- | ---
$opt | string | the option to set
$val |  |

Returns

Type | Description
--- | ---
boolean |

Details

access
  public
throws
  the value to set

Documentation was generated by DocBlox 0.13.1.