Re: Questionable DTD for "form" tag
Gerd Stolpmann <[email protected]> Sat, 22 Jan 2005 12:06:44 +0100
| Newsgroups | gmane.comp.lang.ocaml.lib.net.devel |
|---|---|
| Message-ID | <[email protected]> |
Am Freitag, den 21.01.2005, 17:59 -0800 schrieb Karl Zilles: > Hi, > > I've used ocamlnet for a few project, and I like the code. > > I have been using nethtml lately to parse an html page with a form, and > I noticed that it never seemed to correctly parse the form element in my > html pages. I traced this back to the DTD: > > "form", (`Block, `Sub_exclusions( ["form"], > `Block |. `Elements ["script"])); > > So this says that <form> elements are only allowed to contain block and > <script> elements. > > This makes no sense to me.. for example, the <input> tag is an inline > element: > > "input", (`Inline, `Empty); > > The result is that the form element doesn't contain the sub-elements > that it should. > > perhaps, > > "form", (`Block, `Sub_exclusions( ["form"], `Flow ) ); > > would make more sense? Absolutely. This is clearly an error. There are two DTDs for HTML, one called the strict DTD and one called the transitional DTD. Obviously, this FORM definition was taken from the strict DTD, although the documentation of Nethtml says it implements the transitional DTD. In the strict DTD, one must put a container into FORM to comply with the standard, e.g. <FORM><P>....<INPUT>...</FORM>. This is not necessary in the transitional DTD which is the type of DTD actually used in the WWW. I have checked in the change. There is a similar error for BLOCKQUOTE. Gerd -- ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany [email protected] http://www.gerd-stolpmann.de ------------------------------------------------------------ ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl