Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gromnan/welldom
XML toolbox for PHP
https://github.com/gromnan/welldom
xml xml-document xpath
Last synced: 4 months ago
JSON representation
XML toolbox for PHP
- Host: GitHub
- URL: https://github.com/gromnan/welldom
- Owner: GromNaN
- License: mit
- Created: 2012-03-07T12:38:46.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2020-02-20T08:45:08.000Z (almost 5 years ago)
- Last Synced: 2024-10-03T12:29:16.747Z (4 months ago)
- Topics: xml, xml-document, xpath
- Language: PHP
- Homepage:
- Size: 53.7 KB
- Stars: 10
- Watchers: 8
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Welldom, the XML toolbox for PHP [![Build Status](https://secure.travis-ci.org/LExpress/Welldom.png)](http://travis-ci.org/LExpress/Welldom)
================================*Welldom* try to ease the use of DOM to manipulate XML documents with the following features :
* Error management
* Unique encoding for XML input/output
* Simple methods to query and manipulate the DOM with Xpath
* Batch on node list
* Node rename & remove methodsRequirements
------------
* PHP 5.3+
* PHPUnit 5.6+Installation
------------
The library follow the PSR-0 naming convention. To load the library,
use any compliant class loader or simply require the `src/autoload.php` file.``` php
require __DIR__ . '/path/to/expdom/src/autoload.php';
```Usage
-----
Load an XML document:``` php
load('data.xml')) {
$errors = $doc->getLastErrors();
throw new Exception("XML Loading error\n" . implode("\n", $errors));
}// ... enjoy your DOM document
```Find a node values using XPath:
``` php
$values = array(
'title' => $doc->getNodeValue('//book/title'),
'lang' => $doc->getNodeValue('//book/title/@lang', 'en'),
);
```Execute action on each node matching a given Xpath:
``` php
$doc->query('//foo/bar[@lang=de]')
->remove();$doc->query('//foo/bar[@lang=english]/@lang')
->setValue('en');
```Run tests
---------
Run PHPUnit test suite:phpunit
License
-------
For the full copyright and license information, please view the LICENSE file that was distributed with this source code.Contributors:
* [Jérôme Macias](/jeromemacias)
* [Jérôme Tamarelle](/GromNaN)