Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error in DOMDocument::loadXML

I am getting the below error:-

Strict Standards: Non-static method DOMDocument::loadXML() should not be called statically

in below line

$xml_handle = DOMDocument::loadXML($xml_datas, LIBXML_NOENT 
 | LIBXML_XINCLUDE | LIBXML_NOERROR | LIBXML_NOWARNING);

from below code:-

while(($xml_index = $zip_handle->locateName("ppt/slides/slide".$slide_number.".xml")) !== false){
            $xml_datas = $zip_handle->getFromIndex($xml_index);
            //die("here ====".$slide_number.$xml_datas);
            $xml_handle = DOMDocument::loadXML($xml_datas, LIBXML_NOENT | LIBXML_XINCLUDE | LIBXML_NOERROR | LIBXML_NOWARNING);
            //print_r($xml_handle);die($xml_handle);
            $output_text.= strip_tags($xml_handle->saveXML() );
            $slide_number++;
        }

Any help is appreciated...

like image 835
Ripa Saha Avatar asked Mar 26 '26 13:03

Ripa Saha


1 Answers

Using Strict Standards, you should instantiate DOMDocument instead of calling loadXML statically:

$xml_handle = new DOMDocument();
$xml_handle->loadXML($xml_datas, LIBXML_NOENT | LIBXML_XINCLUDE | LIBXML_NOERROR | LIBXML_NOWARNING);

This will eliminate the error.

like image 183
MrCode Avatar answered Mar 29 '26 03:03

MrCode