Home » XML » XML_Parser
XML parsing class based on PHP's bundled expat
This package is unmaintained.
Download latest release 1.3.8 (there might be newer Composer installable version)
License: BSD License
Description
This is an XML parser based on PHPs built-in xml extension.
It supports two basic modes of operation: "func" and "event". In "func" mode, it will look for a function named after each element (xmltag_ELEMENT for start tags and xmltag_ELEMENT_ for end tags), and in "event" mode it uses a set of generic callbacks.
Since version 1.2.0 there's a new XML_Parser_Simple class that makes parsing of most XML documents easier, by automatically providing a stack for the elements.
Furthermore its now possible to split the parser from the handler object, so you do not have to extend XML_Parser anymore in order to parse a document with it.
Documentation
Maintainers
- Stephan Schmidt (schst) — lead, inactive
- Chuck Burgess (ashnazg) — lead, active
- Stig Sæther Bakken (ssb) — developer, inactive
- Tomas V.V.Cox (cox) — developer, inactive
Dependencies
Required
- PHP (>= 4.2.0)
- PEAR Installer (>= 1.4.0b1)
- PEAR
Releases
- 1.3.8 (stable, 2019-04-10)
Release notes
License: BSD License
PR #5: Don't use is_resource() for xml_parser resources
- 1.3.7 (stable, 2016-07-04)
Release notes
License: BSD License
Fix E_STRICT message on PHP7
- 1.3.6 (stable, 2015-08-26)
Release notes
License: BSD License
Fix broken package.xml
- 1.3.5 (stable, 2015-08-19)
Release notes
License: BSD License
Add composer compatibility
- 1.3.4 (stable, 2010-10-25)
Release notes
License: BSD License
Remove package.php from release
- 1.3.3 (stable, 2010-10-25)
Release notes
License: BSD License
Automatically built QA release
Bug #16467 Unit tests are broken - ashnazgBug #17725 Patch Avoid deprecated eregi functions - olleolleolle
- 1.3.2 (stable, 2009-01-21)
Release notes
License: BSD License
- Fix Bug #9328: assigned by reference error in XML_RSS parse
- add an AllTests.php for PHPUnit usage - 1.3.1 (stable, 2008-09-15)
Release notes
License: BSD License
- correct package.xml to reflect switch to BSD License
- 1.3.0 (stable, 2008-08-24)
Release notes
License: PHP License
- switch to BSD License
- switch to package.xml v2
- PEAR CS cleanup
- Fix Doc #13120: Mistake in example code - 1.2.8 (stable, 2006-12-01)
- 1.2.7 (stable, 2005-09-24)
Release notes
License: PHP License
- implemented request #4774: Error message contains column number
- 1.2.6 (stable, 2005-03-25)
Release notes
License: PHP License
- fixed Bug #3949: reset does not return true on success as the documentation states
- implement Request #3905: replace "." with "_" in tagnames when using func mode - 1.2.5 (stable, 2005-02-26)
- 1.2.4 (stable, 2005-01-18)
Release notes
License: PHP License
- fixed a bug in XML_Parser_Simple when trying to register more than the default handlers and a separate callback object (schst)
- 1.2.3 (stable, 2005-01-17)
Release notes
License: PHP License
- fixed a bug that occured when using 'func' mode and setHandlerObj() (schst)
- added default handlers for 'func' mode (schst) - 1.2.2 (stable, 2004-12-22)
Release notes
License: PHP License
- fixed small notice in XML_Parser::free(),
- fixed Bug #2939: bug in error routine leads to segmentation fault (raiseError does not free the internal resources anymore) - 1.2.1 (stable, 2004-10-04)
Release notes
License: PHP License
fixed bug #2442: Call to "xmltag_ELEMENT_" not correctly managed in function funcEndHandler
- 1.2.0 (stable, 2004-05-28)
Release notes
License: PHP License
- added setHandlerObj() which allows you to have the parser separate from the handler methods
- fixed bug with setMode()
- moved the init routines for the handlers in _initHandlers()
- added new examples
- fixed test files so they do not fail because of different resource ids
XML_Parser_Simple:
- added new class XML_Parser_Simple that provides a stack for the elements so the user only needs to implement one method to handle the tag and cdata. - 1.2.0beta3 (beta, 2004-05-25)
Release notes
License: PHP License
- added setHandlerObj() which allows you to have the parser separate from the handler methods
- 1.2.0beta2 (beta, 2004-05-24)
Release notes
License: PHP License
XML_Parser:
- fixed bug with setMode()
- moved the init routines for the handlers in _initHandlers()
XML_Parser_Simple:
- fixed bug with character data (did not get parsed)
- fixed bug with setMode()
- some refactoring
- added getCurrentDepth() to retrieve the tag depth
- added addToData()
- added new example - 1.2.0beta1 (beta, 2004-05-17)
Release notes
License: PHP License
added new class XML_Parser_Simple that provides a stack for the elements so the user only needs to implement one method to handle the tag and cdata.
- 1.1.0 (stable, 2004-04-23)
Release notes
License: PHP License
- Fixed memory leaks parsing many documents or big files (mroch)
- Fixed setInput() url detection regex (mroch)
- Added setInputString() method, allowing strings to be passed as input (schst)
- Error handling rewritten (cox)
- Increased the overall parsing speed (cox)
- Added free() method (schst
- Added reset() method, that is called when parsing a document so it is possible to parse more than one document per instance (schst)
- Added error codes (schst)
- revamped documentation (cox, schst)
- Fixed bug #516 (url fopen and safe mode) (schst)
- Fixed bug #637 (dependency on PEAR) (schst)
- improved parse() and parseString() to be able to parse more than one document (schst)
- added PHP5 constructor (schst)
- moved xml_parser_create() to _create() for PHP5 compatibility (schst)
- added dependency on PHP 4.2Thanks to Marshall Roch for commments and contributions and Tomas V.V. Cox
for applying a lot of fixes and improvements. - 1.1.0beta2 (beta, 2004-04-17)
Release notes
License: PHP License
beta2:
- Fixed calling of __constructbeta1:
- Fixed memory leaks parsing many documents or big files (mroch)
- Fixed setInput() url detection regex (mroch)
- Added setInputString() method, allowing strings to be passed as input (schst)
- Error handling rewritten (cox)
- Increased the overall parsing speed (cox)
- Added free() method (schst
- Added reset() method, that is called when parsing a document so it is possible to parse more than one document per instance (schst)
- Added error codes (schst)
- revamped documentation (cox, schst)
- Fixed bug #516 (url fopen and safe mode) (schst)
- Fixed bug #637 (dependency on PEAR) (schst)
- improved parse() and parseString() to be able to parse more than one document (schst)
- added PHP5 constructor (schst)
- moved xml_parser_create() to _create() for PHP5 compatibility (schst)
- added dependency on PHP 4.2Thanks to Marshall Roch for commments and contributions and Tomas V.V. Cox
for applying a lot of fixes and improvements. - 1.1.0beta1 (beta, 2004-04-17)
Release notes
License: PHP License
- Fixed memory leaks parsing many documents or big files (mroch)
- Fixed setInput() url detection regex (mroch)
- Added setInputString() method, allowing strings to be passed as input (schst)
- Error handling rewritten (cox)
- Increased the overall parsing speed (cox)
- Added free() method (schst
- Added reset() method, that is called when parsing a document so it is possible to parse more than one document per instance (schst)
- Added error codes (schst)
- revamped documentation (cox, schst)
- Fixed bug #516 (url fopen and safe mode) (schst)
- Fixed bug #637 (dependency on PEAR) (schst)
- improved parse() and parseString() to be able to parse more than one document (schst)
- added PHP5 constructor (schst)
- moved xml_parser_create() to _create() for PHP5 compatibility (schst)
- added dependency on PHP 4.2Thanks to Marshall Roch for commments and contributions and Tomas V.V. Cox
for applying a lot of fixes and improvements. - 1.0.1 (stable, 2003-02-24)
- 1.0 (stable, 2002-05-09)
Bugs
| ID | Status | Type | Version | Date | Summary |
|---|---|---|---|---|---|
| #201 | Closed | Bug | 2003-11-05 | Class should allow setting of a string instead of a file for input | |
| #516 | Closed | Bug | 2004-01-04 | XML_Parser should set allow_url_fopen to "On" before parsing remote XML files | |
| #588 | Bogus | Bug | 2004-01-15 | XML_Parser incorrectly returns an error when parsing long strings | |
| #637 | Closed | Bug | 2004-01-28 | Dependencies are incorrect in package.xml | |
| #1078 | Bogus | Bug | 2004-03-26 | $php_errormsg usage | |
| #2069 | Bogus | Bug | 2004-08-05 | raiseError() calls without parameters | |
| #2442 | Closed | Bug | 2004-10-04 | Call to "xmltag_ELEMENT_" not correctly managed in function funcEndHandler | |
| #2451 | Wont fix | Req | 2004-10-04 | Socket timeout | |
| #2458 | Closed | Req | 2004-10-05 | Put allow_url_fopen back in original state when opening from URL | |
| #2661 | Bogus | Bug | 2004-11-01 | magic_quotes_runtime | |
| #2712 | Closed | Bug | 2004-11-07 | $oldVal undefined in XML_Parser::setInputFile() | |
| #2939 | Closed | Bug | 2004-12-09 | bug in error routine leads to segmentation fault | |
| #3066 | Bogus | Req | 2004-12-30 | $folding option not working | |
| #3277 | Closed | Bug | 2005-01-24 | allow_url_fopen-Trouble in setInputFile | |
| #3555 | Bogus | Bug | 2005-02-22 | References to $this are given to the outside world during construction | |
| #3557 | Closed | Bug | 2005-02-22 | Using func mode generates warnings when using "function xmltag_()" | |
| #3905 | Closed | Req | 2005-03-21 | can't parse "." tagnames using func mode | |
| #3949 | Closed | Bug | 2005-03-24 | Simple::reset() does not return true on success | |
| #4149 | No Feedback | Bug | 2005-04-14 | parse throws errors, but documentation says returns error | |
| #4774 | Closed | Req | 2005-07-09 | XML_Parser shoud report source column number on errors | |
| #5557 | Closed | Req | 2005-09-29 | XML_Parser: Unable to create XML parser resource. | |
| #5979 | Wont fix | Bug | 2005-11-16 | cdataHandler function called twice inside same tag | |
| #6078 | Closed | Bug | 2005-11-26 | func-mode does not handle all allowed letters in tags | |
| #7852 | Bogus | Bug | 1.2.7 | 2006-06-09 | Memory leak from xml_parse() |
| #9328 | Closed | Bug | 2006-11-13 | assigned by reference error in XML_RSS parse | |
| #12342 | Bogus | Bug | 1.2.8 | 2007-10-25 | inserts a newline before first umlaut with Pear XML-Parser |
| #12775 | Wont fix | Req | 1.2.8 | 2007-12-26 | New feature in XML Parser |
| #12778 | Wont fix | Req | 1.2.8 | 2007-12-27 | Can't get line/column of input |
| #13120 | Closed | Doc | 1.2.8 | 2008-02-15 | Mistake in example code |
| #13548 | Closed | Bug | 2008-03-31 | Which license version? | |
| #16467 | Closed | Bug | CVS | 2009-07-24 | Unit tests are broken |
| #17725 | Closed | Bug | SVN | 2010-08-17 | Patch Avoid deprecated eregi functions |
| #18385 | Wont fix | Bug | 1.3.4 | 2011-03-22 | Fix deprecated warning (patch) |
| #19034 | Closed | Bug | SVN | 2011-11-14 | test fails when executed from package dir (for PEAR QA team) |
| #19035 | Closed | Bug | SVN | 2011-11-14 | remove error_reporting (for PEAR QA team) |
| #19173 | Closed | Bug | SVN | 2011-12-30 | upgrade PHPUnit require statements & other fixes (for PEAR QA Team) |
| #19261 | Bogus | Bug | 1.3.4 | 2012-01-30 | Wrong package.xml |
| #19363 | Wont fix | Bug | 1.3.4 | 2012-04-01 | PHP 5.4 incompatibility |
| #20942 | Closed | Bug | 1.3.5 | 2015-08-21 | Broken PEAR installation |
| #21045 | Open | Req | 1.3.6 | 2016-03-23 | Fix deprecated syntax |