in reply to Re^6: Match text from txt to html
in thread Match text from txt to html
A few years ago, I tried to parse HTML (not XHTML, which is XML) from an older site with XML::XPath and it blew up rather impressively. The Web pages I was trying to parse were absolutely not valid XML and I decided to just use HTML::Parser and analyze the parse event stream rather than try to massage the HTML into something resembling XML. Which was annoying, because XPath queries would have made my code much cleaner.
HTML::Parser seems to be far more tolerant of ... stuff ... in its input. I suggested it here because the input is HTML (not XHTML) and the problem does not care about the larger document structure, so a sliding window on the low-level parse events is sufficient. Potentially, this could even deliver better latency, if the problem is or can be a "live" transformation.
Thanks for the link; that is an interesting node. The first thing I thought was "XHTML? So it is guaranteed to be valid XML?" and my first attempt at a solution would probably use XML::XPath.
|
|---|