XmlPlugin
extends Plugin
in package
Table of Contents
- $parse_method : string
- Which method to parse the variable with.
- $parser : mixed
- getTriggers() : mixed
- getTypes() : array<string|int, mixed>
- An array of types (As returned by gettype) for all data this plugin can operate on.
- parse() : mixed
- setParser() : mixed
- xmlToDOMDocument() : null|array<string|int, mixed>
- Get the DOMDocument info.
- xmlToSimpleXML() : mixed
Properties
$parse_method
Which method to parse the variable with.
public
static string
$parse_method
= 'SimpleXML'
DOMDocument provides more information including the text between nodes, however it's memory usage is very high and it takes longer to parse and render. Plus it's a pain to work with. So SimpleXML is the default.
$parser
protected
mixed
$parser
Methods
getTriggers()
public
getTriggers() : mixed
Return values
mixed —getTypes()
An array of types (As returned by gettype) for all data this plugin can operate on.
public
getTypes() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of types
parse()
public
parse(mixed &$var, BasicObject &$o, mixed $trigger) : mixed
Parameters
- $var : mixed
- $o : BasicObject
- $trigger : mixed
Return values
mixed —setParser()
public
setParser(Parser $p) : mixed
Parameters
- $p : Parser
Return values
mixed —xmlToDOMDocument()
Get the DOMDocument info.
protected
static xmlToDOMDocument(string $var, null|string $parent_path) : null|array<string|int, mixed>
The documentation of DOMDocument::loadXML() states that while you can call it statically, it will give an E_STRICT warning. On my system it actually gives an E_DEPRECATED warning, but it works so we'll just add an error-silencing '@' to the access path.
If it errors loading then we wouldn't have gotten this far in the first place.
Parameters
- $var : string
-
The XML string
- $parent_path : null|string
-
The path to the parent, in this case the XML string
Return values
null|array<string|int, mixed> —The root element DOMNode, the access path, and the root element name
xmlToSimpleXML()
protected
static xmlToSimpleXML(mixed $var, mixed $parent_path) : mixed
Parameters
- $var : mixed
- $parent_path : mixed