Class used to initialize DomDocument from string, with proper verifications

package Default

 Methods

Constructor

__construct(string|null $document = null, string|null $type = null, string|null $encoding = null

Parameters

$document

stringnull

String containing the document

$type

stringnull

Force the document to be of a certain type, bypassing setStringDocument's detection

$encoding

stringnull

Encoding for the document (used for DOMDocument generation)

Get DOMDocument generated from set raw document

getDomDocument() : \DOMDocument

Exceptions

\Zend\Dom\Exception\RuntimeException If cannot get DOMDocument; no document registered

Returns

\DOMDocument

Get set document encoding

getEncoding() : string | null

Returns

stringnull

Get DOMDocument generation errors

getErrors() : array

Returns

array

Get raw set document

getStringDocument() : string | null

Returns

stringnull

Get raw document type

getType() : string | null

Returns

stringnull

Get Document's registered XPath namespaces

getXpathNamespaces() : array

Returns

array

Get Document's registered XPath PHP Functions

getXpathPhpFunctions() : string | null

Returns

stringnull

Register XPath namespaces

registerXpathNamespaces(array $xpathNamespaces) : void

Parameters

$xpathNamespaces

array

Register PHP Functions to use in internal DOMXPath

registerXpathPhpFunctions(boolean $xpathPhpFunctions = true) : void

Parameters

$xpathPhpFunctions

boolean

Set raw document encoding for DOMDocument generation

setEncoding(string|null $encoding) : \Zend\Dom\Document
fluent This method is part of a fluent interface and will return the same instance

Parameters

$encoding

stringnull

Returns

\Zend\Dom\Document

Get DOMDocument from set raw document

getDomDocumentFromString($stringDocument) : \DOMDocument

Parameters

$stringDocument

Exceptions

\Zend\Dom\Exception\RuntimeException

Returns

\DOMDocument

Set DOMDocument

setDomDocument(\DOMDocument $domDocument) : \Zend\Dom\Document
fluent This method is part of a fluent interface and will return the same instance

Parameters

$domDocument

\DOMDocument

Returns

\Zend\Dom\Document

Set document errors from DOMDocument generation

setErrors(array $errors) : \Zend\Dom\Document
fluent This method is part of a fluent interface and will return the same instance

Parameters

$errors

array

Returns

\Zend\Dom\Document

Set raw document

setStringDocument(string|null $document, string|null $forcedType = null, string|null $forcedEncoding = null) : \Zend\Dom\Document
fluent This method is part of a fluent interface and will return the same instance

Parameters

$document

stringnull

$forcedType

stringnull

Type for the provided document (see constants)

$forcedEncoding

stringnull

Encoding for the provided document

Returns

\Zend\Dom\Document

Set raw document type

setType(string $type) : \Zend\Dom\Document
fluent This method is part of a fluent interface and will return the same instance

Parameters

$type

string

Returns

\Zend\Dom\Document

 Properties

 

DOMDocument generated from raw string document

$domDocument : \DOMDocument

Default

 

Error list generated from transformation of document to DOMDocument

$errors : array

Default

array()
 

Raw document

$stringDocument : string

Default

 

Type of the document provided

$type : string

Default

 

XPath namespaces

$xpathNamespaces : array

Default

array()
 

XPath PHP Functions

$xpathPhpFunctions : mixed

Default

 Constants

 

DOC_HTML

DOC_HTML = 'DOC_HTML' 
 

DOC_XHTML

DOC_XHTML = 'DOC_XHTML' 
 

DOC_XML

DOC_XML = 'DOC_XML'