-
Notifications
You must be signed in to change notification settings - Fork 4
Class XmlDocumentReader
Class representing the XML reader helper
Constructor
public function __construct(): \XmlDocumentReader
{
}
Returns a value of type \XmlDocumentReader
Add a namespace declaration to the root
public function addNamespace(string $namespace, string $value): static
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
namespace | string | ❌ | |
value | string | ❌ |
Returns a value of type static
Load from XML string
public function loadFromXmlString(string $source): \XmlDocumentReader
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
source | string | ❌ |
Returns a value of type \XmlDocumentReader
Load from XML file
public function loadFromXmlFile(string $filename): \XmlDocumentReader
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
filename | string | ❌ |
Returns a value of type \XmlDocumentReader
Returns true if the expression found anything
public function exists(string $expression, ?DOMNode $contextNode = null): bool
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
expression | string | ❌ | |
contextNode | DOMNode | ✔️ |
Returns a value of type bool
Executes the given XPath expression.
public function query(string $expression, ?DOMNode $contextNode = null): \DOMNodeList|false
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
expression | string | ❌ | |
contextNode | DOMNode | ✔️ |
Returns a value of type \DOMNodeList|false
Returns the value of a query
public function queryValue(string $expression, ?DOMNode $contextNode = null): string|null
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
expression | string | ❌ | |
contextNode | DOMNode | ✔️ |
Returns a value of type string|null
Returns the value of a query
public function queryAll(string $expression, ?DOMNode $contextNode = null): void
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
expression | string | ❌ | |
contextNode | DOMNode | ✔️ |
When an element can be queried the $callback is called otherwise $callbackElse
public function whenExists(
string $expression,
?DOMNode $contextNode,
mixed $callback,
mixed $callbackElse = null,
): \XmlDocumentReader
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
expression | string | ❌ | |
contextNode | DOMNode | ✔️ | |
callback | mixed | ❌ | |
callbackElse | mixed | ❌ |
Returns a value of type \XmlDocumentReader
When an element cannot be queried the $callback is called otherwise $callbackElse
public function whenNotExists(
string $expression,
?DOMNode $contextNode,
mixed $callback,
mixed $callbackElse = null,
): \XmlDocumentReader
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
expression | string | ❌ | |
contextNode | DOMNode | ✔️ | |
callback | mixed | ❌ | |
callbackElse | mixed | ❌ |
Returns a value of type \XmlDocumentReader
When an element equals value(s) the $callback is called
public function whenEquals(
string $expression,
?DOMNode $contextNode,
mixed $values,
mixed $callback,
mixed $callbackElse = null,
): \XmlDocumentReader
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
expression | string | ❌ | |
contextNode | DOMNode | ✔️ | |
values | mixed | ❌ | |
callback | mixed | ❌ | |
callbackElse | mixed | ❌ |
Returns a value of type \XmlDocumentReader
When an element not equals value(s) the $callback is called
public function whenNotEquals(
string $expression,
?DOMNode $contextNode,
mixed $values,
mixed $callback,
mixed $callbackElse = null,
): \XmlDocumentReader
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
expression | string | ❌ | |
contextNode | DOMNode | ✔️ | |
values | mixed | ❌ | |
callback | mixed | ❌ | |
callbackElse | mixed | ❌ |
Returns a value of type \XmlDocumentReader
When one exists
public function whenOneExists(
array $expressions,
array $contextNodes,
mixed $callback,
mixed $callbackElse = null,
): \XmlDocumentReader
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
expressions | array | ❌ | |
contextNodes | array | ❌ | |
callback | mixed | ❌ | |
callbackElse | mixed | ❌ |
Returns a value of type \XmlDocumentReader
(c) HorstOeko 2024..