Propel API
Class

PropelXMLParser

class PropelXMLParser extends PropelParser

XML parser.

Converts data between associative array and XML formats

Methods

string fromArray(array $array, string $rootElementName = 'data', string $charset = null)

Converts data from an associative array to XML.

array toArray(string $data)

Converts data from XML to an associative array.

listFromArray($array, $rootElementName = 'data', $charset = null)

listToArray($data)

from PropelParser
string load(string $path)

Loads data from a file.

from PropelParser
dump(string $data, string $path = null)

Dumps data to a file, or to STDOUT if no filename is given

from PropelParser
static PropelParser getParser(string $type = 'XML')

Factory for getting an instance of a subclass of PropelParser

from PropelParser
string toXML(array $array, string $rootElementName = 'data', string $charset = null)

Alias for PropelXMLParser::fromArray()

string listToXML(array $array, string $rootElementName = 'data', string $charset = null)

Alias for PropelXMLParser::listFromArray()

array fromXML(string $data)

Alias for PropelXMLParser::toArray()

Details

at line 29
public string fromArray(array $array, string $rootElementName = 'data', string $charset = null)

Converts data from an associative array to XML.

Parameters

array $array Source data to convert
string $rootElementName Name of the root element of the XML document
string $charset Character set of the input data. Defaults to UTF-8.

Return Value

string Converted data, as an XML string

at line 135
public array toArray(string $data)

Converts data from XML to an associative array.

Parameters

string $data Source data to convert, as an XML string

Return Value

array Converted data

at line 37
public listFromArray($array, $rootElementName = 'data', $charset = null)

Parameters

$array
$rootElementName
$charset

in PropelParser at line 45
public listToArray($data)

Parameters

$data

in PropelParser at line 57
public string load(string $path)

Loads data from a file.

Executes PHP code blocks in the file.

Parameters

string $path Path to the file to load

Return Value

string The file content processed by PHP

in PropelParser at line 75
public dump(string $data, string $path = null)

Dumps data to a file, or to STDOUT if no filename is given

Parameters

string $data The file content
string $path Path of the file to create

in PropelParser at line 91
static public PropelParser getParser(string $type = 'XML')

Factory for getting an instance of a subclass of PropelParser

Parameters

string $type Parser type, amon 'XML', 'YAML', 'JSON', and 'CSV'

Return Value

PropelParser A PropelParser subclass instance

at line 72
public string toXML(array $array, string $rootElementName = 'data', string $charset = null)

Alias for PropelXMLParser::fromArray()

Parameters

array $array Source data to convert
string $rootElementName Name of the root element of the XML document
string $charset Character set of the input data. Defaults to UTF-8.

Return Value

string Converted data, as an XML string

at line 86
public string listToXML(array $array, string $rootElementName = 'data', string $charset = null)

Alias for PropelXMLParser::listFromArray()

Parameters

array $array Source data to convert
string $rootElementName Name of the root element of the XML document
string $charset Character set of the input data. Defaults to UTF-8.

Return Value

string Converted data, as an XML string

at line 149
public array fromXML(string $data)

Alias for PropelXMLParser::toArray()

Parameters

string $data Source data to convert, as an XML string

Return Value

array Converted data