Re: unexpected nethtml parsing behavior
Gerd Stolpmann <[email protected]> Mon, 12 May 2014 21:24:03 +0200
| Newsgroups | gmane.comp.lang.ocaml.lib.net.devel |
|---|---|
| Message-ID | <1399922643.3512.34.camel@e130> |
Am Donnerstag, den 08.05.2014, 20:00 -0400 schrieb Ashish Agarwal:
> utop # let parse s =
> Netchannels.with_in_obj_channel
> (new Netchannels.input_string s)
> Nethtml.parse
> ;;
> val parse : string -> Nethtml.document list = <fun>
>
>
> utop # parse "<div><li></li></div>";;
> - : Nethtml.document list = [Nethtml.Element ("div", [], []);
> Nethtml.Element ("li", [], [])]
>
>
>
>
> The list item isn't a child of the div. I appreciate the html is
> ill-formed, but does Nethtml check for such things?
There is a dtd object you can pass to the parser that specifies such
details. If an element isn't allowed as a child of another element, the
behavior is that the parents are closed until the new element can be
inserted. Of course, this isn't the only resolution of the problem, e.g.
you could also magically add an ul or ol element. So far I know,
however, it has never been specified how to resolve bad HTML.
Gerd
>
>
> ------------------------------------------------------------------------------
> Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
> • 3 signs your SCM is hindering your productivity
> • Requirements for releasing software faster
> • Expert tips and advice for migrating your SCM now
> http://p.sf.net/sfu/perforce
> _______________________________________________
> Ocamlnet-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel
--
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany [email protected]
My OCaml site: http://www.camlcity.org
Contact details: http://www.camlcity.org/contact.html
Company homepage: http://www.gerd-stolpmann.de
------------------------------------------------------------
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs