xml - PHP DOM with namespace - parsing custom tags in a HTML template -
my goal create custom templating system html documents in php. i'm using domdocument, i'm having trouble getting recognize custom namespace special tags want introduce.
the beginning of test script looks this:
$document = new domdocument(); $document->loadhtml(' <div> <example:content /> </div>', libxml_html_noimplied); $elements = $document->getelementsbytagnamens('example', 'content');
when run following warning. don't mind suppressing if can namespace work.
warning: domdocument::loadhtml(): tag example:content invalid in entity, line: 3 in /users/ryanwilliams/sites/test xml/test.php on line 8
when var_dump
$elements
following output (it found no results).
object(domnodelist)#2 (1) { ["length"]=> int(0) }
when echo
parsed template following results. note stripped out namespace.
<!doctype html public "-//w3c//dtd html 4.0 transitional//en" "http://www.w3.org/tr/rec-html40/loose.dtd"> <div> <content></content> </div>
anyone know need recognize namespace element?
Comments
Post a Comment