Public Member Functions | |
PHPTAL_XML_Parser () | |
__construct () | |
_parse ($data, $eof=true) | |
parseString ($data) | |
parseFile ($path) | |
_onElementStart ($parser, $tag, $attributes) | |
_onElementClose ($parser, $tag) | |
_onElementData ($parser, $data) | |
_onSpecific ($parser, $data) | |
getLineNumber () | |
onElementStart ($tag, $attributes) | |
onElementClose ($tag) | |
onElementData ($data) | |
onSpecific ($data) | |
Public Attributes | |
$_file = '#string' | |
$_tags = array() | |
$_parser | |
$_error | |
$_xmlErrors |
Note:
I didn't use the XML/Parser package because of reference problems due to call_user_func and call_user_method.
This problem should vanished with automatic object referencing in php4.4 (ZendEngine2) remind me to remove this parser at this time.
This class uses "xml_*" php functions to parse xml data.
To create a new xml parser, extends this class and implements following methods.
Here's an exemple of xml parser implementation.
<?php require_once PT_IP . "/PHPTAL/XML_Parser.php";
class MyParser extends PHPTAL_XML_Parser { function onElementStart($tag, $attributes) { echo "new tag $tag with attributes :", endl; print_r($attributes); }
function onElementClose($tag) { echo "tag ",$tag," is closed", endl; }
function onElementData($data) { echo "some plain text : ", $data, endl; }
function onSpecific($data) { echo "non xml data maybe <?xml...?> :", $data, endl; } };
// MyParser usage : $p = new MyParser(); $p->parse( $myString );
?>
Definition at line 84 of file XML_Parser.php.
|
XML parser constructor. Definition at line 118 of file XML_Parser.php. References __construct(). |
|
XML parser php4.4 constructor. Definition at line 126 of file XML_Parser.php. Referenced by PHPTAL_XML_Parser(). |
|
Definition at line 189 of file XML_Parser.php. References _onElementClose(), and onElementClose(). Referenced by _onElementClose(). |
|
Definition at line 195 of file XML_Parser.php. References _onElementData(), data, and onElementData(). Referenced by _onElementData(). |
|
Definition at line 183 of file XML_Parser.php. References _onElementStart(), and onElementStart(). Referenced by _onElementStart(). |
|
Definition at line 201 of file XML_Parser.php. References _onSpecific(), data, and onSpecific(). Referenced by _onSpecific(). |
|
Parse specified data and call parser implementation of callback methods.
Definition at line 141 of file XML_Parser.php. References _parse(), and data. Referenced by _parse(). |
|
Return current parser line number.
Definition at line 212 of file XML_Parser.php. Referenced by PHPTAL_Parser::onElementStart(). |
|
Abstract callback called when a tag is closed.
Reimplemented in PHPTAL_Parser. Definition at line 234 of file XML_Parser.php. References onElementClose(). Referenced by _onElementClose(), and onElementClose(). |
|
Abstract callback called when some #cdata is found.
Reimplemented in PHPTAL_Parser. Definition at line 241 of file XML_Parser.php. References onElementData(). Referenced by _onElementData(), and onElementData(). |
|
Abstract callback called when a new xml tag is opened.
Reimplemented in PHPTAL_Parser. Definition at line 227 of file XML_Parser.php. References onElementStart(). Referenced by _onElementStart(), and onElementStart(). |
|
Abstract callback called when non tags entities appear in the document. This method is called by <?xml ...?> < > and other specific things like <?php ?>.
Reimplemented in PHPTAL_Parser. Definition at line 251 of file XML_Parser.php. References onSpecific(). Referenced by _onSpecific(), and onSpecific(). |
|
Definition at line 166 of file XML_Parser.php. References data, parseFile(), and path. Referenced by parseFile(). |
|
Definition at line 161 of file XML_Parser.php. References data, and parseString(). Referenced by parseString(). |
|
Definition at line 89 of file XML_Parser.php. |
|
Reimplemented in PHPTAL_Parser. Definition at line 86 of file XML_Parser.php. |
|
Definition at line 88 of file XML_Parser.php. |
|
Definition at line 87 of file XML_Parser.php. |
|
Initial value:
Definition at line 90 of file XML_Parser.php. |