final class XmlRoot
    implements Scalar, OutputNaming
    uses Snapshot
Public API: explicitly declared with @visibility public.

XMLROOT (value, VERSION {version | NO VALUE} [, STANDALONE {YES | NO | NO VALUE}]): an XML value with a new root declaration.

Mirrors PostgreSQL's XmlExpr of kind IS_XMLROOT. Rule: PG-XMLROOT-001. Facts: xml; NULL exactly when the value is. The result column is named xmlroot. Source: https://www.postgresql.org/docs/17/functions-xml.html#FUNCTIONS-PRODUCING-XML-XMLROOT. Status: Implemented.

Reading a root without a versiondoctest
$root = new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Xml\XmlRoot(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral(), null, \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Xml\XmlStandalone::Yes);
    [$root->version, $root->standalone->value] // => [null, 'YES']

Properties§

public Scalar $value
public Scalar|null $version = null
public XmlStandalone|null $standalone = null

Methods§

public function __construct(
    public Scalar $value,
    public Scalar|null $version = null,
    public XmlStandalone|null $standalone = null,
)

Parameters

$valueScalarThe XML value
$versionScalar|nullThe version; null for VERSION NO VALUE
$standaloneXmlStandalone|nullThe standalone declaration written
public function outputName(): Name

Names an unaliased result column.

Returns

Test cases 1
Calls 1
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the value and the version, the type and the NULL fact.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

Calls 5
public function render(Output $out): void

Writes XMLROOT with the value, the version and the standalone declaration.

Parameters

$outOutput
Test cases 1
Calls 4

Test cases 3§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 3

Relations§

Instantiated in 1
Type declarations 1