diff --git a/src/Xml2Array.php b/src/Xml2Array.php index 5663867..ce36f25 100644 --- a/src/Xml2Array.php +++ b/src/Xml2Array.php @@ -268,7 +268,7 @@ protected function parseChildNodes(DOMNode $node, $output) $output = $value; } } - } else { + } elseif ($child->nodeType !== XML_COMMENT_NODE) { $nodeName = $child->nodeName; if (!isset($output[$nodeName])) { @@ -367,7 +367,9 @@ protected function collectAttributes(DOMNode $node, $output) } } - $output[$this->config['attributesKey']] = array_merge($attributes, $namespaces); + foreach (array_merge($attributes, $namespaces) as $key => $value) { + $output[$this->config['attributesKey']][$key] = $value; + } return $output; }