Method |
Description |
|
__construct ( string $string = null, boolean $isFile = false, string $encoding = 'UTF-8', string $type = 'html' ) |
Constructor. |
|
__invoke ( string $expression, string $type = Query::TYPE_CSS, boolean $wrapElement = true ) : Element[] | DOMElement[] |
Searches for an node in the DOM tree for a given XPath expression or a CSS selector. |
|
__toString ( ) : string |
Convert the document to its string representation. |
|
appendChild ( Element | DOMNode | array $nodes ) : Document |
Add new child at the end of the children. |
|
count ( string $expression, string $type = Query::TYPE_CSS ) : integer |
Counts nodes for a given XPath expression or a CSS selector. |
|
create ( string $string = null, boolean $isFile = false, string $encoding = 'UTF-8', string $type = 'html' ) : Document |
Create new document. |
|
createElement ( string $name, string $value = null, array $attributes = [] ) : Element |
Create new element node. |
|
createElementBySelector ( string $selector, string $value = null, array $attributes = [] ) : Element |
Create new element node by CSS selector. |
|
find ( string $expression, string $type = Query::TYPE_CSS, boolean $wrapElement = true ) : Element[] | DOMElement[] |
Searches for an node in the DOM tree for a given XPath expression or a CSS selector. |
|
first ( string $expression, string $type = Query::TYPE_CSS, boolean $wrapElement = true ) : Element | DOMElement | null |
Searches for an node in the DOM tree and returns first element or null. |
|
format ( boolean $format = true ) : Document |
Nicely formats output with indentation and extra space. |
|
getDocument ( ) : DOMDocument |
|
|
getElement ( ) : DOMElement |
|
|
getType ( ) : string |
Returns the type of document (XML or HTML). |
|
has ( string $expression, string $type = Query::TYPE_CSS ) : boolean |
Checks the existence of the node. |
|
html ( integer $options = LIBXML_NOEMPTYTAG ) : string |
Dumps the internal document into a string using HTML formatting. |
|
is ( Document | DOMDocument $document ) : boolean |
Indicates if two documents are the same document. |
|
load ( string $string, boolean $isFile = false, string $type = 'html', integer $options ) |
Load HTML or XML. |
|
loadHtml ( string $html, integer $options ) : Document |
Load HTML from a string. |
|
loadHtmlFile ( string $filepath, integer $options ) : Document |
Load HTML from a file. |
|
loadXml ( string $xml, integer $options ) : Document |
Load XML from a string. |
|
loadXmlFile ( string $filepath, integer $options ) : Document |
Load XML from a file. |
|
preserveWhiteSpace ( boolean $value = true ) : Document |
Set preserveWhiteSpace property. |
|
text ( ) : string |
Get the text content of this node and its descendants. |
|
toElement ( ) : Element |
|
|
xml ( integer $options ) : string |
Dumps the internal document into a string using XML formatting. |
|
xpath ( string $expression, boolean $wrapElement = true ) : Element[] | DOMElement[] |
Searches for an node in the DOM tree for a given XPath expression. |
|