| 1 |
[//]: # (AUTO-GENERATED BY "PHP README Helper": base file -> docs/api.md) |
| 2 |
# :scroll: Simple Html Dom Parser for PHP |
| 3 |
|
| 4 |
### DomParser API |
| 5 |
|
| 6 |
<p id="voku-php-readme-class-methods"></p><table><tr><td><a href="#findstring-selector-intnull-idx-mixed">find</a> |
| 7 |
</td><td><a href="#findmultistring-selector-mixed">findMulti</a> |
| 8 |
</td><td><a href="#findmultiorfalsestring-selector-mixed">findMultiOrFalse</a> |
| 9 |
</td><td><a href="#findonestring-selector-static">findOne</a> |
| 10 |
</td></tr><tr><td><a href="#findoneorfalsestring-selector-mixed">findOneOrFalse</a> |
| 11 |
</td><td><a href="#fixhtmloutputstring-content-bool-multidecodenewhtmlentity-string">fixHtmlOutput</a> |
| 12 |
</td><td><a href="#getdocument-domdocument">getDocument</a> |
| 13 |
</td><td><a href="#getelementbyclassstring-class-mixed">getElementByClass</a> |
| 14 |
</td></tr><tr><td><a href="#getelementbyidstring-id-mixed">getElementById</a> |
| 15 |
</td><td><a href="#getelementbytagnamestring-name-mixed">getElementByTagName</a> |
| 16 |
</td><td><a href="#getelementsbyidstring-id-intnull-idx-mixed">getElementsById</a> |
| 17 |
</td><td><a href="#getelementsbytagnamestring-name-intnull-idx-mixed">getElementsByTagName</a> |
| 18 |
</td></tr><tr><td><a href="#htmlbool-multidecodenewhtmlentity-string">html</a> |
| 19 |
</td><td><a href="#innerhtmlbool-multidecodenewhtmlentity-string">innerHtml</a> |
| 20 |
</td><td><a href="#innerxmlbool-multidecodenewhtmlentity-string">innerXml</a> |
| 21 |
</td><td><a href="#loadhtmlstring-html-intnull-libxmlextraoptions-domparserinterface">loadHtml</a> |
| 22 |
</td></tr><tr><td><a href="#loadhtmlfilestring-filepath-intnull-libxmlextraoptions-domparserinterface">loadHtmlFile</a> |
| 23 |
</td><td><a href="#savestring-filepath-string">save</a> |
| 24 |
</td><td><a href="#set_callbackcallable-functionname-mixed">set_callback</a> |
| 25 |
</td><td><a href="#textbool-multidecodenewhtmlentity-string">text</a> |
| 26 |
</td></tr><tr><td><a href="#xmlbool-multidecodenewhtmlentity-bool-htmltoxml-bool-removexmlheader-int-options-string">xml</a> |
| 27 |
</td></tr></table> |
| 28 |
|
| 29 |
### SimpleHtmlDomNode (group of dom elements) API |
| 30 |
|
| 31 |
<p id="voku-php-readme-class-methods"></p><table><tr><td><a href="#count-int">count</a> |
| 32 |
</td><td><a href="#findstring-selector-int-idx-simplehtmldomnodesimplehtmldomnodenull">find</a> |
| 33 |
</td><td><a href="#findmultistring-selector-simplehtmldominterfacesimplehtmldomnodeinterfacesimplehtmldominterface">findMulti</a> |
| 34 |
</td><td><a href="#findmultiorfalsestring-selector-falsesimplehtmldominterfacesimplehtmldomnodeinterfacesimplehtmldominterface">findMultiOrFalse</a> |
| 35 |
</td></tr><tr><td><a href="#findonestring-selector-simplehtmldomnodenull">findOne</a> |
| 36 |
</td><td><a href="#findoneorfalsestring-selector-falsesimplehtmldomnode">findOneOrFalse</a> |
| 37 |
</td><td><a href="#innerhtml-string">innerHtml</a> |
| 38 |
</td><td><a href="#innertext-string">innertext</a> |
| 39 |
</td></tr><tr><td><a href="#outertext-string">outertext</a> |
| 40 |
</td><td><a href="#text-string">text</a> |
| 41 |
</td></tr></table> |
| 42 |
|
| 43 |
### SimpleHtmlDom (single dom element) API |
| 44 |
|
| 45 |
<p id="voku-php-readme-class-methods"></p><table><tr><td><a href="#childnodesint-idx-simplehtmldominterfacesimplehtmldominterfacesimplehtmldomnodeinterfacenull">childNodes</a> |
| 46 |
</td><td><a href="#delete-mixed">delete</a> |
| 47 |
</td><td><a href="#findstring-selector-intnull-idx-simplehtmldominterfacesimplehtmldominterfacesimplehtmldomnodeinterfacesimplehtmldominterface">find</a> |
| 48 |
</td><td><a href="#findmultistring-selector-simplehtmldominterfacesimplehtmldomnodeinterfacesimplehtmldominterface">findMulti</a> |
| 49 |
</td></tr><tr><td><a href="#findmultiorfalsestring-selector-falsesimplehtmldominterfacesimplehtmldomnodeinterfacesimplehtmldominterface">findMultiOrFalse</a> |
| 50 |
</td><td><a href="#findonestring-selector-simplehtmldominterface">findOne</a> |
| 51 |
</td><td><a href="#findoneorfalsestring-selector-falsesimplehtmldominterface">findOneOrFalse</a> |
| 52 |
</td><td><a href="#firstchild-simplehtmldominterfacenull">firstChild</a> |
| 53 |
</td></tr><tr><td><a href="#getallattributes-stringnull">getAllAttributes</a> |
| 54 |
</td><td><a href="#getattributestring-name-string">getAttribute</a> |
| 55 |
</td><td><a href="#getelementbyclassstring-class-simplehtmldominterfacesimplehtmldomnodeinterfacesimplehtmldominterface">getElementByClass</a> |
| 56 |
</td><td><a href="#getelementbyidstring-id-simplehtmldominterface">getElementById</a> |
| 57 |
</td></tr><tr><td><a href="#getelementbytagnamestring-name-simplehtmldominterface">getElementByTagName</a> |
| 58 |
</td><td><a href="#getelementsbyidstring-id-intnull-idx-simplehtmldominterfacesimplehtmldominterfacesimplehtmldomnodeinterfacesimplehtmldominterface">getElementsById</a> |
| 59 |
</td><td><a href="#getelementsbytagnamestring-name-intnull-idx-simplehtmldominterfacesimplehtmldominterfacesimplehtmldomnodeinterfacesimplehtmldominterface">getElementsByTagName</a> |
| 60 |
</td><td><a href="#gethtmldomparser-htmldomparser">getHtmlDomParser</a> |
| 61 |
</td></tr><tr><td><a href="#getiterator-simplehtmldomnodeinterfacesimplehtmldominterface">getIterator</a> |
| 62 |
</td><td><a href="#getnode-domnode">getNode</a> |
| 63 |
</td><td><a href="#gettag-string">getTag</a> |
| 64 |
</td><td><a href="#hasattributestring-name-bool">hasAttribute</a> |
| 65 |
</td></tr><tr><td><a href="#htmlbool-multidecodenewhtmlentity-string">html</a> |
| 66 |
</td><td><a href="#innerhtmlbool-multidecodenewhtmlentity-string">innerHtml</a> |
| 67 |
</td><td><a href="#innerxmlbool-multidecodenewhtmlentity-string">innerXml</a> |
| 68 |
</td><td><a href="#isremoved-bool">isRemoved</a> |
| 69 |
</td></tr><tr><td><a href="#lastchild-simplehtmldominterfacenull">lastChild</a> |
| 70 |
</td><td><a href="#nextnonwhitespacesibling-simplehtmldominterfacenull">nextNonWhitespaceSibling</a> |
| 71 |
</td><td><a href="#nextsibling-simplehtmldominterfacenull">nextSibling</a> |
| 72 |
</td><td><a href="#parentnode-simplehtmldominterface">parentNode</a> |
| 73 |
</td></tr><tr><td><a href="#previousnonwhitespacesibling-simplehtmldominterfacenull">previousNonWhitespaceSibling</a> |
| 74 |
</td><td><a href="#previoussibling-simplehtmldominterfacenull">previousSibling</a> |
| 75 |
</td><td><a href="#removeattributestring-name-simplehtmldominterface">removeAttribute</a> |
| 76 |
</td><td><a href="#removeattributes-simplehtmldominterface">removeAttributes</a> |
| 77 |
</td></tr><tr><td><a href="#setattributestring-name-stringnull-value-bool-strictemptyvaluecheck-simplehtmldominterface">setAttribute</a> |
| 78 |
</td><td><a href="#text-string">text</a> |
| 79 |
</td><td><a href="#valstringstringnull-value-stringstringnull">val</a> |
| 80 |
</td></tr></table> |
| 81 |
|
| 82 |
--- |
| 83 |
|
| 84 |
## find(string $selector, int|null $idx): mixed |
| 85 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 86 |
Find list of nodes with a CSS selector. |
| 87 |
|
| 88 |
**Parameters:** |
| 89 |
- `string $selector` |
| 90 |
- `int|null $idx` |
| 91 |
|
| 92 |
**Return:** |
| 93 |
- `mixed` |
| 94 |
|
| 95 |
-------- |
| 96 |
|
| 97 |
## findMulti(string $selector): mixed |
| 98 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 99 |
Find nodes with a CSS selector. |
| 100 |
|
| 101 |
**Parameters:** |
| 102 |
- `string $selector` |
| 103 |
|
| 104 |
**Return:** |
| 105 |
- `mixed` |
| 106 |
|
| 107 |
-------- |
| 108 |
|
| 109 |
## findMultiOrFalse(string $selector): mixed |
| 110 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 111 |
Find nodes with a CSS selector or false, if no element is found. |
| 112 |
|
| 113 |
**Parameters:** |
| 114 |
- `string $selector` |
| 115 |
|
| 116 |
**Return:** |
| 117 |
- `mixed` |
| 118 |
|
| 119 |
-------- |
| 120 |
|
| 121 |
## findOne(string $selector): static |
| 122 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 123 |
Find one node with a CSS selector. |
| 124 |
|
| 125 |
**Parameters:** |
| 126 |
- `string $selector` |
| 127 |
|
| 128 |
**Return:** |
| 129 |
- `static` |
| 130 |
|
| 131 |
-------- |
| 132 |
|
| 133 |
## findOneOrFalse(string $selector): mixed |
| 134 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 135 |
Find one node with a CSS selector or false, if no element is found. |
| 136 |
|
| 137 |
**Parameters:** |
| 138 |
- `string $selector` |
| 139 |
|
| 140 |
**Return:** |
| 141 |
- `mixed` |
| 142 |
|
| 143 |
-------- |
| 144 |
|
| 145 |
## fixHtmlOutput(string $content, bool $multiDecodeNewHtmlEntity): string |
| 146 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 147 |
|
| 148 |
|
| 149 |
**Parameters:** |
| 150 |
- `string $content` |
| 151 |
- `bool $multiDecodeNewHtmlEntity` |
| 152 |
|
| 153 |
**Return:** |
| 154 |
- `string` |
| 155 |
|
| 156 |
-------- |
| 157 |
|
| 158 |
## getDocument(): DOMDocument |
| 159 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 160 |
|
| 161 |
|
| 162 |
**Parameters:** |
| 163 |
__nothing__ |
| 164 |
|
| 165 |
**Return:** |
| 166 |
- `\DOMDocument` |
| 167 |
|
| 168 |
-------- |
| 169 |
|
| 170 |
## getElementByClass(string $class): mixed |
| 171 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 172 |
Return elements by ".class". |
| 173 |
|
| 174 |
**Parameters:** |
| 175 |
- `string $class` |
| 176 |
|
| 177 |
**Return:** |
| 178 |
- `mixed` |
| 179 |
|
| 180 |
-------- |
| 181 |
|
| 182 |
## getElementById(string $id): mixed |
| 183 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 184 |
Return element by #id. |
| 185 |
|
| 186 |
**Parameters:** |
| 187 |
- `string $id` |
| 188 |
|
| 189 |
**Return:** |
| 190 |
- `mixed` |
| 191 |
|
| 192 |
-------- |
| 193 |
|
| 194 |
## getElementByTagName(string $name): mixed |
| 195 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 196 |
Return element by tag name. |
| 197 |
|
| 198 |
**Parameters:** |
| 199 |
- `string $name` |
| 200 |
|
| 201 |
**Return:** |
| 202 |
- `mixed` |
| 203 |
|
| 204 |
-------- |
| 205 |
|
| 206 |
## getElementsById(string $id, int|null $idx): mixed |
| 207 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 208 |
Returns elements by "#id". |
| 209 |
|
| 210 |
**Parameters:** |
| 211 |
- `string $id` |
| 212 |
- `int|null $idx` |
| 213 |
|
| 214 |
**Return:** |
| 215 |
- `mixed` |
| 216 |
|
| 217 |
-------- |
| 218 |
|
| 219 |
## getElementsByTagName(string $name, int|null $idx): mixed |
| 220 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 221 |
Returns elements by tag name. |
| 222 |
|
| 223 |
**Parameters:** |
| 224 |
- `string $name` |
| 225 |
- `int|null $idx` |
| 226 |
|
| 227 |
**Return:** |
| 228 |
- `mixed` |
| 229 |
|
| 230 |
-------- |
| 231 |
|
| 232 |
## html(bool $multiDecodeNewHtmlEntity): string |
| 233 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 234 |
Get dom node's outer html. |
| 235 |
|
| 236 |
**Parameters:** |
| 237 |
- `bool $multiDecodeNewHtmlEntity` |
| 238 |
|
| 239 |
**Return:** |
| 240 |
- `string` |
| 241 |
|
| 242 |
-------- |
| 243 |
|
| 244 |
## innerHtml(bool $multiDecodeNewHtmlEntity): string |
| 245 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 246 |
Get dom node's inner html. |
| 247 |
|
| 248 |
**Parameters:** |
| 249 |
- `bool $multiDecodeNewHtmlEntity` |
| 250 |
|
| 251 |
**Return:** |
| 252 |
- `string` |
| 253 |
|
| 254 |
-------- |
| 255 |
|
| 256 |
## innerXml(bool $multiDecodeNewHtmlEntity): string |
| 257 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 258 |
Get dom node's inner xml. |
| 259 |
|
| 260 |
**Parameters:** |
| 261 |
- `bool $multiDecodeNewHtmlEntity` |
| 262 |
|
| 263 |
**Return:** |
| 264 |
- `string` |
| 265 |
|
| 266 |
-------- |
| 267 |
|
| 268 |
## loadHtml(string $html, int|null $libXMLExtraOptions): DomParserInterface |
| 269 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 270 |
Load HTML from string. |
| 271 |
|
| 272 |
**Parameters:** |
| 273 |
- `string $html` |
| 274 |
- `int|null $libXMLExtraOptions` |
| 275 |
|
| 276 |
**Return:** |
| 277 |
- `\DomParserInterface` |
| 278 |
|
| 279 |
-------- |
| 280 |
|
| 281 |
## loadHtmlFile(string $filePath, int|null $libXMLExtraOptions): DomParserInterface |
| 282 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 283 |
Load HTML from file. |
| 284 |
|
| 285 |
**Parameters:** |
| 286 |
- `string $filePath` |
| 287 |
- `int|null $libXMLExtraOptions` |
| 288 |
|
| 289 |
**Return:** |
| 290 |
- `\DomParserInterface` |
| 291 |
|
| 292 |
-------- |
| 293 |
|
| 294 |
## save(string $filepath): string |
| 295 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 296 |
Save the html-dom as string. |
| 297 |
|
| 298 |
**Parameters:** |
| 299 |
- `string $filepath` |
| 300 |
|
| 301 |
**Return:** |
| 302 |
- `string` |
| 303 |
|
| 304 |
-------- |
| 305 |
|
| 306 |
## set_callback(callable $functionName): mixed |
| 307 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 308 |
|
| 309 |
|
| 310 |
**Parameters:** |
| 311 |
- `callable $functionName` |
| 312 |
|
| 313 |
**Return:** |
| 314 |
- `mixed` |
| 315 |
|
| 316 |
-------- |
| 317 |
|
| 318 |
## text(bool $multiDecodeNewHtmlEntity): string |
| 319 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 320 |
Get dom node's plain text. |
| 321 |
|
| 322 |
**Parameters:** |
| 323 |
- `bool $multiDecodeNewHtmlEntity` |
| 324 |
|
| 325 |
**Return:** |
| 326 |
- `string` |
| 327 |
|
| 328 |
-------- |
| 329 |
|
| 330 |
## xml(bool $multiDecodeNewHtmlEntity, bool $htmlToXml, bool $removeXmlHeader, int $options): string |
| 331 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 332 |
Get the HTML as XML or plain XML if needed. |
| 333 |
|
| 334 |
**Parameters:** |
| 335 |
- `bool $multiDecodeNewHtmlEntity` |
| 336 |
- `bool $htmlToXml` |
| 337 |
- `bool $removeXmlHeader` |
| 338 |
- `int $options` |
| 339 |
|
| 340 |
**Return:** |
| 341 |
- `string` |
| 342 |
|
| 343 |
-------- |
| 344 |
|
| 345 |
|
| 346 |
## count(): int |
| 347 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 348 |
Get the number of items in this dom node. |
| 349 |
|
| 350 |
**Parameters:** |
| 351 |
__nothing__ |
| 352 |
|
| 353 |
**Return:** |
| 354 |
- `int` |
| 355 |
|
| 356 |
-------- |
| 357 |
|
| 358 |
## find(string $selector, int $idx): SimpleHtmlDomNode|\SimpleHtmlDomNode[]|null |
| 359 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 360 |
Find list of nodes with a CSS selector. |
| 361 |
|
| 362 |
**Parameters:** |
| 363 |
- `string $selector` |
| 364 |
- `int $idx` |
| 365 |
|
| 366 |
**Return:** |
| 367 |
- `\SimpleHtmlDomNode|\SimpleHtmlDomNode[]|null` |
| 368 |
|
| 369 |
-------- |
| 370 |
|
| 371 |
## findMulti(string $selector): SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface> |
| 372 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 373 |
Find nodes with a CSS selector. |
| 374 |
|
| 375 |
**Parameters:** |
| 376 |
- `string $selector` |
| 377 |
|
| 378 |
**Return:** |
| 379 |
- `\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>` |
| 380 |
|
| 381 |
-------- |
| 382 |
|
| 383 |
## findMultiOrFalse(string $selector): false|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface> |
| 384 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 385 |
Find nodes with a CSS selector or false, if no element is found. |
| 386 |
|
| 387 |
**Parameters:** |
| 388 |
- `string $selector` |
| 389 |
|
| 390 |
**Return:** |
| 391 |
- `false|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>` |
| 392 |
|
| 393 |
-------- |
| 394 |
|
| 395 |
## findOne(string $selector): SimpleHtmlDomNode|null |
| 396 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 397 |
Find one node with a CSS selector. |
| 398 |
|
| 399 |
**Parameters:** |
| 400 |
- `string $selector` |
| 401 |
|
| 402 |
**Return:** |
| 403 |
- `\SimpleHtmlDomNode|null` |
| 404 |
|
| 405 |
-------- |
| 406 |
|
| 407 |
## findOneOrFalse(string $selector): false|\SimpleHtmlDomNode |
| 408 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 409 |
Find one node with a CSS selector or false, if no element is found. |
| 410 |
|
| 411 |
**Parameters:** |
| 412 |
- `string $selector` |
| 413 |
|
| 414 |
**Return:** |
| 415 |
- `false|\SimpleHtmlDomNode` |
| 416 |
|
| 417 |
-------- |
| 418 |
|
| 419 |
## innerHtml(): string[] |
| 420 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 421 |
Get html of elements. |
| 422 |
|
| 423 |
**Parameters:** |
| 424 |
__nothing__ |
| 425 |
|
| 426 |
**Return:** |
| 427 |
- `string[]` |
| 428 |
|
| 429 |
-------- |
| 430 |
|
| 431 |
## innertext(): string[] |
| 432 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 433 |
alias for "$this->innerHtml()" (added for compatibly-reasons with v1.x) |
| 434 |
|
| 435 |
**Parameters:** |
| 436 |
__nothing__ |
| 437 |
|
| 438 |
**Return:** |
| 439 |
- `string[]` |
| 440 |
|
| 441 |
-------- |
| 442 |
|
| 443 |
## outertext(): string[] |
| 444 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 445 |
alias for "$this->innerHtml()" (added for compatibly-reasons with v1.x) |
| 446 |
|
| 447 |
**Parameters:** |
| 448 |
__nothing__ |
| 449 |
|
| 450 |
**Return:** |
| 451 |
- `string[]` |
| 452 |
|
| 453 |
-------- |
| 454 |
|
| 455 |
## text(): string[] |
| 456 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 457 |
Get plain text. |
| 458 |
|
| 459 |
**Parameters:** |
| 460 |
__nothing__ |
| 461 |
|
| 462 |
**Return:** |
| 463 |
- `string[]` |
| 464 |
|
| 465 |
-------- |
| 466 |
|
| 467 |
|
| 468 |
## childNodes(int $idx): SimpleHtmlDomInterface|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface|null |
| 469 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 470 |
Returns children of node. |
| 471 |
|
| 472 |
**Parameters:** |
| 473 |
- `int $idx` |
| 474 |
|
| 475 |
**Return:** |
| 476 |
- `\SimpleHtmlDomInterface|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface|null` |
| 477 |
|
| 478 |
-------- |
| 479 |
|
| 480 |
## delete(): mixed |
| 481 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 482 |
Delete |
| 483 |
|
| 484 |
**Parameters:** |
| 485 |
__nothing__ |
| 486 |
|
| 487 |
**Return:** |
| 488 |
- `mixed` |
| 489 |
|
| 490 |
-------- |
| 491 |
|
| 492 |
## find(string $selector, int|null $idx): SimpleHtmlDomInterface|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface> |
| 493 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 494 |
Find list of nodes with a CSS selector. |
| 495 |
|
| 496 |
**Parameters:** |
| 497 |
- `string $selector` |
| 498 |
- `int|null $idx` |
| 499 |
|
| 500 |
**Return:** |
| 501 |
- `\SimpleHtmlDomInterface|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>` |
| 502 |
|
| 503 |
-------- |
| 504 |
|
| 505 |
## findMulti(string $selector): SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface> |
| 506 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 507 |
Find nodes with a CSS selector. |
| 508 |
|
| 509 |
**Parameters:** |
| 510 |
- `string $selector` |
| 511 |
|
| 512 |
**Return:** |
| 513 |
- `\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>` |
| 514 |
|
| 515 |
-------- |
| 516 |
|
| 517 |
## findMultiOrFalse(string $selector): false|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface> |
| 518 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 519 |
Find nodes with a CSS selector or false, if no element is found. |
| 520 |
|
| 521 |
**Parameters:** |
| 522 |
- `string $selector` |
| 523 |
|
| 524 |
**Return:** |
| 525 |
- `false|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>` |
| 526 |
|
| 527 |
-------- |
| 528 |
|
| 529 |
## findOne(string $selector): SimpleHtmlDomInterface |
| 530 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 531 |
Find one node with a CSS selector. |
| 532 |
|
| 533 |
**Parameters:** |
| 534 |
- `string $selector` |
| 535 |
|
| 536 |
**Return:** |
| 537 |
- `\SimpleHtmlDomInterface` |
| 538 |
|
| 539 |
-------- |
| 540 |
|
| 541 |
## findOneOrFalse(string $selector): false|\SimpleHtmlDomInterface |
| 542 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 543 |
Find one node with a CSS selector or false, if no element is found. |
| 544 |
|
| 545 |
**Parameters:** |
| 546 |
- `string $selector` |
| 547 |
|
| 548 |
**Return:** |
| 549 |
- `false|\SimpleHtmlDomInterface` |
| 550 |
|
| 551 |
-------- |
| 552 |
|
| 553 |
## firstChild(): SimpleHtmlDomInterface|null |
| 554 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 555 |
Returns the first child of node. |
| 556 |
|
| 557 |
**Parameters:** |
| 558 |
__nothing__ |
| 559 |
|
| 560 |
**Return:** |
| 561 |
- `\SimpleHtmlDomInterface|null` |
| 562 |
|
| 563 |
-------- |
| 564 |
|
| 565 |
## getAllAttributes(): string[]|null |
| 566 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 567 |
Returns an array of attributes. |
| 568 |
|
| 569 |
**Parameters:** |
| 570 |
__nothing__ |
| 571 |
|
| 572 |
**Return:** |
| 573 |
- `string[]|null` |
| 574 |
|
| 575 |
-------- |
| 576 |
|
| 577 |
## getAttribute(string $name): string |
| 578 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 579 |
Return attribute value. |
| 580 |
|
| 581 |
**Parameters:** |
| 582 |
- `string $name` |
| 583 |
|
| 584 |
**Return:** |
| 585 |
- `string` |
| 586 |
|
| 587 |
-------- |
| 588 |
|
| 589 |
## getElementByClass(string $class): SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface> |
| 590 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 591 |
Return elements by ".class". |
| 592 |
|
| 593 |
**Parameters:** |
| 594 |
- `string $class` |
| 595 |
|
| 596 |
**Return:** |
| 597 |
- `\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>` |
| 598 |
|
| 599 |
-------- |
| 600 |
|
| 601 |
## getElementById(string $id): SimpleHtmlDomInterface |
| 602 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 603 |
Return element by "#id". |
| 604 |
|
| 605 |
**Parameters:** |
| 606 |
- `string $id` |
| 607 |
|
| 608 |
**Return:** |
| 609 |
- `\SimpleHtmlDomInterface` |
| 610 |
|
| 611 |
-------- |
| 612 |
|
| 613 |
## getElementByTagName(string $name): SimpleHtmlDomInterface |
| 614 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 615 |
Return element by tag name. |
| 616 |
|
| 617 |
**Parameters:** |
| 618 |
- `string $name` |
| 619 |
|
| 620 |
**Return:** |
| 621 |
- `\SimpleHtmlDomInterface` |
| 622 |
|
| 623 |
-------- |
| 624 |
|
| 625 |
## getElementsById(string $id, int|null $idx): SimpleHtmlDomInterface|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface> |
| 626 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 627 |
Returns elements by "#id". |
| 628 |
|
| 629 |
**Parameters:** |
| 630 |
- `string $id` |
| 631 |
- `int|null $idx` |
| 632 |
|
| 633 |
**Return:** |
| 634 |
- `\SimpleHtmlDomInterface|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>` |
| 635 |
|
| 636 |
-------- |
| 637 |
|
| 638 |
## getElementsByTagName(string $name, int|null $idx): SimpleHtmlDomInterface|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface> |
| 639 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 640 |
Returns elements by tag name. |
| 641 |
|
| 642 |
**Parameters:** |
| 643 |
- `string $name` |
| 644 |
- `int|null $idx` |
| 645 |
|
| 646 |
**Return:** |
| 647 |
- `\SimpleHtmlDomInterface|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>` |
| 648 |
|
| 649 |
-------- |
| 650 |
|
| 651 |
## getHtmlDomParser(): HtmlDomParser |
| 652 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 653 |
Create a new "HtmlDomParser"-object from the current context. |
| 654 |
|
| 655 |
**Parameters:** |
| 656 |
__nothing__ |
| 657 |
|
| 658 |
**Return:** |
| 659 |
- `\HtmlDomParser` |
| 660 |
|
| 661 |
-------- |
| 662 |
|
| 663 |
## getIterator(): SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface> |
| 664 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 665 |
Retrieve an external iterator. |
| 666 |
|
| 667 |
**Parameters:** |
| 668 |
__nothing__ |
| 669 |
|
| 670 |
**Return:** |
| 671 |
- `\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface> <p> |
| 672 |
An instance of an object implementing <b>Iterator</b> or |
| 673 |
<b>Traversable</b> |
| 674 |
</p>` |
| 675 |
|
| 676 |
-------- |
| 677 |
|
| 678 |
## getNode(): DOMNode |
| 679 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 680 |
|
| 681 |
|
| 682 |
**Parameters:** |
| 683 |
__nothing__ |
| 684 |
|
| 685 |
**Return:** |
| 686 |
- `\DOMNode` |
| 687 |
|
| 688 |
-------- |
| 689 |
|
| 690 |
## getTag(): string |
| 691 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 692 |
Return the tag of node |
| 693 |
|
| 694 |
**Parameters:** |
| 695 |
__nothing__ |
| 696 |
|
| 697 |
**Return:** |
| 698 |
- `string` |
| 699 |
|
| 700 |
-------- |
| 701 |
|
| 702 |
## hasAttribute(string $name): bool |
| 703 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 704 |
Determine if an attribute exists on the element. |
| 705 |
|
| 706 |
**Parameters:** |
| 707 |
- `string $name` |
| 708 |
|
| 709 |
**Return:** |
| 710 |
- `bool` |
| 711 |
|
| 712 |
-------- |
| 713 |
|
| 714 |
## html(bool $multiDecodeNewHtmlEntity): string |
| 715 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 716 |
Get dom node's outer html. |
| 717 |
|
| 718 |
**Parameters:** |
| 719 |
- `bool $multiDecodeNewHtmlEntity` |
| 720 |
|
| 721 |
**Return:** |
| 722 |
- `string` |
| 723 |
|
| 724 |
-------- |
| 725 |
|
| 726 |
## innerHtml(bool $multiDecodeNewHtmlEntity): string |
| 727 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 728 |
Get dom node's inner html. |
| 729 |
|
| 730 |
**Parameters:** |
| 731 |
- `bool $multiDecodeNewHtmlEntity` |
| 732 |
|
| 733 |
**Return:** |
| 734 |
- `string` |
| 735 |
|
| 736 |
-------- |
| 737 |
|
| 738 |
## innerXml(bool $multiDecodeNewHtmlEntity): string |
| 739 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 740 |
Get dom node's inner html. |
| 741 |
|
| 742 |
**Parameters:** |
| 743 |
- `bool $multiDecodeNewHtmlEntity` |
| 744 |
|
| 745 |
**Return:** |
| 746 |
- `string` |
| 747 |
|
| 748 |
-------- |
| 749 |
|
| 750 |
## isRemoved(): bool |
| 751 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 752 |
Nodes can get partially destroyed in which they're still an |
| 753 |
actual DOM node (such as \DOMElement) but almost their entire |
| 754 |
body is gone, including the `nodeType` attribute. |
| 755 |
|
| 756 |
**Parameters:** |
| 757 |
__nothing__ |
| 758 |
|
| 759 |
**Return:** |
| 760 |
- `bool true if node has been destroyed` |
| 761 |
|
| 762 |
-------- |
| 763 |
|
| 764 |
## lastChild(): SimpleHtmlDomInterface|null |
| 765 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 766 |
Returns the last child of node. |
| 767 |
|
| 768 |
**Parameters:** |
| 769 |
__nothing__ |
| 770 |
|
| 771 |
**Return:** |
| 772 |
- `\SimpleHtmlDomInterface|null` |
| 773 |
|
| 774 |
-------- |
| 775 |
|
| 776 |
## nextNonWhitespaceSibling(): SimpleHtmlDomInterface|null |
| 777 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 778 |
Returns the next sibling of node, and it will ignore whitespace elements. |
| 779 |
|
| 780 |
**Parameters:** |
| 781 |
__nothing__ |
| 782 |
|
| 783 |
**Return:** |
| 784 |
- `\SimpleHtmlDomInterface|null` |
| 785 |
|
| 786 |
-------- |
| 787 |
|
| 788 |
## nextSibling(): SimpleHtmlDomInterface|null |
| 789 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 790 |
Returns the next sibling of node. |
| 791 |
|
| 792 |
**Parameters:** |
| 793 |
__nothing__ |
| 794 |
|
| 795 |
**Return:** |
| 796 |
- `\SimpleHtmlDomInterface|null` |
| 797 |
|
| 798 |
-------- |
| 799 |
|
| 800 |
## parentNode(): SimpleHtmlDomInterface |
| 801 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 802 |
Returns the parent of node. |
| 803 |
|
| 804 |
**Parameters:** |
| 805 |
__nothing__ |
| 806 |
|
| 807 |
**Return:** |
| 808 |
- `\SimpleHtmlDomInterface` |
| 809 |
|
| 810 |
-------- |
| 811 |
|
| 812 |
## previousNonWhitespaceSibling(): SimpleHtmlDomInterface|null |
| 813 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 814 |
Returns the previous sibling of node, and it will ignore whitespace elements. |
| 815 |
|
| 816 |
**Parameters:** |
| 817 |
__nothing__ |
| 818 |
|
| 819 |
**Return:** |
| 820 |
- `\SimpleHtmlDomInterface|null` |
| 821 |
|
| 822 |
-------- |
| 823 |
|
| 824 |
## previousSibling(): SimpleHtmlDomInterface|null |
| 825 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 826 |
Returns the previous sibling of node. |
| 827 |
|
| 828 |
**Parameters:** |
| 829 |
__nothing__ |
| 830 |
|
| 831 |
**Return:** |
| 832 |
- `\SimpleHtmlDomInterface|null` |
| 833 |
|
| 834 |
-------- |
| 835 |
|
| 836 |
## removeAttribute(string $name): SimpleHtmlDomInterface |
| 837 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 838 |
Remove attribute. |
| 839 |
|
| 840 |
**Parameters:** |
| 841 |
- `string $name <p>The name of the html-attribute.</p>` |
| 842 |
|
| 843 |
**Return:** |
| 844 |
- `\SimpleHtmlDomInterface` |
| 845 |
|
| 846 |
-------- |
| 847 |
|
| 848 |
## removeAttributes(): SimpleHtmlDomInterface |
| 849 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 850 |
Remove all attributes |
| 851 |
|
| 852 |
**Parameters:** |
| 853 |
__nothing__ |
| 854 |
|
| 855 |
**Return:** |
| 856 |
- `\SimpleHtmlDomInterface` |
| 857 |
|
| 858 |
-------- |
| 859 |
|
| 860 |
## setAttribute(string $name, string|null $value, bool $strictEmptyValueCheck): SimpleHtmlDomInterface |
| 861 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 862 |
Set attribute value. |
| 863 |
|
| 864 |
**Parameters:** |
| 865 |
- `string $name <p>The name of the html-attribute.</p>` |
| 866 |
- `string|null $value <p>Set to NULL or empty string, to remove the attribute.</p>` |
| 867 |
- `bool $strictEmptyValueCheck </p> |
| 868 |
$value must be NULL, to remove the attribute, |
| 869 |
so that you can set an empty string as attribute-value e.g. autofocus="" |
| 870 |
</p>` |
| 871 |
|
| 872 |
**Return:** |
| 873 |
- `\SimpleHtmlDomInterface` |
| 874 |
|
| 875 |
-------- |
| 876 |
|
| 877 |
## text(): string |
| 878 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 879 |
Get dom node's plain text. |
| 880 |
|
| 881 |
**Parameters:** |
| 882 |
__nothing__ |
| 883 |
|
| 884 |
**Return:** |
| 885 |
- `string` |
| 886 |
|
| 887 |
-------- |
| 888 |
|
| 889 |
## val(string|string[]|null $value): string|string[]|null |
| 890 |
<a href="#voku-php-readme-class-methods">↑</a> |
| 891 |
|
| 892 |
|
| 893 |
**Parameters:** |
| 894 |
- `string|string[]|null $value <p> |
| 895 |
null === get the current input value |
| 896 |
text === set a new input value |
| 897 |
</p>` |
| 898 |
|
| 899 |
**Return:** |
| 900 |
- `string|string[]|null` |
| 901 |
|
| 902 |
-------- |
| 903 |
|
| 904 |
|