\Pydio\Core\UtilsXMLHelper

Static methods to help handling XML

Summary

Methods
Properties
Constants
toXmlElement()
xmlToArray()
wrapDocument()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$headerSent
N/A

Properties

$headerSent

$headerSent : boolean|string

Type

boolean|string

Methods

toXmlElement()

toXmlElement(string  $tagName, array  $attributes, string  $xmlChildren = "") : string

Simple XML element build from associative array. Can pass specific $children for nested elements.

Parameters

string $tagName
array $attributes
string $xmlChildren

Returns

string

xmlToArray()

xmlToArray(\DOMNode  $domXml, array  $options = array()) : array

Create plain PHP associative array from XML.

Example usage: $xmlNode = simplexml_load_file('example.xml'); $arrayData = xmlToArray($xmlNode); echo json_encode($arrayData);

Parameters

\DOMNode $domXml

The dom node to load

array $options

Associative array of options

Returns

array

wrapDocument()

wrapDocument(  $content, string  $docNode = "tree", array  $attributes = array()) : string

Wrap xml inside a <tree>.

.. document, including <?xml> declaration.

Parameters

$content
string $docNode
array $attributes

Returns

string