From: David Alan Black Date: 2001-09-29T23:23:57+09:00 Subject: [ruby-talk:21822] Re: ANN: HtmlDomGenerator 0.1 Hello -- On Sat, 29 Sep 2001, Jimmy Thrasher wrote: > I just released HtmlDomGenerator, for those of you who want a DOM > generated from an HTML file. See the RAA for details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA No GPL to be found :-) I have a couple o' questions/comments based on your RAA description. (Isn't that sneaky of me?) > Description: The HtmlDomGenerator parses an HTML file (SGML, really) > into a DOM, which can then be easily manipulated programmatically. > Currently it works quite nicely for well-formed HTML, and can handle > some malformations (e.g. interleaved tags: stuffo doesn't do much else than parse it into the tree structure, but > that'll change soon enough. 1. It's not clear (to me) what you mean by "a DOM". Are you planning to implement the DOM API? Or more of a home-grown tree-based interface? (In which case you'd be best off avoiding the term "DOM".) 2. If this is a general SGML and/or XML tool, I wouldn't use "HTML" in the name. 3. "Well-formed HTML" is sort of a contradiction in terms, or at least redundant. HTML has a DTD; therefore, HTML documents are either valid (and, incidentally, well-formed) or invalid. If a document is well-formed but not valid HTML, then it isn't HTML. (I guess there's such a thing these days as "well-formed [DTD-less] SGML", though I think that only exists as a way to make sure that all XML documents are also SGML documents.) 4. I'm not sure what "handling" interleaved tags would entail, other than dying with a fatal error :-) 5. You might get some mileage out of existing Ruby tools in this area, including Jim Menard's NQXML, which has a tree parser. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav