harikrish
harikrish

Reputation: 2019

parsing xml using cakephp Xml::build

i an following this article from cookbook. http://book.cakephp.org/2.0/en/core-utility-libraries/xml.html#Xml::build

$xmlpath   =     WWW_ROOT.'files/xml/'.$xmldetails['Xml']['xml_url'];
        App::uses('Xml', 'Utility'); 
        if(file_exists($xmlpath)){
            $parsed_xml = Xml::build($xmlpath, array('return' => 'simplexml'));
            pr($parsed_xml);
            die();
        }

this is the code that i write in the controller's method. I get

Fatal error: Call to undefined method Xml::build() 

i am not sure y i get this.

any idea?

Upvotes: 1

Views: 1511

Answers (1)

dogmatic69
dogmatic69

Reputation: 7575

Looking at your data you have $xmldetails['Xml'] which I assume is a model. If this is the case you have already imported a class called Xml so cake will not import another.

If you want to use cakes Xml class, you can not have a model called Xml.

Upvotes: 2

Related Questions