AbstractXmlParser implements LocalizationParserInterface

AbstractYes

Abstract class for XML based parser.

Internal

This class is a concrete implementation and is not part of the TYPO3 Core API.

Table of Contents

Interfaces

LocalizationParserInterface
Parser interface.

Properties

$languageKey  : string
$sourcePath  : string

Methods

getParsedData()  : array<string|int, mixed>
Returns parsed representation of XML file.
parseExtensionResource()  : array<string|int, mixed>
New method for parsing xml files, not part of an interface as the plan is to replace the entire API for labels with something different in TYPO3 12
_getParsedData()  : array<string|int, mixed>
Actually doing all the work of parsing an XML file
doParsingFromRoot()  : array<string|int, mixed>
Returns array representation of XML data, starting from a root node.
getLocalizedFileName()  : string
Checks if a localized file is found in labels pack (e.g. a language pack was downloaded in the backend) or if $sameLocation is set, then checks for a file located in "{language}.locallang.xlf" at the same directory
parseXmlFile()  : array<string|int, mixed>
Loads the current XML file before processing.

Properties

Methods

getParsedData()

Returns parsed representation of XML file.

public getParsedData(string $sourcePath, string $languageKey) : array<string|int, mixed>
Parameters
$sourcePath : string

Source file path

$languageKey : string

Language key

Tags
throws
FileNotFoundException
Return values
array<string|int, mixed>

parseExtensionResource()

New method for parsing xml files, not part of an interface as the plan is to replace the entire API for labels with something different in TYPO3 12

public parseExtensionResource(string $sourcePath, string $languageKey, string $fileNamePattern) : array<string|int, mixed>
Parameters
$sourcePath : string
$languageKey : string
$fileNamePattern : string
Return values
array<string|int, mixed>

_getParsedData()

Actually doing all the work of parsing an XML file

protected _getParsedData(string $sourcePath, string $languageKey, string|null $labelsPath) : array<string|int, mixed>
Parameters
$sourcePath : string

Source file path

$languageKey : string

Language key

$labelsPath : string|null
Tags
throws
FileNotFoundException
Return values
array<string|int, mixed>

doParsingFromRoot()

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

protected abstract doParsingFromRoot(SimpleXMLElement $root) : array<string|int, mixed>
Parameters
$root : SimpleXMLElement

A root node

Return values
array<string|int, mixed>

An array representing the parsed XML file

getLocalizedFileName()

Checks if a localized file is found in labels pack (e.g. a language pack was downloaded in the backend) or if $sameLocation is set, then checks for a file located in "{language}.locallang.xlf" at the same directory

protected getLocalizedFileName(string $fileRef, string $language[, bool $sameLocation = false ]) : string
Parameters
$fileRef : string

Absolute file reference to locallang file

$language : string

Language key

$sameLocation : bool = false

If TRUE, then locallang localization file name will be returned with same directory as $fileRef

Return values
string

Absolute path to the language file

parseXmlFile()

Loads the current XML file before processing.

protected parseXmlFile() : array<string|int, mixed>
Tags
throws
InvalidXmlFileException
Return values
array<string|int, mixed>

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


        
On this page

Search results