Skip to content
Snippets Groups Projects
Commit bec3f3ef authored by Adam Bramley's avatar Adam Bramley Committed by Mike Ryan
Browse files

Issue #2792765 by acbramley: Allow XML elements to pass through as field values to process plugins

parent 49a10187
No related branches found
No related tags found
No related merge requests found
......@@ -239,7 +239,15 @@ class Xml extends DataParserPluginBase {
$values = $target_element->xpath($xpath);
}
foreach ($values as $value) {
$this->currentItem[$field_name][] = (string) $value;
// If the SimpleXMLElement doesn't render to a string of any sort,
// and has children then return the whole object for the process
// plugin or other row manipulation.
if ($value->children() && !trim((string) $value)) {
$this->currentItem[$field_name] = $value;
}
else {
$this->currentItem[$field_name][] = (string) $value;
}
}
}
// Reduce single-value results to scalars.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment