/** * Recursively convert \SimpleXMLIterator to array * * @param \SimpleXMLIterator $XMLNode * * @return array */ private static function _XMLNodeToArray($XMLNode) { $result = array(); $attributes = $XMLNode->attributes(); foreach ($attributes as $k => $v) { $val = (string) $v; if ($val == "True" || $val == "False") { $val = (bool) $val; } $result[$k] = $val; } $children = $XMLNode->children(); foreach ($children as $chK => $chNode) { $result['Items'][] = self::_XMLNodeToArray($chNode); } return $result; }