CldrParser
class CldrParser extends AbstractXmlParser (View source)
A class which parses CLDR file to simple but useful array representation.
Parsed data is an array where keys are nodes from XML file with its attributes (if any). Only distinguishing attributes are taken into account (see [1]). Below are examples of parsed data structure.
such XML data:
will be converted to such array: array( 'dates' => array( 'calendars' => array( 'calendar[@type="gregorian"]' => array( 'months' => '' ), 'calendar[@type="buddhist"]' => array( 'months' => '' ), ) ) )
Properties
protected array | $parsedFiles | Associative array of "filename => parsed data" pairs. |
from AbstractXmlParser |
Methods
Returns parsed representation of XML file.
Reads and parses XML file and returns internal representation of data.
Returns array representation of XML data, starting from a root node.
Returns array representation of XML data, starting from a node pointed by $node variable.
Checks if given attribute belongs to the group of distinguishing attributes
Details
array
getParsedData(string $sourcePath)
Returns parsed representation of XML file.
Parses XML if it wasn't done before. Caches parsed data.
protected SimpleXMLElement
getRootNode(string $sourcePath)
No description
protected array
parseXmlFile(string $sourcePath)
Reads and parses XML file and returns internal representation of data.
protected array
doParsingFromRoot(SimpleXMLElement $root)
Returns array representation of XML data, starting from a root node.
protected mixed
parseNode(SimpleXMLElement $node)
Returns array representation of XML data, starting from a node pointed by $node variable.
Please see the documentation of this class for details about the internal representation of XML data.
protected bool
isDistinguishingAttribute(string $attributeName)
Checks if given attribute belongs to the group of distinguishing attributes
Distinguishing attributes in CLDR serves to distinguish multiple elements at the same level (most notably 'type').