protected function insertIntegerXml($parent, $k, $v, $fn)
{
// The user has passed an XML document instance:
// [ '<tag></tag>', DOMNode, SimpleXMLElement, FluidXml ]
$wrapper = new \DOMDocument();
$wrapper->formatOutput = true;
$wrapper->preserveWhiteSpace = false;
$v = \ltrim($v);
if ($v[1] === '?') {
$wrapper->loadXML($v);
$nodes = $wrapper->childNodes;
} else {
// A way to import strings with multiple root nodes.
$wrapper->loadXML("<root>{$v}</root>");
// Algorithm 1:
$nodes = $wrapper->documentElement->childNodes;
// Algorithm 2:
// $xp = new \DOMXPath($wrapper);
// $nodes = $xp->query('/root/*');
}
return $this->attachNodes($parent, $nodes, $fn);
}