Copied!
  • property-read string $plaintext
CloneableInstantiable
Methods
public voku\helper\AbstractDomParser::__call( $name, $arguments)
 
  • param string $name
  • param array $arguments
  • return bool|mixed
public static __callStatic( $name, $arguments)
 
  • param string $name
  • param array $arguments
  • throws \BadMethodCallException
  • throws \RuntimeException
  • return static
public voku\helper\AbstractDomParser::__clone()
public __construct( $element = NULL)
 
  • param \DOMNode|\SimpleXmlDomInterface|string $element HTML code or SimpleXmlDomInterface, \DOMNode
public __get( $name)
 
  • param string $name
  • return string|null
public __invoke( $selector, $idx = NULL)
 
  • param string $selector
  • param int $idx
  • return \SimpleXmlDomInterface|\SimpleXmlDomInterface[]|\SimpleXmlDomNodeInterface<\SimpleXmlDomInterface>
public __toString() : string
 
  • return string
public autoRegisterXPathNamespaces(bool $autoRegisterXPathNamespaces = true) : self
 
  • param bool $autoRegisterXPathNamespaces
  • return $this
public autoRemoveXPathNamespaces(bool $autoRemoveXPathNamespaces = true) : self
 
  • param bool $autoRemoveXPathNamespaces
  • return $this
public voku\helper\AbstractDomParser::clear() : bool
 

does nothing (only for api-compatibility-reasons)

  • return bool
  • deprecated
public find(string $selector, $idx = NULL)
 

Find list of nodes with a CSS or xPath selector.

  • param string $selector
  • param int|null $idx
  • return \SimpleXmlDomInterface|\SimpleXmlDomInterface[]|\SimpleXmlDomNodeInterface<\SimpleXmlDomInterface>
public findMulti(string $selector) : voku\helper\SimpleXmlDomNodeInterface
 

Find nodes with a CSS or xPath selector.

  • param string $selector
  • return \SimpleXmlDomInterface[]|\SimpleXmlDomNodeInterface<\SimpleXmlDomInterface>
public findMultiOrFalse(string $selector)
 

Find nodes with a CSS or xPath selector or false, if no element is found.

  • param string $selector
  • return false|\SimpleXmlDomInterface[]|\SimpleXmlDomNodeInterface<\SimpleXmlDomInterface>
public findOne(string $selector) : voku\helper\SimpleXmlDomInterface
 

Find one node with a CSS or xPath selector.

  • param string $selector
  • return \SimpleXmlDomInterface
public findOneOrFalse(string $selector)
 

Find one node with a CSS or xPath selector or false, if no element is found.

  • param string $selector
  • return false|\SimpleXmlDomInterface
public fixHtmlOutput(string $content, bool $multiDecodeNewHtmlEntity = false, bool $putBrokenReplacedBack = true) : string
 
  • param string $content
  • param bool $multiDecodeNewHtmlEntity
  • param bool $putBrokenReplacedBack
  • return string
public voku\helper\AbstractDomParser::getDocument() : DOMDocument
 
  • return \DOMDocument
public getElementByClass(string $class) : voku\helper\SimpleXmlDomNodeInterface
 

Return elements by ".class".

  • param string $class
  • return \SimpleXmlDomInterface[]|\SimpleXmlDomNodeInterface<\SimpleXmlDomInterface>
public getElementById(string $id) : voku\helper\SimpleXmlDomInterface
 

Return element by #id.

  • param string $id
  • return \SimpleXmlDomInterface
public getElementByTagName(string $name) : voku\helper\SimpleXmlDomInterface
 

Return element by tag name.

  • param string $name
  • return \SimpleXmlDomInterface
public getElementsById(string $id, $idx = NULL)
 

Returns elements by "#id".

  • param string $id
  • param int|null $idx
  • return \SimpleXmlDomInterface|\SimpleXmlDomInterface[]|\SimpleXmlDomNodeInterface<\SimpleXmlDomInterface>
public getElementsByTagName(string $name, $idx = NULL)
 

Returns elements by tag name.

  • param string $name
  • param int|null $idx
  • return \SimpleXmlDomInterface|\SimpleXmlDomInterface[]|\SimpleXmlDomNodeInterface<\SimpleXmlDomInterface>
public html(bool $multiDecodeNewHtmlEntity = false, bool $putBrokenReplacedBack = true) : string
 

Get dom node's outer html.

  • param bool $multiDecodeNewHtmlEntity
  • param bool $putBrokenReplacedBack
  • return string
public voku\helper\AbstractDomParser::innerHtml(bool $multiDecodeNewHtmlEntity = false, bool $putBrokenReplacedBack = true) : string
 

Get dom node's inner html.

  • param bool $multiDecodeNewHtmlEntity
  • param bool $putBrokenReplacedBack
  • return string
public voku\helper\AbstractDomParser::innerXml(bool $multiDecodeNewHtmlEntity = false) : string
 

Get dom node's inner html.

  • param bool $multiDecodeNewHtmlEntity
  • return string
public loadHtml(string $html, $libXMLExtraOptions = NULL) : voku\helper\DomParserInterface
 

Load HTML from string.

  • param string $html
  • param int|null $libXMLExtraOptions
  • return $this
public loadHtmlFile(string $filePath, $libXMLExtraOptions = NULL) : voku\helper\DomParserInterface
 

Load HTML from file.

  • param string $filePath
  • param int|null $libXMLExtraOptions
  • throws \RuntimeException
  • return $this
public loadXml(string $xml, $libXMLExtraOptions = NULL, $useDefaultLibXMLOptions = true) : self
 

Load XML from string.

  • param string $xml
  • param int|null $libXMLExtraOptions
  • param bool $useDefaultLibXMLOptions
  • return $this
public loadXmlFile(string $filePath, $libXMLExtraOptions = NULL, $useDefaultLibXMLOptions = true) : self
 

Load XML from file.

  • param string $filePath
  • param int|null $libXMLExtraOptions
  • param bool $useDefaultLibXMLOptions
  • throws \RuntimeException
  • return $this
public static voku\helper\AbstractDomParser::putReplacedBackToPreserveHtmlEntities(string $html, bool $putBrokenReplacedBack = true) : string
 
  • param string $html
  • return string
public replaceTextWithCallback( $callback, ?DOMNode $domNode = NULL)
 
  • param callable $callback
  • param \DOMNode|null $domNode
  • return void
public static voku\helper\AbstractDomParser::replaceToPreserveHtmlEntities(string $html) : string
 
  • param string $html
  • return string
public reportXmlErrorsAsException(bool $reportXmlErrorsAsException = true) : self
 
  • param bool $reportXmlErrorsAsException
  • return $this
public voku\helper\AbstractDomParser::save(string $filepath = '') : string
 

Save the html-dom as string.

  • param string $filepath
  • return string
public voku\helper\AbstractDomParser::set_callback( $functionName)
 
  • param callable $functionName
  • phpstan-param callable(\voku\helper\XmlDomParser|\voku\helper\HtmlDomParser): void $functionName
  • return void
public setCallbackBeforeCreateDom(callable $callbackBeforeCreateDom) : self
 
  • param callable $callbackBeforeCreateDom
  • phpstan-param callable(string $xmlString, \voku\helper\XmlDomParser): string $callbackBeforeCreateDom
  • return $this
public setCallbackXPathBeforeQuery(callable $callbackXPathBeforeQuery) : self
 
  • param callable $callbackXPathBeforeQuery
  • phpstan-param callable(string $cssSelectorString, string $xPathString, \DOMXPath, \voku\helper\XmlDomParser): string $callbackXPathBeforeQuery
  • return $this
public voku\helper\AbstractDomParser::text(bool $multiDecodeNewHtmlEntity = false) : string
 

Get dom node's plain text.

  • param bool $multiDecodeNewHtmlEntity
  • return string
public voku\helper\AbstractDomParser::xml(bool $multiDecodeNewHtmlEntity = false, bool $htmlToXml = true, bool $removeXmlHeader = true, int $options = 4LIBXML_NOEMPTYTAG) : string
 

Get the HTML as XML or plain XML if needed.

  • param bool $multiDecodeNewHtmlEntity
  • param bool $htmlToXml
  • param bool $removeXmlHeader
  • param int $options
  • return string
Properties
protected static voku\helper\AbstractDomParser::$callback = NULL
 
  • var callable|null
  • phpstan-var null|callable(\voku\helper\XmlDomParser|\voku\helper\HtmlDomParser): void
protected voku\helper\AbstractDomParser::$document = NULL
 
  • var \DOMDocument
protected static voku\helper\AbstractDomParser::$domBrokenReplaceHelper = []
 
  • var array
protected static voku\helper\AbstractDomParser::$domHtmlBrokenHtmlHelper = '____simple_html_dom__voku__broken_html____'
 
  • var string
protected static voku\helper\AbstractDomParser::$domHtmlSpecialScriptHelper = '____simple_html_dom__voku__html_special_script____'
 
  • var string
protected static voku\helper\AbstractDomParser::$domHtmlWrapperHelper = '____simple_html_dom__voku__html_wrapper____'
 
  • var string
protected static voku\helper\AbstractDomParser::$domLinkReplaceHelper = ['orig' => ['[', ']', '{', '}'], 'tmp' => ['____SIMPLE_HTML_DOM__VOKU__SQUARE_BRACKET_LEFT____', '____SIMPLE_HTML_DOM__VOKU__SQUARE_BRACKET_RIGHT____', '____SIMPLE_HTML_DOM__VOKU__BRACKET_LEFT____', '____SIMPLE_HTML_DOM__VOKU__BRACKET_RIGHT____']]
 
  • var string[][]
protected static voku\helper\AbstractDomParser::$domReplaceHelper = ['orig' => ['&', '|', '+', '%', '@', '<html âš¡'], 'tmp' => ['____SIMPLE_HTML_DOM__VOKU__AMP____', '____SIMPLE_HTML_DOM__VOKU__PIPE____', '____SIMPLE_HTML_DOM__VOKU__PLUS____', '____SIMPLE_HTML_DOM__VOKU__PERCENT____', '____SIMPLE_HTML_DOM__VOKU__AT____', '<html ____SIMPLE_HTML_DOM__VOKU__GOOGLE_AMP____="true"']]
 
  • var string[][]
protected voku\helper\AbstractDomParser::$encoding = 'UTF-8'
 
  • var string
protected static voku\helper\AbstractDomParser::$functionAliases = []
 
  • var string[]
Methods
protected createDOMDocument(string $xml, $libXMLExtraOptions = NULL, $useDefaultLibXMLOptions = true) : DOMDocument
 

Create DOMDocument from XML.

  • param string $xml
  • param int|null $libXMLExtraOptions
  • param bool $useDefaultLibXMLOptions
  • return \DOMDocument
protected voku\helper\AbstractDomParser::decodeHtmlEntity(string $content, bool $multiDecodeNewHtmlEntity) : string
 
  • param string $content
  • param bool $multiDecodeNewHtmlEntity
  • return string
protected voku\helper\AbstractDomParser::getEncoding() : string
 

Get the encoding to use.

  • return string
protected voku\helper\AbstractDomParser::html5FallbackForScriptTags(string $html)
 
  • param string $html
  • return void
Properties
private $autoRegisterXPathNamespaces = false
 
  • var bool
private $autoRemoveXPathNamespaces = false
 
  • var bool
private $callbackBeforeCreateDom = NULL
 
  • var callable|null
  • phpstan-var null|callable(string $xmlString, \voku\helper\XmlDomParser): string
private $callbackXPathBeforeQuery = NULL
 
  • var callable|null
  • phpstan-var null|callable(string $cssSelectorString, string $xPathString, \DOMXPath, \voku\helper\XmlDomParser): string
private $reportXmlErrorsAsException = false
 
  • var bool
private $xPathNamespaces = []
 
  • var string[]
  • phpstan-var array<string, string>
Methods
private removeXPathNamespaces(string $xml) : string
 
  • param string $xml
  • return string
Properties
protected static voku\helper\AbstractDomParser::$callback = NULL
 
  • var callable|null
  • phpstan-var null|callable(\voku\helper\XmlDomParser|\voku\helper\HtmlDomParser): void
protected static voku\helper\AbstractDomParser::$domBrokenReplaceHelper = []
 
  • var array
protected static voku\helper\AbstractDomParser::$domHtmlBrokenHtmlHelper = '____simple_html_dom__voku__broken_html____'
 
  • var string
protected static voku\helper\AbstractDomParser::$domHtmlSpecialScriptHelper = '____simple_html_dom__voku__html_special_script____'
 
  • var string
protected static voku\helper\AbstractDomParser::$domHtmlWrapperHelper = '____simple_html_dom__voku__html_wrapper____'
 
  • var string
protected static voku\helper\AbstractDomParser::$domLinkReplaceHelper = ['orig' => ['[', ']', '{', '}'], 'tmp' => ['____SIMPLE_HTML_DOM__VOKU__SQUARE_BRACKET_LEFT____', '____SIMPLE_HTML_DOM__VOKU__SQUARE_BRACKET_RIGHT____', '____SIMPLE_HTML_DOM__VOKU__BRACKET_LEFT____', '____SIMPLE_HTML_DOM__VOKU__BRACKET_RIGHT____']]
 
  • var string[][]
protected static voku\helper\AbstractDomParser::$domReplaceHelper = ['orig' => ['&', '|', '+', '%', '@', '<html âš¡'], 'tmp' => ['____SIMPLE_HTML_DOM__VOKU__AMP____', '____SIMPLE_HTML_DOM__VOKU__PIPE____', '____SIMPLE_HTML_DOM__VOKU__PLUS____', '____SIMPLE_HTML_DOM__VOKU__PERCENT____', '____SIMPLE_HTML_DOM__VOKU__AT____', '<html ____SIMPLE_HTML_DOM__VOKU__GOOGLE_AMP____="true"']]
 
  • var string[][]
protected static voku\helper\AbstractDomParser::$functionAliases = []
 
  • var string[]
Methods
public static __callStatic( $name, $arguments)
 
  • param string $name
  • param array $arguments
  • throws \BadMethodCallException
  • throws \RuntimeException
  • return static
public static voku\helper\AbstractDomParser::putReplacedBackToPreserveHtmlEntities(string $html, bool $putBrokenReplacedBack = true) : string
 
  • param string $html
  • return string
public static voku\helper\AbstractDomParser::replaceToPreserveHtmlEntities(string $html) : string
 
  • param string $html
  • return string
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration