PHP Class BluntXml, cakephp-rest-plugin

Basic array <> XML conversion. No support for attributes. Uses configurable tag to numerically indexed objects
Author: kvz
Author: Jonathan Dalrymple
Datei anzeigen Open project: kvz/cakephp-rest-plugin

Public Properties

Property Type Description
$beautify
$encoding
$itemTag
$rootTag
$version

Protected Properties

Property Type Description
$_encodeBuffer

Public Methods

Method Description
decode ( string $xml ) : array Decode xml string to multidimensional array
encode ( array $array, $rootTag = null ) : string Encode multidimensional array to xml string

Protected Methods

Method Description
_numeric ( array $array = [] ) : boolean Determines is an array is numerically indexed
_toArray ( object $object ) : array SimpleXML Object to Array
_toArrayValue ( $data, $key = '' )
_toXml ( array $array ) : string Recusively converts array to xml, itemizes numerically indexes arrays
_toXmlValue ( $data )
_unitemize ( array $array ) : array Strips out tags and nests children in sensible places
_xmlBeautify ( string $xml ) : string Takes unformatted xml string and beautifies it

Method Details

_numeric() protected method

Determines is an array is numerically indexed
protected _numeric ( array $array = [] ) : boolean
$array array
return boolean

_toArray() protected method

SimpleXML Object to Array
protected _toArray ( object $object ) : array
$object object
return array $array

_toArrayValue() protected method

protected _toArrayValue ( $data, $key = '' )

_toXml() protected method

Recusively converts array to xml, itemizes numerically indexes arrays
protected _toXml ( array $array ) : string
$array array
return string

_toXmlValue() protected method

protected _toXmlValue ( $data )

_unitemize() protected method

Strips out tags and nests children in sensible places
protected _unitemize ( array $array ) : array
$array array
return array

_xmlBeautify() protected method

Takes unformatted xml string and beautifies it
protected _xmlBeautify ( string $xml ) : string
$xml string
return string

decode() public method

Decode xml string to multidimensional array
public decode ( string $xml ) : array
$xml string
return array

encode() public method

Encode multidimensional array to xml string
public encode ( array $array, $rootTag = null ) : string
$array array
return string

Property Details

$_encodeBuffer protected_oe property

protected $_encodeBuffer

$beautify public_oe property

public $beautify

$encoding public_oe property

public $encoding

$itemTag public_oe property

public $itemTag

$rootTag public_oe property

public $rootTag

$version public_oe property

public $version