Document
class Document (View source)
Constants
| ARRAY_SIMPLE |
Use with |
| ARRAY_MINIMAL |
Use with |
| ARRAY_COMPLETE |
Use with |
| HTML |
Use for define format |
| XML |
|
| ERROR |
Constants to treat errors issued by libXML as exceptions |
| FATAL |
|
| WARNING |
|
Methods
Create a Document instance
Define libXML errors as exceptions
Define libXML options for load a document or string
Define libXML options for dump or save a document as file
Get original document
Get root element
Load file
Load string
Convert Array to DOM
Convert DOM to Array
Save document to file and returns the number of bytes written or false if an error occurred
Details
__construct(int $type = 0)
Create a Document instance
static
setSeverityLevels(int $levels)
Define libXML errors as exceptions
setLoadOptions(int $options)
Define libXML options for load a document or string
setSaveOptions(int $options)
Define libXML options for dump or save a document as file
DOMDocument
document()
Get original document
DOMElement|null
root()
Get root element
Selector
selector()
Gets all elements that match the CSS selector
array
getNamespaces(DOMElement $element)
Get namespace attributes from root element or specific element
loadFile(string $file)
Load file
loadString(string $string)
Load string
fromArray(array $data)
Convert Array to DOM
array
toArray(int $format)
Convert DOM to Array
string|false
dump(DOMNode $node)
Convert document to XML string, HTML string or array
int|false
save(string $file)
Save document to file and returns the number of bytes written or false if an error occurred