File: README.md

package info (click to toggle)
php-fdomdocument 1.6.6-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 440 kB
  • sloc: php: 1,370; xml: 118; makefile: 6
file content (161 lines) | stat: -rw-r--r-- 5,520 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
fDOMDocument
============

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.

[![Build Status](https://travis-ci.org/theseer/fDOMDocument.png)](https://travis-ci.org/theseer/fDOMDocument)

Requirements
------------

    PHP: 5.3.3 (5.3.0-5.3.2 had serious issues with spl stacked autoloaders)
    Extensions: dom, libxml


Installation
------------
Apart from cloning this repository, fDOMDocument can be installed using by any of the following methods.

##### Composer
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"
        }
    }


##### YUM/DNF (Fedora / Redhat / CentOS)
The following command will install fDOMDocument via its RPM package:

    sudo yum install php-theseer-fDOMDocument


Usage
-----

fDOMDocument is designed as a drop in replacement for DOMDocument. You can either use the composer generated
autoloader or the provided one.

Usage Samples
-------------
    <?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'));

    ?>

Changelog
---------
##### Release 1.6.6
* Merge PRs 33+34: Add support for parameter "asTextNode" to fDOMElement::appendElement(). 
  fDOMElement::appendElementNS() and fDOMElement::appendElementPrefix

##### Releaes 1.6.5
* Revert git exports limitations as they cause unwanted side effects

##### Releaes 1.6.4
* Merge PR 31 to optimize travis builds and git exports (Thanks to @willemstuursma)

##### Releaes 1.6.3
* Merge PR 29 to fix issues with PHP 7.2

##### Release 1.6.2
* Handle empty string warings from PHP

##### Release 1.6.1
* Added Workaround for [HHVM Issue #5412](https://github.com/facebook/hhvm/issues/5412)

##### Release 1.6.0
* Added ```createElement*``` to ```fDOMEmenet``` and ```fDOMDocumentFragment``` as shortcuts
* Added ```appendElement*``` to ```fDOMDocumentFragment``` as shortcuts
* Enhanced the exception messages of save errors with filenames to contain the filename
* Fixed fDomDocumentFragment::__toString to actually work
* Updated / Added some tests

##### Release 1.5.0
* Added ```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```

##### Release 1.4.3
* Added ```saveXML``` and ```saveHTML``` to ```fDOMNode``` and ```fDOMElement``` as a
  shortcut to calling those methods on the ownerDocument

##### Release 1.4.2
* Added ```__toString``` support to ```fDOMNode```, ```fDOMElement```, ```fDOMDocument``` and ```fDOMDocumentFragment```

##### Release 1.4.1
* Removed unused Interface ```fDOMNodeInterface``` from code base

##### Release 1.4.0
* Added XPathQuery helper object, allowing for a prepared statement alike API around XPath

##### Release 1.3.2
* Added ```__clone``` method to reset domxpath object when domdocument gets cloned (Thanks to Markus Ineichen for pointing it out)

##### Release 1.3.1
* PHP 5.3 compatibility: changed interal behavior for incompatible changes from PHP 5.3 to 5.4 (Thanks to Jens Graefe for pointing it out)

##### Release 1.3.0
* Added appendTextNode method (Thanks to Markus Ineichen)
* Added appendElement / appendElementNS to DOMDocument to support documentElement "creation" (Thanks to Markus Ineichen)
* Overwrite createElement / createElementNS to throw exception on error
* Removed fDOMFilter code: Unmaintained and broken in its current form
* Added (static) Flag for fDOMException to globally enable full exception message
* Added Unit tests

##### Release 1.2.4
* PHP 5.4 compatibilty: added support for optional options bitmask on additional methods

##### Release 1.2.3
* Cleanup code style to adhere coding standard
* Added entity support for Attributes
* Added phpcs file to make coding standard public

##### Release 1.2.2
* Fix Exception to not overwrite final methods of \Exception

##### Release 1.2.1
* Changed fDOMDocument to be no longer final, use lsb to lookup actual class in constructor.
  This should fix test/mock issues.

##### Release 1.2.0
* Changed fException to be more compatible with standard exceptions by adding a switch to get full info by getMessage()
* Merged setAttributes() and setAttributesNS() methods from Andreas
* Fixed internal registerNamespace variable mixup

##### Release 1.1.0
* Renamed files to mimic classname cases
* Fixed inSameDocument to support DOMDocument as well as DOMNodes
* Added fDOMXPath class providing queryOne(), qoute() and prepare()
* Adjusted forwarders in fDOMDocument to make use of new object
* Fixed various return values to statically return true for compatibility with original API
* Applied Workaround to fix potential problems with lost references to instances of fDOMDocument
* Support registerPHPFunctions
* Bump Copyright
* Added missing docblocks

##### Release 1.0.2
* Indenting and typo fixes, minor bugfixes

##### Release 1.0.1
* Bugfix: typehints corrected

##### Release 1.0.0
* Initial release