Re: Re: Problem with implementation of getChildNodes on HTMLFormElement?
Jacob Kjome <[email protected]> Sun, 14 Sep 2003 00:05:40 -0500
| Newsgroups | gmane.comp.java.enhydra.xmlc |
|---|---|
| Message-ID | <[email protected]> |
There is one problem with the fix below. The lazydom HTMLFormElementImpl
is dynamically generated via a shell script (that is, copied from the
xerces html implementation classes). It is then modified using SED to
integrate it with the core lazydom classes rather than the Xerces
classes. As such, I need someone to modify the SED script to edit
HTMLFormElementImpl with the small modification I added below. Anyone out
there with such skills? I don't know SED at all.
Additionally, we have the same problem with HTMLSelectElementImpl, so that
will have to be added to the SED script as well.
I'm attaching the SED script to this email so that people won't have to
necessarily pull it from CVS.
Jake
At 10:26 PM 9/13/2003 -0500, you wrote:
>At 01:00 PM 9/13/2003 -0500, you wrote:
>>Ok, I narrowed it down. Try adding "-dom xerces" to the XMLC
>>compilation. You will find that it works fine with or without calling
>>getFirstChild(). I figured this out after printing out all the child
>>node class names and noticed that they were LazyDOM classes (which I knew
>>anyway, but this just reminded me to notice that fact).
>>
>>So, it probably isn't a problem with Xerces, but with LazyDOM.
>
>Ok, I think I figured out the problem. I hadn't realized it before, but
>the lazydom HTMLFormElementImpl.java explicitly overrides
>getChildNodes(). Here is what it looks like including the Javadoc comments...
>
><quote>
> /*
> * Explicit implementation of getChildNodes() to avoid problems with
> * overriding the getLength() method hidden in the super class.
> */
> public NodeList getChildNodes() {
> return getChildNodesUnoptimized();
> }
></quote>
>
>I checked the Xerces HTMLFormElementImpl.java and this is really just
>taken directly from there. Basically, the normal lazydom node expansion
>that happens before the elements are returned in LazyElementNoNS.java
>doesn't happen for form elements. However, the getFirstChild() isn't
>overridden and carries out the normal expansion. Once the nodes are
>expanded, getChildNodes() will be dealing with a pre-expanded set of nodes
>and return them as expected.
>
>The fix involves two things...
>
>1. Change the HTMLFormElementImpl#getChildNodes() method to look like this...
>
> public NodeList getChildNodes() {
> if (!areChildrenExpanded()) {
> expandChildren();
> }
> return getChildNodesUnoptimized();
> }
>
>2. Change HTMLElementNoNS#expandChildren() method "protected" rather than
>"private" so that HTMLFormElementImpl actually as access to it.
>
>I tested this fix on Petr's testcase and it works even when using "-dom
>lazydom"!
>
>
>I think this change is reasonable and I'll check it in soon unless I hear
>otherwise from other XMLC developers. David, Richard, Mark, can you let
>me know if this change is ok? If I don't hear from you, I'll assume it is
>and check it in, so if you don't like it make sure you speak up.
>
>
>Jake
>_______________________________________________
>XMLC mailing list
>[email protected]
>http://www.enhydra.org/mailman/listinfo.cgi/xmlc
edit-html-dom.sh.zip
(application/zip, 761 B) - not displayed