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;
    }