public function toXML($data)
    {
        $root = isset($data['root']) ? $data['root'] : $this->module;
        $no = 1;
        $xml = '<'.$root.'>';
        if (isset($data['options'])) {
            $xml .= '<row no="'.$no.'">';
            foreach ($data['options'] as $key => $value) {
                $xml .= '<option val="'.$key.'">'.$value.'</option>';
            }
            $xml .= '</row>';
            ++$no;
        }
        foreach ($data['records'] as $row) {
            $xml .= '<row no="'.$no.'">';
            foreach ($row as $key => $value) {
                if (is_array($value)) {
                    $xml .= '<FL val="'.str_replace('&', 'and', $key).'">';
                    foreach ($value as $k => $v) {
                        list($tag, $attribute) = explode(' ', $k);
                        $xml .= '<'.$tag.' no="'.$attribute.'">';
                        foreach ($v as $kk => $vv) {
                            $xml .= '<FL val="'.str_replace('&', 'and', $kk).'"><![CDATA['.$vv.']]></FL>';
                        }
                        $xml .= '</'.$tag.'>';
                    }
                    $xml .= '</FL>';
                } else {
                    $xml .= '<FL val="'.str_replace('&', 'and', $key).'"><![CDATA['.$value.']]></FL>';
                }
            }
            $xml .= '</row>';
            ++$no;
        }
        $xml .= '</'.$root.'>';

        return $xml;
    }
public function toXML($data)
    {
        $root = isset($data['root']) ? $data['root'] : $this->module;
        $no = 1;
        $xml = '<'.$root.'>';
        if (isset($data['options'])) {
            $xml .= '<row no="'.$no.'">';
            foreach ($data['options'] as $key => $value) {
                $xml .= '<option val="'.$key.'">'.$value.'</option>';
            }
            $xml .= '</row>';
            ++$no;
        }
        foreach ($data['records'] as $row) {
            $xml .= '<row no="'.$no.'">';
            foreach ($row as $key => $value) {
                if (is_array($value)) {
                    $xml .= '<FL val="'.str_replace('&', 'and', $key).'">';
                    foreach ($value as $k => $v) {
                        list($tag, $attribute) = explode(' ', $k);
                        $xml .= '<'.$tag.' no="'.$attribute.'">';
                        foreach ($v as $kk => $vv) {
                            $xml .= '<FL val="'.str_replace('&', 'and', $kk).'"><![CDATA['.$vv.']]></FL>';
                        }
                        $xml .= '</'.$tag.'>';
                    }
                    $xml .= '</FL>';
                } else {
                    $xml .= '<FL val="'.str_replace('&', 'and', $key).'"><![CDATA['.$value.']]></FL>';
                }
            }
            $xml .= '</row>';
            ++$no;
        }
        $xml .= '</'.$root.'>';

        return $xml;
    }
public function toXML ( $ data ) { $ root = isset ( $ data [ 'root' ] ) ? $ data [ 'root' ] : $ this -> module ; $ no = 1 ; $ xml = '<' . $ root . '>' ; if ( isset ( $ data [ 'options' ] ) ) { $ xml .= '<row no="' . $ no . '">' ; foreach ( $ data [ 'options' ] as $ key => $ value ) { $ xml .= '<option val="' . $ key . '">' . $ value . '</option>' ; } $ xml .= '</row>' ; ++ $ no ; } foreach ( $ data [ 'records' ] as $ row ) { $ xml .= '<row no="' . $ no . '">' ; foreach ( $ row as $ key => $ value ) { if ( is_array ( $ value ) ) { $ xml .= '<FL val="' . str_replace ( '&' , 'and' , $ key ) . '">' ; foreach ( $ value as $ k => $ v ) { list ( $ tag , $ attribute ) = explode ( ' ' , $ k ) ; $ xml .= '<' . $ tag . ' no="' . $ attribute . '">' ; foreach ( $ v as $ kk => $ vv ) { $ xml .= '<FL val="' . str_replace ( '&' , 'and' , $ kk ) . '"><![CDATA[' . $ vv . ']]></FL>' ; } $ xml .= '</' . $ tag . '>' ; } $ xml .= '</FL>' ; } else { $ xml .= '<FL val="' . str_replace ( '&' , 'and' , $ key ) . '"><![CDATA[' . $ value . ']]></FL>' ; } } $ xml .= '</row>' ; ++ $ no ; } $ xml .= '</' . $ root . '>' ; return $ xml ; }
Convert from array to XML

@param array $data Data to convert

@return XML
Convert from array to XML