Auth_Yadis_XMLParser
in package
The base class for wrappers for available PHP XML-parsing extensions. To work with this Yadis library, subclasses of this class MUST implement the API as defined in the remarks for this class. Subclasses of Auth_Yadis_XMLParser are used to wrap particular PHP XML extensions such as 'domxml'. These are used internally by the library depending on the availability of supported PHP XML extensions.
Table of Contents
- attributes() : array<string|int, mixed>
- Return the attributes of a specified node.
- content() : string
- Return the textual content of a specified node.
- evalXPath() : array<string|int, mixed>
- Evaluate an XPath expression and return the resulting node list. This should be overridden by subclasses.
- init() : bool
- Initialize an instance of Auth_Yadis_XMLParser with some XML and namespaces. This SHOULD NOT be overridden by subclasses.
- registerNamespace() : bool
- Register a namespace with the XML parser. This should be overridden by subclasses.
- setXML() : bool
- Set this parser object's XML payload. This should be overridden by subclasses.
Methods
attributes()
Return the attributes of a specified node.
public
attributes(mixed $node) : array<string|int, mixed>
Parameters
- $node : mixed
-
A node object from a previous call to $this->evalXPath().
Return values
array<string|int, mixed> —An array mapping attribute names to values.
content()
Return the textual content of a specified node.
public
content(mixed $node) : string
Parameters
- $node : mixed
-
A node object from a previous call to $this->evalXPath().
Return values
string —$content The content of this node.
evalXPath()
Evaluate an XPath expression and return the resulting node list. This should be overridden by subclasses.
public
& evalXPath(string $xpath[, mixed $node = null ]) : array<string|int, mixed>
Parameters
- $xpath : string
-
The XPath expression to be evaluated.
- $node : mixed = null
-
A node object resulting from a previous evalXPath call. This node, if specified, provides the context for the evaluation of this xpath expression.
Return values
array<string|int, mixed> —$node_list An array of matching opaque node objects to be used with other methods of this parser class.
init()
Initialize an instance of Auth_Yadis_XMLParser with some XML and namespaces. This SHOULD NOT be overridden by subclasses.
public
init(string $xml_string, array<string|int, mixed> $namespace_map) : bool
Parameters
- $xml_string : string
-
A string of XML to be parsed.
- $namespace_map : array<string|int, mixed>
-
An array of ($ns_name => $ns_uri) to be registered with the XML parser. May be empty.
Return values
bool —$result True if the initialization and namespace registration(s) succeeded; false otherwise.
registerNamespace()
Register a namespace with the XML parser. This should be overridden by subclasses.
public
registerNamespace(string $prefix, string $uri) : bool
Parameters
- $prefix : string
-
The namespace prefix to appear in XML tag names.
- $uri : string
-
The namespace URI to be used to identify the namespace in the XML.
Return values
bool —$result True if the registration succeeded; false otherwise.
setXML()
Set this parser object's XML payload. This should be overridden by subclasses.
public
setXML(string $xml_string) : bool
Parameters
- $xml_string : string
-
The XML string to pass to this object's XML parser.
Return values
bool —$result True if the initialization succeeded; false otherwise.