DAT-2824 Fix warnings when node has no child nodes

This commit is contained in:
marzjan 2015-05-19 12:35:50 +00:00
parent f8bcf4f2a8
commit 025bd86a12

View file

@ -28,10 +28,14 @@ class SimpleXmlUtil {
public function getInnerXML( $node ) {
$innerXML = '';
if ( $node instanceof \SimpleXMLElement ) {
foreach ( dom_import_simplexml( $node )->childNodes as $child ) {
$domDocument = dom_import_simplexml( $node );
if ( $domDocument->childNodes->length ) {
foreach ( $domDocument->childNodes as $child ) {
$innerXML .= $child->ownerDocument->saveXML( $child );
}
}
}
return $innerXML;
}
}