abstract class AbstractXmlParser (View source)

An abstract class for all concrete classes that parses any kind of XML data.

Properties

protected array $parsedFiles

Associative array of "filename => parsed data" pairs.

Methods

array
getParsedData(string $sourcePath)

Returns parsed representation of XML file.

getRootNode(string $sourcePath)

No description

array
parseXmlFile(string $sourcePath)

Reads and parses XML file and returns internal representation of data.

array
doParsingFromRoot(SimpleXMLElement $root)

Returns array representation of XML data, starting from a root node.

Details

array getParsedData(string $sourcePath)

Returns parsed representation of XML file.

Parses XML if it wasn't done before. Caches parsed data.

Parameters

string $sourcePath

An absolute path to XML file

Return Value

array

Parsed XML file

protected SimpleXMLElement getRootNode(string $sourcePath)

No description

Parameters

string $sourcePath

Return Value

SimpleXMLElement

Exceptions

InvalidXmlFileException

protected array parseXmlFile(string $sourcePath)

Reads and parses XML file and returns internal representation of data.

Parameters

string $sourcePath

An absolute path to XML file

Return Value

array

Parsed XML file

abstract protected array doParsingFromRoot(SimpleXMLElement $root)

Returns array representation of XML data, starting from a root node.

Parameters

SimpleXMLElement $root

A root node

Return Value

array

An array representing parsed XML file (structure depends on concrete parser)