<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
...
...
I get this error:
** exception error: no function clause matching
mochiweb_html:tokenize_attributes(<<"<!DOCTYPE html PUBLIC \"-//W3C//DTD
XHTML 1.0 Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitio"...>>,
{whitespace," ",{decoder,31,16,3235}},
[{<<"type">>,error}])
in function mochiweb_html:tokenize/2
in call from mochiweb_html:tokens/3
in call from mochiweb_html:parse/1
However, it feeding it pages such as http://google.com/ or some other
pages it works. I also tested with http://uk.yahoo.com/?p=us and this
generates a similar error. Is there an easy way to fix this?
Would I be right in guessing that it's the "<!" throwing it?
Jeff.
That's not the right guess, because it's supposed to support <!DOCTYPE
-- you can see it in some of the tests.
I'm looking into it now.
-bob
It turns out that it's because there is a script tag with an
extraneous whitespace character in the attribute (at least the
wikipedia example that you gave)
<script type= "text/javascript">
If that space is eliminated, the current parser has no problem with
that page. It shouldn't be hard to write a test for and fix this.
1> mochiweb_html:parse("<script type=\"text/javascript\"></script>").
{<<"script">>,[{<<"type">>,<<"text/javascript">>}],[<<>>]}
2> mochiweb_html:parse("<script type= \"text/javascript\"></script>").
** exception error: no function clause matching
mochiweb_html:tokenize_attributes(<<"<script type=
\"text/javascript\"></script>">>,
{whitespace," ",
{decoder,1,14,13}},
[{<<"type">>,error}])
in function mochiweb_html:tokenize/2
in call from mochiweb_html:tokens/3
in call from mochiweb_html:parse/1
-bob
Bob Ippolito wrote:
> Fixed in http://code.google.com/p/mochiweb/source/detail?r=101
>
>
>
Yeap. That fixes it. I actually discovered this while using
mochiweb_html from mochixpath. Can you fold this new version of
mochiweb_html into mochixpath for future users of that package?
Thanks,
Jeff.
mochixpath isn't part of our source tree, someone else wrote that.
-bob