class LaravelXml (View source)

Methods

__construct()

No description

string
encode(array $array, string $rootElementName = 'document', bool $replaceSpacesByUnderScoresInKeyNames = true, string $xmlEncoding = 'UTF-8', string $xmlVersion = '1.0')

Convert the an array to an xml string

mixed
decode(string $data, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = false)

Convert a string of XML into an array

bool
is_valid(string $xml)

Check if a string is valid XML

array
validate(string $xml, string $xsd)

Validate XML string

Details

__construct()

No description

string encode(array $array, string $rootElementName = 'document', bool $replaceSpacesByUnderScoresInKeyNames = true, string $xmlEncoding = 'UTF-8', string $xmlVersion = '1.0')

Convert the an array to an xml string

Parameters

array $array
string $rootElementName
bool $replaceSpacesByUnderScoresInKeyNames
string $xmlEncoding
string $xmlVersion

Return Value

string

mixed decode(string $data, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = false)

Convert a string of XML into an array

Parameters

string $data

A well-formed XML string

string $class_name

[optional] Default: SimpleXMLElement

int $options
string $ns

[optional] Namespace prefix or URI.

bool $is_prefix

[optional] TRUE if ns is a prefix, FALSE if it's a URI, defaults to FALSE

Return Value

mixed

Array or FALSE on failure

bool is_valid(string $xml)

Check if a string is valid XML

Parameters

string $xml

Return Value

bool

array validate(string $xml, string $xsd)

Validate XML string

Parameters

string $xml
string $xsd file

Return Value

array errors