private static function exportDocumentViewRecursive(NodeInterface $node, NamespaceRegistryInterface $ns, $stream, $skipBinary, $noRecurse, $root = false)
{
$nodename = self::escapeXmlName($node->getName());
fwrite($stream, "<{$nodename}");
if ($root) {
self::exportNamespaceDeclarations($ns, $stream);
}
foreach ($node->getProperties() as $name => $property) {
/** @var $property \PHPCR\PropertyInterface */
if ($property->isMultiple()) {
// skip multiple properties. jackrabbit does this too. cheap but whatever. use system view for a complete export
continue;
}
if (PropertyType::BINARY === $property->getType()) {
if ($skipBinary) {
continue;
}
$value = base64_encode($property->getString());
} else {
$value = htmlspecialchars($property->getString());
}
fwrite($stream, ' ' . self::escapeXmlName($name) . '="' . $value . '"');
}
if ($noRecurse || !$node->hasNodes()) {
fwrite($stream, '/>');
} else {
fwrite($stream, '>');
foreach ($node as $child) {
if (!($child->getDepth() === 1 && NodeHelper::isSystemItem($child))) {
self::exportDocumentViewRecursive($child, $ns, $stream, $skipBinary, $noRecurse);
}
}
fwrite($stream, "</{$nodename}>");
}
}