class Xml (View source)

XML helpers.

Methods

static DOMDocument
load(string|DOMDocument $actual, bool $isHtml = false, string $filename = '', bool $xinclude = false, bool $strict = false)

Load an $actual document into a DOMDocument. This is called from the selector assertions.

static DOMDocument
loadFile(string $filename, bool $isHtml = false, bool $xinclude = false, bool $strict = false)

Loads an XML (or HTML) file into a DOMDocument object.

static 
removeCharacterDataNodes(DOMNode $node)

No description

static string
prepareString(string $string)

Escapes a string for the use in XML documents Any Unicode character is allowed, excluding the surrogate blocks, FFFE, and FFFF (not even as character reference).

static mixed
xmlToVariable(DOMElement $element)

"Convert" a DOMElement object into a PHP variable.

Details

static DOMDocument load(string|DOMDocument $actual, bool $isHtml = false, string $filename = '', bool $xinclude = false, bool $strict = false)

Load an $actual document into a DOMDocument. This is called from the selector assertions.

If $actual is already a DOMDocument, it is returned with no changes. Otherwise, $actual is loaded into a new DOMDocument as either HTML or XML, depending on the value of $isHtml. If $isHtml is false and $xinclude is true, xinclude is performed on the loaded DOMDocument.

Note: prior to PHPUnit 3.3.0, this method loaded a file and not a string as it currently does. To load a file into a DOMDocument, use loadFile() instead.

Parameters

string|DOMDocument $actual
bool $isHtml
string $filename
bool $xinclude
bool $strict

Return Value

DOMDocument

static DOMDocument loadFile(string $filename, bool $isHtml = false, bool $xinclude = false, bool $strict = false)

Loads an XML (or HTML) file into a DOMDocument object.

Parameters

string $filename
bool $isHtml
bool $xinclude
bool $strict

Return Value

DOMDocument

static removeCharacterDataNodes(DOMNode $node)

Parameters

DOMNode $node

static string prepareString(string $string)

Escapes a string for the use in XML documents Any Unicode character is allowed, excluding the surrogate blocks, FFFE, and FFFF (not even as character reference).

See http://www.w3.org/TR/xml/#charsets

Parameters

string $string

Return Value

string

static mixed xmlToVariable(DOMElement $element)

"Convert" a DOMElement object into a PHP variable.

Parameters

DOMElement $element

Return Value

mixed