Example #1
0
 /**
  * Parses ais html into DOM.
  *
  * @param Trace $trace
  * @param string $html
  *
  * @returns DOMDocument parsed DOM
  * @throws ParseException on failure
  */
 public static function createDomFromHtml(Trace $trace, $html)
 {
     Preconditions::checkIsString($html);
     $dom = new DOMDocument();
     $trace->tlog("Loading html to DOM");
     $loaded = @$dom->loadHTML($html);
     if (!$loaded) {
         throw new ParseException("Problem parsing html to DOM.");
     }
     $trace->tlog('Fixing id attributes in the DOM');
     ParserUtils::fixIdAttributes($trace, $dom);
     return $dom;
 }