Reputation: 467
Using
$html = '<br /><p>k</p>';
libxml_use_internal_errors(true);
$dom = New DOMDocument();
$dom -> loadXML($correo_elhtml);
echo '<pre>';
if(empty(libxml_get_errors())){
echo "This is a good HTML";
}
else {
echo "This not html";
print_r(libxml_get_errors());
}
return ERROR, however that is a valid XHTML STRING.
Some function please?
Upvotes: 0
Views: 182
Reputation: 2285
This code is a correct HTML but is NOT correct as XML, because empty-element tag, such as <br />
in XML must used only between <section></section>
So you can use $dom -> loadHTML($html);
or remove <be />
from your HTML and then use $dom -> loadXML($html);
Upvotes: 1