protected function convertXmlToArray($xml)
    {
        if (is_string($xml)) {
            $xml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
        }
        $result = (array) $xml;
        foreach ($result as $key => $value) {
            if (!is_scalar($value)) {
                $result[$key] = $this->convertXmlToArray($value);
            }
        }
        return $result;
    }
protected function convertXmlToArray($xml)
    {
        if (is_string($xml)) {
            $xml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
        }
        $result = (array) $xml;
        foreach ($result as $key => $value) {
            if (!is_scalar($value)) {
                $result[$key] = $this->convertXmlToArray($value);
            }
        }
        return $result;
    }
protected function convertXmlToArray ( $ xml ) { if ( is_string ( $ xml ) ) { $ xml = simplexml_load_string ( $ xml , 'SimpleXMLElement' , LIBXML_NOCDATA ) ; } $ result = ( array ) $ xml ; foreach ( $ result as $ key => $ value ) { if ( ! is_scalar ( $ value ) ) { $ result [ $ key ] = $ this -> convertXmlToArray ( $ value ) ; } } return $ result ; }
Converts XML document to array.
@param string|\SimpleXMLElement $xml xml to process.
@return array XML array representation.
Converts XML document to array .