library xml
Simple and safe parsing of XML and HTML sources.
lightools/xml
Simple and safe parsing of XML and HTML sources.
- Sunday, February 5, 2017
- by janedbal
- Repository
- 1 Watchers
- 3 Stars
- 11,298 Installations
- PHP
- 7 Dependents
- 1 Suggesters
- 1 Forks
- 0 Open issues
- 6 Versions
- 19 % Grown
Introduction
This library provides simple interface for loading XML or HTML strings to DomDocument object.
It prevents some known vulnerabilities and allows you to handle LibXML errors simply by catching XmlException as you can see below., (*1)
Installation
$ composer require lightools/xml
Simple usage
Both loading methods (loadXml and loadHtml) return DomDocument.
If you prefer working with SimpleXmlElement, you can use simplexml_import_dom function., (*2)
$xml = '<root>text</root>';
$html = '<!doctype html><title>Foo</title>';
$loader = new Lightools\Xml\XmlLoader();
try {
$xmlDomDocument = $loader->loadXml($xml);
$htmlDomDocument = $loader->loadHtml($html);
} catch (Lightools\Xml\XmlException $e) {
// process exception
}
How to run checks
$ composer check
Versions
- v1.x is for PHP 5.4 and higher
- v2.x is for PHP 7.1 and higher
- v3.x is for PHP 8.0 and higher
dev-master
9999999-dev
Simple and safe parsing of XML and HTML sources.
Sources
Download
MIT
The Requires
The Development Requires
v2.0.0
2.0.0.0
Simple and safe parsing of XML and HTML sources.
Sources
Download
MIT
The Requires
The Development Requires
v1.0.x-dev
1.0.9999999.9999999-dev
Simple and safe parsing of XML and HTML sources.
Sources
Download
MIT
The Requires
The Development Requires
v1.0.2
1.0.2.0
Simple and safe parsing of XML and HTML sources.
Sources
Download
MIT
The Requires
The Development Requires
v1.0.1
1.0.1.0
Simple and safe parsing of XML and HTML sources.
Sources
Download
MIT
The Requires
The Development Requires
v1.0.0
1.0.0.0
Simple and safe parsing of XML and HTML sources.
Sources
Download
MIT
The Requires
The Development Requires