[Webtest] disable balance-tags in neko
Lothar Märkle
webtest@lists.canoo.com
Fri, 10 Jun 2005 00:51:37 +0200
Hi Marc,
thanks for grepping your mails for the patch.
Since I plan to implement some custom
webtest steps, this could be a good point to start with.
lothar
On Thu, Jun 09, 2005 at 07:25:57PM +0200, Marc Guillemot wrote:
> I've had the same problem working on an application that generated some
> custom tags producing incorrect html. The solution is not to disable tag
> balancing (it's not a tag balancing issue) but to change the configuration
> about which tags should be present in which part of the tree. I've mailed
> Neko's author for some months and got an answer from him on this point (see
> below). You will have to build your own fixed version of the parser to
> benefit of this improvement because no new version of Neko has been
> released since this date.
>
> From Andy Clark's email:
> ---------------
> To make the fix yourself, edit the HTMLElements class and
> change the following line:
>
> public static final Element NO_SUCH_ELEMENT = new Element((short)-1, "",
> 0, BODY, null);
>
> to the following:
>
> public static final Element NO_SUCH_ELEMENT = new Element(XMP+1, "", 0,
> new short[]{HEAD,BODY}, null);
>
> and rebuild the Jar file.
> ---------------
>
> Marc.
>
> Lothar Märkle wrote:
> >On Thu, Jun 09, 2005 at 06:23:53PM +0200, Marc Guillemot wrote:
> >
> >>I don't see any (simple) way to to that. I don't fully understand what
> >>you
> >
> >that means, this is hardcoded and is part of htmlunit anyway.
> >
> >
> >>expect: htmlunit needs a well structured xml tree to work on.
> >
> >the tested application(a cms) inserts custom tags for a explorer toolbar
> >in the wrong place:
> ><html>
> > <head>
> > <meta ...>
> > <imp:session.../>
> > <title>title</title>
> > </head>
> > <body>
> >this causes neko to insert a body tag bevor the <imp/> and the title is
> >then unset and verifyTitle breaks.
> >
> >...when i look at the above, I think it's better work around that and
> >take the benefit of the auto-corrections(since this is only the head of
> >the page i think there is more to come:) as mentioned in the
> >white-paper.
> >
> >lothar
> >
> >
> >
> >
> >>Lothar Märkle wrote:
> >>
> >>>hi,
> >>>
> >>>I recognized that neko is used for html parsing and that it inserts
> >>>missing tags and corrects the html. But this causes problems in my
> >>>tests.
> >>>
> >>>The neko page stats, that the balance-tags is optional, and i'm looking
> >>>for a way to turn it off.
> >>>
> >>>Is this a runtime option in webtest? Or another way to control this
> >>>feature?
> >
> >_______________________________________________
> >WebTest mailing list
> >WebTest@lists.canoo.com
> >http://lists.canoo.com/mailman/listinfo/webtest
> >
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
--
Lothar Märkle - lothar.maerkle@netpioneer.de
Netpioneer GmbH - Beiertheimer Allee 18a - D-76137 Karlsruhe
Tel: 0721 / 9 20 60 43
Fax: 0721 / 9 20 60 30