From: Mark Hubbart Date: 2004-04-02T03:15:09+09:00 Subject: Re: HTML parsing by REXML On Apr 1, 2004, at 9:14 AM, Dario Linsky wrote: > Hi, > > On Fri, 02 Apr 2004 00:58:24 +0900, Paul Argentoff wrote: >> Sorry for returning to sorta well-discussed (but not in a sense I >> need) >> topic. >> I can't parse xml files by rexml since some tags in html are open >> (such as >> , etc). Document.new errors with a message about such a tag. > Do I understand your problem right, that REXML gives you an Exception > because you did not close a tag? If so, a possible solution would be to > use XHTML instead of normal HTML. to expand on this: html is not xml. xhtml *is* xml. in html, you can have unclosed tags that look like this: but in xhtml, the tag has to close itself: xhtml does this to be compatible with xml, which it is based on. If you have a bunch of regular html files that you need to parse, I would suggest running them through "HTML Tidy", which can convert them to well-formed xhtml for you. You should then be able to parse them with REXML. See http://tidy.sourgeforge.net/ --Mark