public function XMLContent::resolve in GraphQL 8.4
Returns the XML content as string.
Parameters
\DOMElement $dom: The source (root) DOM element.
Return value
string
File
- src/
Plugin/ GraphQL/ DataProducer/ XML/ XMLContent.php, line 34
Class
- XMLContent
- XML child nodes content data producer.
Namespace
Drupal\graphql\Plugin\GraphQL\DataProducer\XMLCode
public function resolve(\DOMElement $dom) {
return implode('', array_map(function ($child) {
if ($child instanceof \DOMText) {
return $child->nodeValue;
}
elseif ($child instanceof \DOMElement) {
return $child->ownerDocument
->saveXML($child);
}
}, iterator_to_array($dom->childNodes)));
}