Added MicrodataDOMDocument
This is for both gaining flexibility and made code cleaner.
This commit is contained in:
@ -6,7 +6,7 @@ abstract class Microdata
|
||||
{
|
||||
public static function fromHTML($html, $documentURI = '')
|
||||
{
|
||||
$dom = new \DOMDocument;
|
||||
$dom = new MicrodataDOMDocument;
|
||||
$dom->loadHTML($html, LIBXML_NOERROR);
|
||||
$dom->documentURI = $documentURI;
|
||||
|
||||
@ -15,15 +15,19 @@ abstract class Microdata
|
||||
|
||||
public static function fromHTMLFile($filename, $documentURI = '')
|
||||
{
|
||||
$dom = new \DOMDocument;
|
||||
$dom = new MicrodataDOMDocument;
|
||||
$dom->loadHTMLFile($filename);
|
||||
$dom->documentURI = $documentURI;
|
||||
|
||||
return new MicrodataParser($dom);
|
||||
}
|
||||
|
||||
public static function fromDOMDocument(\DOMDocument $dom)
|
||||
public static function fromDOMDocument(\DOMDocument $domDocument)
|
||||
{
|
||||
$dom = new MicrodataDOMDocument;
|
||||
$importedNode = $dom->importNode($domDocument->documentElement, true);
|
||||
$dom->appendChild($importedNode);
|
||||
|
||||
return new MicrodataParser($dom);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user