private function _load($source, $charset = "", $mimetype = "")
    {
        // loads the contents
        $content = null;
        if ($this->_isURL($source)) {
            list($content, $charset, $mimetype) = $this->_loadUrl(
                $source, $charset, $mimetype
            );
        } elseif (!is_file($source)) {
            $content = $source;
        }

        if (strlen($charset) == 0) {
            $charset = "iso-8859-1";
        }

        // creates a new XML document
        $doc = new DOMDocument("1.0", $charset);
        $doc->preserveWhiteSpace = false;
        $doc->formatOutput = true;

        // loads a string, a file or a URL
        if ($content != null) {
            if ($mimetype == "text/html") {
                $doc->loadHTML($content);
            } else {
                $doc->loadXML($content);
            }
        } else {
            if ($mimetype == "text/html") {
                $doc->loadHTMLFile($source);
            } else {
                $doc->load($source);
            }
        }

        $this->_node = $doc->documentElement;
    }
private function _load($source, $charset = "", $mimetype = "")
    {
        // loads the contents
        $content = null;
        if ($this->_isURL($source)) {
            list($content, $charset, $mimetype) = $this->_loadUrl(
                $source, $charset, $mimetype
            );
        } elseif (!is_file($source)) {
            $content = $source;
        }

        if (strlen($charset) == 0) {
            $charset = "iso-8859-1";
        }

        // creates a new XML document
        $doc = new DOMDocument("1.0", $charset);
        $doc->preserveWhiteSpace = false;
        $doc->formatOutput = true;

        // loads a string, a file or a URL
        if ($content != null) {
            if ($mimetype == "text/html") {
                $doc->loadHTML($content);
            } else {
                $doc->loadXML($content);
            }
        } else {
            if ($mimetype == "text/html") {
                $doc->loadHTMLFile($source);
            } else {
                $doc->load($source);
            }
        }

        $this->_node = $doc->documentElement;
    }
private function _load ( $ source , $ charset = "" , $ mimetype = "" ) { // loads the contents $ content = null ; if ( $ this -> _isURL ( $ source ) ) { list ( $ content , $ charset , $ mimetype ) = $ this -> _loadUrl ( $ source , $ charset , $ mimetype ) ; } elseif ( ! is_file ( $ source ) ) { $ content = $ source ; } if ( strlen ( $ charset ) == 0 ) { $ charset = "iso-8859-1" ; } // creates a new XML document $ doc = new DOMDocument ( "1.0" , $ charset ) ; $ doc -> preserveWhiteSpace = false ; $ doc -> formatOutput = true ; // loads a string, a file or a URL if ( $ content != null ) { if ( $ mimetype == "text/html" ) { $ doc -> loadHTML ( $ content ) ; } else { $ doc -> loadXML ( $ content ) ; } } else { if ( $ mimetype == "text/html" ) { $ doc -> loadHTMLFile ( $ source ) ; } else { $ doc -> load ( $ source ) ; } } $ this -> _node = $ doc -> documentElement ; }
Loads an XML or HTML document.

<p>This function loads an XML or HTML document from a filename, url or
string.</p>

@param string $source   A filename or a URL
@param string $charset  Charset, autodetected (default is "")
@param string $mimetype Mime-type, autodetected (default is "")

@return void
Loads an XML or HTML document .