%s'; /** * Get DOM object from file/string. * * @param string $input * @param string $mode * @return Document */ public function create($input, $mode = 'html') { // is file ? if (substr(trim($input), 0, 1) != '<' && file_exists($input) && is_file($input)) { $input = file_get_contents($input); } // create object $dom = new Document; // load xml/html if ($mode == 'xml') { $dom->loadXML($input); } else { // set doctype if (strpos($input, 'loadHTML($input); } return $dom; } }