parser/ExpatParser.php

Show: inherited
Table of Contents

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.

Access
public  
Author
Andreas Aderhold  
Copyright
2001,2002 THYRELL. All rights reserved  
Package
phing.parser  
Version
$Id$  

\ExpatParser

Package: phing\parser

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.

Parent(s)
\AbstractSAXParser
Access
public  
Author
Andreas Aderhold  
Copyright
2001,2002 THYRELL. All rights reserved  
Version
$Id$  

Properties

Propertyprivate  $buffer= '4096'
Default value4096Details
Type
n/a
Propertyprivate  $error_string= '""'
Default value""Details
Type
n/a
Propertyprivate  $file= ''
Details
Type
n/a
Propertyprotected  $handler= ''
inherited

The AbstractHandler object.

Inherited from: \AbstractSAXParser::$$handler
Details
Type
n/a
Inherited_from
\AbstractSAXParser::$$handler  
Propertyprivate  $line= '0'
Default value0Details
Type
n/a
Propertyprivate\Location  $location= ''

Current cursor pos in XML file.
Details
Type
\Location
Propertyprivateresource  $parser= ''

Details
Type
resource
Propertyprivate\Reader  $reader= ''

Details
Type
\Reader

Methods

methodpublic__construct( \Reader $reader, string $filename = null ) : void

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.

Throws
Exception Description
\Exception if the given argument is not a PhingFile object
methodpubliccharacters( resource $parser, string $data ) : void
inherited

Method that gets invoked when the parser runs over CDATA.

Inherited from: \AbstractSAXParser::characters()

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.

Parameters
Name Type Description
$parser resource

php's internal parser handle.

$data string

the CDATA

Throws
Exception Description
\Exception - Exceptions may be thrown by the Handler
methodpublicendElement( object $parser, string $name ) : void
inherited

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

Inherited from: \AbstractSAXParser::endElement()

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.

Parameters
Name Type Description
$parser object

the php's internal parser handle

$name string

the closing tag name

Throws
Exception Description
\Exception - Exceptions may be thrown by the Handler
methodpublicgetLocation( ) : 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 the location of the current parser
Details
Access
public  
methodpublicparse( ) : int

Starts the parsing process.

Returns
Type Description
int 1 if the parsing succeeded
Throws
Exception Description
\ExpatParseException if something gone wrong during parsing
\IOException if XML file can not be accessed
Details
Access
public  
methodpublicparserSetOption( 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 true if the option could be set, otherwise false
Throws
Exception Description
mixed the value to set
Details
Access
public  
methodpublicsetHandler( \AbstractHandler $obj ) : void
inherited

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

Inherited from: \AbstractSAXParser::setHandler()
Parameters
Name Type Description
$obj \AbstractHandler

The handler object.

methodpublicstartElement( object $parser, string $name, array $attribs ) : void
inherited

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

Inherited from: \AbstractSAXParser::startElement()

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.

Parameters
Name Type Description
$parser object

the php's internal parser handle

$name string

the open tag name

$attribs array

the tag's attributes if any

Throws
Exception Description
\Exception - Exceptions may be thrown by the Handler
Documentation was generated by DocBlox 0.18.1.