[racket] Fwd: read-xml: lex-error when reading Javascript
Alegria Baquero wrote at 04/25/2014 04:01 PM:
>
> It turns out it believes the operator '<' is an opening xml tag.
You're using an XML parser, but HTML is not necessarily XML. You could
try to get the file past the XML parser by wrapping the JavaScript parts
as per "http://en.wikipedia.org/wiki/CDATA". If you still have trouble
after that, you can also convert your HTML to XHTML (which line of
development is abandoned by the W3C, in favor of the HTML5 school of
thought, but you can still use XHTML), and get it to run through an
XHTML or XML validator.
If you instead want to try a Racket-syntax-based HTML templating, see
"http://www.neilvandyke.org/racket-html-template/". I also started
working on a package to make this work more efficiently with the Racket
Web Server, "http://www.neilvandyke.org/racket-web-server-xexp/",
although I've abandoned the "web-server-xexp" work in favor of other
serving approaches, so don't expect updates on that particular package.
BTW, for parsing HTML, you want to use a specialized HTML parser. My old
one is currently available as
"http://www.neilvandyke.org/racket-html-parsing/". Note that it outputs
the SXML format, which is a little different than the "xexpr" format.
(I previously tried to unify these two formats, then discarded that
work, since SXML is simply better in some important ways than either
"xexpr" or the unified thing I came up with. I'm currently trying to
get a couple new features added to the SXML standard, to make it even
better for HTML.)
Neil V.