OdeParser
in package
Parse modern ODE content.xml project data.
Tags
Table of Contents
Properties
- $decoderRegistry : IdeviceDecoderRegistry|null
- $htmlText : HtmlText
- $normalizeIdeviceState : bool
- $stateParser : IdeviceStateParser
Methods
- __construct() : mixed
- parse() : array<string, mixed>
- Parse a modern ODE XML document.
- collectPages() : array<int, array<string, mixed>>
- Build normalized page, block and iDevice information.
- collectStrings() : array<int, string>
- Collect normalized strings from parsed pages.
- decodeJsonProperties() : array<string|int, mixed>
- Decode structured iDevice properties.
- readKeyValueNodes() : array<string, string>
- Convert ODE key/value nodes to an associative array.
- xpath() : array<int, SimpleXMLElement>
- Execute XPath with the default namespace mapped to x.
Properties
$decoderRegistry
private
IdeviceDecoderRegistry|null
$decoderRegistry
$htmlText
private
HtmlText
$htmlText
$normalizeIdeviceState
private
bool
$normalizeIdeviceState
$stateParser
private
IdeviceStateParser
$stateParser
Methods
__construct()
public
__construct([HtmlText|null $htmlText = null ][, IdeviceStateParser|null $stateParser = null ][, bool $normalizeIdeviceState = true ][, IdeviceDecoderRegistry|null $decoderRegistry = null ]) : mixed
Parameters
- $htmlText : HtmlText|null = null
-
Optional HTML text converter.
- $stateParser : IdeviceStateParser|null = null
-
Optional iDevice state parser.
- $normalizeIdeviceState : bool = true
-
Normalize structured iDevice state.
- $decoderRegistry : IdeviceDecoderRegistry|null = null
-
Optional custom decoder registry.
parse()
Parse a modern ODE XML document.
public
parse(SimpleXMLElement $xml) : array<string, mixed>
Parameters
- $xml : SimpleXMLElement
-
Parsed XML.
Return values
array<string, mixed>collectPages()
Build normalized page, block and iDevice information.
private
collectPages(SimpleXMLElement $xml) : array<int, array<string, mixed>>
Parameters
- $xml : SimpleXMLElement
-
Parsed XML.
Return values
array<int, array<string, mixed>>collectStrings()
Collect normalized strings from parsed pages.
private
collectStrings(array<int, array<string, mixed>> $pages) : array<int, string>
Parameters
- $pages : array<int, array<string, mixed>>
-
Parsed pages.
Return values
array<int, string>decodeJsonProperties()
Decode structured iDevice properties.
private
decodeJsonProperties(string $json) : array<string|int, mixed>
Parameters
- $json : string
-
Raw JSON.
Return values
array<string|int, mixed>readKeyValueNodes()
Convert ODE key/value nodes to an associative array.
private
readKeyValueNodes(array<int, SimpleXMLElement> $nodes) : array<string, string>
Parameters
- $nodes : array<int, SimpleXMLElement>
-
Nodes to read.
Return values
array<string, string>xpath()
Execute XPath with the default namespace mapped to x.
private
xpath(SimpleXMLElement $node, string $path) : array<int, SimpleXMLElement>
Parameters
- $node : SimpleXMLElement
-
XML node.
- $path : string
-
XPath expression.