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,8 +28,12 @@ class SimpleXmlUtil {
public function getInnerXML( $node ) {
$innerXML = '';
if ( $node instanceof \SimpleXMLElement ) {
foreach ( dom_import_simplexml( $node )->childNodes as $child ) {
$innerXML .= $child->ownerDocument->saveXML( $child );
$domDocument = dom_import_simplexml( $node );
if ( $domDocument->childNodes->length ) {
foreach ( $domDocument->childNodes as $child ) {
$innerXML .= $child->ownerDocument->saveXML( $child );
}
}
}
return $innerXML;