Re: Problem with implementation of getChildNodes on HTMLFormElement?

Jacob Kjome <[email protected]> Fri, 12 Sep 2003 14:11:05 -0500
Newsgroups gmane.comp.java.enhydra.xmlc
Message-ID <[email protected]>
Hi Petr,

At 07:06 PM 9/12/2003 +0200, you wrote:
>V St, 10. 09. 2003 v 22:53, Jacob Kjome pí¹e:
> > Thanks for the testcase.  I have replicated the behavior but, like you, 
> I'm
> > not sure what exactly is causing it.  It should definitely be figured
> > out.
>
>I experienced something similar with a function that traverses the DOM
>and returns all nodes that have class with a given name:
>
>public static Vector getByClassName(Node node, String className) {
>   Vector elems = new Vector();
>   NodeList children = node.getChildNodes();
>   for (int i=0; i<children.getLength();i++) {
>     elems.addAll(getByClassName(children.item(i), className));
>   }
>   if (node instanceof HTMLElement) {
>     String elemClassName = ((HTMLElement)node).getClassName();
>     if ((elemClassName != null) && 
> elemClassName.equalsIgnoreCase(className)) {
>       elems.add((HTMLElement)node);
>     }
>   }
>   return elems;
>}
>
>This works fine on several pages but I also have one page where this
>doesn't work - doesn't return any node eventhough there are several ones
>with the class set.
>
>I never figured out why it doesn't work. I could probably create a
>testcase from the html page and share it as well.

Absolutely.  Any testcases that reproduce this issue are welcome.  Any idea 
if the issue happened on a specific type of node?  Was it an 
HTMLFormElement which is the issue with the current reported bug?

>Petr
>
>P.S. Would be nice to fix this issue and release XMLC 2.2.1 that would
>be a drop-in replacement for the XMLC in (at that time probably
>released) Enhydra 5.1 :) Yes I really appreciate the new modular
>structure of Enhydra 5.1 :))

A bug fix for this would, IMO, constitute an XMLC-2.2.1 release.  Any help 
in figuring it out is welcomed.

Jake



>_______________________________________________
>XMLC mailing list
>[email protected]
>http://www.enhydra.org/mailman/listinfo.cgi/xmlc