RDF::RDFa::Generator question
Gregory Williams
greg at evilfunhouse.com
Tue Jun 22 18:23:43 CEST 2010
On Jun 22, 2010, at 3:45 AM, Toby Inkster wrote:
> Without being able to see what load_html does, I'm guessing it handles
> namespaces differently to how RDF::RDFa::Generator expects them.
> Assuming that $dom is your DOM document, what does the following output?
>
> print $dom->documentElement->namespaceURI;
>
> Should be 'http://www.w3.org/1999/xhtml', though I'm guessing it's
> something else, perhaps undef.
undef when using load_html.
> You could try using HTML::HTML5::Parser to parse the HTML.
>
> use HTML::HTML5::Parser;
> my $dom = HTML::HTML5::Parser->new->parse_string($html);
>
> Perhaps also of interest is HTML::HTML5::Writer, which outputs HTML
> from a DOM. Using XML::LibXML's built-in toString methods is probably
> not safe if you're intending to send the data as 'text/html'.
Ah, great. That seems to work much more nicely.
.greg
More information about the Dev
mailing list