Skip to content

XmlConfigDomDocument

Extended DOMDocument class with several convenience enhancements.

class XmlConfigDomDocument extends DOMDocument

ExtendsDOMDocument
Since1.0.0
SourceConfig/Util/DOM/XmlConfigDomDocument.php

public function __construct(string $version = '1.0', string $encoding = 'UTF-8'): mixed

The constructor.

The XML encoding.

ParameterTypeDescription
$versionstringThe XML version.
$encodingstringThe XML encoding.

Returns mixed

MethodDescription
getConfigurationElements(): array<int, XmlConfigDomElement>Method to retrieve a list of Quiote elements regardless of their namespace.
getDefaultNamespacePrefix(): stringRetrieve the default namespace prefix that will be used by node classes, if set, to conveniently retrieve child elements etc via XPath.
getDefaultNamespaceUri(): stringRetrieve the default namespace URI that will be used by node classes, if set, to conveniently retrieve child elements etc in some methods.
getQuioteEnvelopeNamespace(): ?stringRetrieve the namespace of the Quiote envelope.
getSandbox(): ?XmlConfigDomElementMethod to retrieve the Quiote element regardless of the namespace.
getXpath(): DOMXPathRetrieve the DOMXPath instance that is associated with this document.
importNode(DOMNode $node, bool $deep = false): mixedImport a node into the current document.
isQuioteConfiguration(): boolCheck whether or not this is a standard Quiote configuration file, i.e.
load(string $filename, int $options = 0): boolLoad XML from a file.
loadXml(string $source, int $options = 0): boolLoad XML from a string.
[`query(string $expression, ?DOMNode $contextNode = null): DOMNodeList<DOMNodeDOMNameSpaceNode>`](#query)
relaxNGValidate(string $filename): boolPerform RELAX NG validation on the document.
schemaValidate(string $filename, int $flags = 0): boolValidate a document based on a schema.
schemaValidateSource(string $source, mixed $flags = 0): boolValidate a document based on a schema.
setDefaultNamespace(string $namespaceUri, string $prefix = '_default'): voidSet a default namespace that should be used when accessing elements via convenience methods (such as magic get overload for children), and bind it to the given prefix for use in XPath expressions.
xinclude(int $options = 0): intSubstitutes XIncludes in a DOMDocument object.

public function getConfigurationElements(): array<int, XmlConfigDomElement>

Method to retrieve a list of Quiote elements regardless of their namespace.

Returns array``<``int``, XmlConfigDomElement> — A list of XmlConfigDomElement elements.

public function getDefaultNamespacePrefix(): string

Retrieve the default namespace prefix that will be used by node classes, if set, to conveniently retrieve child elements etc via XPath.

Returns string — A namespace prefix.

public function getDefaultNamespaceUri(): string

Retrieve the default namespace URI that will be used by node classes, if set, to conveniently retrieve child elements etc in some methods.

Returns string — A namespace URI.

public function getQuioteEnvelopeNamespace(): ?string

Retrieve the namespace of the Quiote envelope.

Returns ?``string — A namespace URI, or null if it’s not an Quiote config.

public function getSandbox(): ?XmlConfigDomElement

Method to retrieve the Quiote element regardless of the namespace.

Returns ?XmlConfigDomElement — The element, or null.

public function getXpath(): DOMXPath

Retrieve the DOMXPath instance that is associated with this document.

Returns DOMXPath — The DOMXPath instance.

public function importNode(DOMNode $node, bool $deep = false): mixed

Import a node into the current document.

Whether or not to recursively import the node’s subtree.

ParameterTypeDescription
$nodeDOMNodeThe node to import.
$deepboolWhether or not to recursively import the node’s subtree.

Returns mixed — The copied node, or false if it cannot be copied.

public function isQuioteConfiguration(): bool

Check whether or not this is a standard Quiote configuration file, i.e.

with a and envelope.

Returns bool — true, if it is an Quiote config structure, false otherwise.

public function load(string $filename, int $options = 0): bool

Load XML from a file.

Bitwise OR of the libxml option constants.

ParameterTypeDescription
$filenamestringThe path to the XML document.
$optionsintBitwise OR of the libxml option constants.

Returns bool — True of the operation is successful; false otherwise.

public function loadXml(string $source, int $options = 0): bool

Load XML from a string.

Bitwise OR of the libxml option constants.

ParameterTypeDescription
$sourcestringThe string containing the XML.
$optionsintBitwise OR of the libxml option constants.

Returns bool — True of the operation is successful; false otherwise.

public function query(string $expression, ?DOMNode $contextNode = null): DOMNodeList<DOMNode|DOMNameSpaceNode>

Run an XPath query against this document (or, when given, a context node within it) and return the resulting node list.

An optional context node to query relative to.

ParameterTypeDescription
$expressionstringThe XPath expression to evaluate.
$contextNode?``DOMNodeAn optional context node to query relative to.

Returns DOMNodeList``<``DOMNode``|``DOMNameSpaceNode``>

public function relaxNGValidate(string $filename): bool

Perform RELAX NG validation on the document.

The path to the schema.

ParameterTypeDescription
$filenamestringThe path to the schema.

Returns bool — True if the validation is successful; false otherwise.

public function schemaValidate(string $filename, int $flags = 0): bool

Validate a document based on a schema.

Bitwise OR of the libxml option constants.

ParameterTypeDescription
$filenamestringThe path to the schema.
$flagsintBitwise OR of the libxml option constants.

Returns bool — True if the validation is successful; false otherwise.

public function schemaValidateSource(string $source, mixed $flags = 0): bool

Validate a document based on a schema.

A string containing the schema.

ParameterTypeDescription
$sourcestringA string containing the schema.
$flagsmixed

Returns bool — True if the validation is successful; false otherwise.

public function setDefaultNamespace(string $namespaceUri, string $prefix = '_default'): void

Set a default namespace that should be used when accessing elements via convenience methods (such as magic get overload for children), and bind it to the given prefix for use in XPath expressions.

An optional prefix, defaulting to “_default”

ParameterTypeDescription
$namespaceUristringA namespace URI
$prefixstringAn optional prefix, defaulting to “_default”

public function xinclude(int $options = 0): int

Substitutes XIncludes in a DOMDocument object.

Bitwise OR of the libxml option constants.

ParameterTypeDescription
$optionsintBitwise OR of the libxml option constants.

Returns int — The number of XIncludes in the document.

These come from an ancestor and are documented where they are declared.

MethodDeclared inDescription
C14N()DOMNode
C14NFile()DOMNode
adoptNode()DOMDocument
append()DOMDocument
appendChild()DOMNode
cloneNode()DOMNode
compareDocumentPosition()DOMNode
contains()DOMNode
createAttribute()DOMDocument
createAttributeNS()DOMDocument
createCDATASection()DOMDocument
createComment()DOMDocument
createDocumentFragment()DOMDocument
createElement()DOMDocument
createElementNS()DOMDocument
createEntityReference()DOMDocument
createProcessingInstruction()DOMDocument
createTextNode()DOMDocument
getElementById()DOMDocument
getElementsByTagName()DOMDocument
getElementsByTagNameNS()DOMDocument
getLineNo()DOMNode
getNodePath()DOMNode
getRootNode()DOMNode
hasAttributes()DOMNode
hasChildNodes()DOMNode
insertBefore()DOMNode
isDefaultNamespace()DOMNode
isEqualNode()DOMNode
isSameNode()DOMNode
isSupported()DOMNode
loadHTML()DOMDocument
loadHTMLFile()DOMDocument
lookupNamespaceURI()DOMNode
lookupPrefix()DOMNode
normalize()DOMNode
normalizeDocument()DOMDocument
prepend()DOMDocument
registerNodeClass()DOMDocument
relaxNGValidateSource()DOMDocument
removeChild()DOMNode
replaceChild()DOMNode
replaceChildren()DOMDocument
save()DOMDocument
saveHTML()DOMDocument
saveHTMLFile()DOMDocument
saveXML()DOMDocument
validate()DOMDocument