Skip to content

[FAETURE] add support for xPath functions #389

@dkd-kaehm

Description

@dkd-kaehm

There is no way to use the xPath functions in import configs.

Following method and its usages could be adjusted to return and use besides the DOMNodeList the string value:

public function selectNodeWithXpath(\DOMXPath $xPathObject, string $xPath, ?\DOMNode $context = null): \DOMNodeList
{
$resultNodes = $xPathObject->evaluate($xPath, $context);
if ($resultNodes->length > 0) {
return $resultNodes;
}
throw new \Exception(
'No node found with xPath: ' . $xPath,
1399497464
);
}

This will allow composite-identities in configs:

'composite_uid' => [
            'external' => [
                'index_a' => [
                    'xpath' => 'concat(../@parents_element_uid_attr, ":", @child_element_uid_attr)',
                ],
            ],
        ],

Beside of that there is cool feature on core PHP, which could be fine on that extension: https://www.php.net/manual/en/domxpath.registerphpfunctions.php


@fsuter @COBWEB
I patched the EXT:external_import minimal(there is a little bit more requiered for full support by EXT:external_import) in my project, would you like to extend the code if I push it and create a pull-request?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions