From: David Alan Black Date: 2001-12-16T01:55:46+09:00 Subject: [ruby-talk:28629] Re: DTD Parsers in Ruby? Hello -- On Sun, 16 Dec 2001, Sean Russell wrote: > Technically, aren't all XML documents also well-formed SGML documents? > This can't be said of DTDs. So I'd say that XML isn't a hack, but a > dailect. DTDs are a hack... you can't parse a DTD with code that parses > SGML. I'm not sure how the word "hack" got into the picture here, but anyway.... A DTD is to the body of an SGML document (the "document instance") as, say, a regular expression is to a string. Also, the DTD is part of the SGML document, by reference and/or by physically being included. So in SGML, I don't think the idea of parsing a DTD as if it *were* an SGML document (in which case it would have its own DTD, and so on...) has any currency. Or maybe that's why someone decided to create XML :-) > > Special processing, yes, but not inordinately complex, I think, in > > relation to the payoff (validation). (Easy for me to say, since I've > > written about 10 lines of a processor.) Also, at least in the case of > > SGML, it's not really "additional", since every SGML document conforms > > to a DTD (i.e., that's what the whole thing is about). > > I wasn't saying that validation is bad; I was making the case that there > are better ways to support validation, such as XMLSchema, which uses the > same syntax as the documents which it describes, and therefore doesn't > require any special parsing code. > > Ob-Ruby: this is even more of an issue in Ruby, where the parsers are > small. Requiring an extra parser to support DTDs can easily add 50% to > your codebase. Well, we'll have to agree to disagree about the "extra" part :-) And before I say anything like, "But people who are looking at XML support in Ruby aren't going to want to hear language-specific reasons like that," I'd better do a little more work on my vaporware parser :-) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav