php - Should I use DomDocument for parsing html code -
i have tried best answer question myself through research still little bit worried whether using right thing. using domdocument library build jquery theme parser framework. web today html coming in different shapes , sizes e.g html 4, html 5, xhtml, xhtml 5 etc ... issue finding domdocument if give html code work if standards compliant xhtml. know can convert xhtml , can use tidy library make code acceptable main worry is: if developer using framework has theme uses cool(debatable) new html 5 features, passes framework either throw tantrum or convert down xhtml suck.
so question is: domdocument convenient library need?
or
is there way of getting work different variants of html?
domdocument can parse non-xhtml files. set proper switches:
libxml_use_internal_errors ( true ); $dom = new domdocument; $dom -> formatoutput = true; $dom -> substituteentities = false; $dom -> recover = true; $dom -> stricterrorchecking = false;
Comments
Post a Comment