|
|
%!s(int64=5) %!d(string=hai) anos | |
|---|---|---|
| .. | ||
| src | %!s(int64=5) %!d(string=hai) anos | |
| tests | %!s(int64=5) %!d(string=hai) anos | |
| .gitignore | %!s(int64=5) %!d(string=hai) anos | |
| .travis.yml | %!s(int64=5) %!d(string=hai) anos | |
| LICENSE | %!s(int64=5) %!d(string=hai) anos | |
| README.md | %!s(int64=5) %!d(string=hai) anos | |
| build.xml | %!s(int64=5) %!d(string=hai) anos | |
| composer.json | %!s(int64=5) %!d(string=hai) anos | |
| fDOMDocument.spec | %!s(int64=5) %!d(string=hai) anos | |
| phpcs.xml | %!s(int64=5) %!d(string=hai) anos | |
| phpunit.xml.dist | %!s(int64=5) %!d(string=hai) anos | |
The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.
PHP: 5.3.3 (5.3.0-5.3.2 had serious issues with spl stacked autoloaders)
Extensions: dom, libxml
Apart from cloning this repository, fDOMDocument can be installed using by any of the following methods.
As fDOMDocument is a library and does not provide any cli tools, you can only add it to your own project:
{
"require": {
"theseer/fdomdocument": "^1.6"
}
}
The following command will install fDOMDocument via its RPM package:
sudo yum install php-theseer-fDOMDocument
fDOMDocument is designed as a drop in replacement for DOMDocument. You can either use the composer generated autoloader or the provided one.
<?php
require '/path/to/autoload.php';
$dom = new TheSeer\fDOM\fDOMDocument();
try {
$dom->loadXML('<?xml version="1.0" ?><root><child name="foo" /></root>');
} catch (fDOMException $e) {
die($e);
}
$child = $dom->queryOne('//child');
print_r($child->getAttribute('name'));
print_r($child->getAttribute('missing','DefaultValue'));
?>
createElement* to fDOMEmenet and fDOMDocumentFragment as shortcutsappendElement* to fDOMDocumentFragment as shortcutsAdded select to fDOMDocument,fDOMElement and fDOMNode to support
CSS Selectors in favor of XPath only to find nodes
Added query and queryOne forwardes to fDOMNode
saveXML and saveHTML to fDOMNode and fDOMElement as a
shortcut to calling those methods on the ownerDocument__toString support to fDOMNode, fDOMElement, fDOMDocument and fDOMDocumentFragmentfDOMNodeInterface from code base__clone method to reset domxpath object when domdocument gets cloned (Thanks to Markus Ineichen for pointing it out)