Re: [xmlc] getElementsByTagName in XHTML ?
Jacob Kjome <[email protected]> Thu, 11 Aug 2005 20:06:47 -0500
| Newsgroups | gmane.comp.java.enhydra.xmlc |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format...
------------=_1123808850-24892-334
Content-Type: text/plain; charset="iso-8859-1"; format=flowed
Content-Transfer-Encoding: quoted-printable
At 11:27 PM 8/11/2005 +0200, you wrote:
>Jacob Kjome p=ED=B9e v P=E1 05. 08. 2005 v 10:46 -0500:
>
>> > Well, even if the getElementsByTagName was supposed to start from
>> > children of the supplied node instead from the node itself then it st=
ill
>> > doesn't work as I tested that case as well.
>
>> What's the test case?
>
>I don't have one. It just happened to me in my project and I had to
>solve it immediately so I worked around it by implementing my own
>function but I also thought it was worth to post about that issue to the
>list. I helped to fix some bugs this way so I wanted to repeat it :-)
>
I guess I'm still unclear on the results, though. I suspected that you=20
were mistakenly reporting this because you had stated that you expected the=
=20
results to be children of the current tag, plus the current tag=20
itself. That's clearly wrong. It should only be the children. So, you=20
say you tested this? What were your results? More below...
>> If you were to do node.getElementsByTagName("td") and the
>> current node is a "td", I wouldn't expect to have any results returned=
=20
unless
>> you were using nested tables.
>
>well of course I did node.getParentNode().getElementsByTagName("td").
Which, again, unless you were using nested tables, would return an empty=20
node list so it would be pretty pointless to do.
> Or
>actually I did search for some other elements, perhaps <input> or
>something like that inside of <td>'s.
>
Now you are speculating, though. If it were true that you always got an=20
empty node list, then you are saying that getElementsByTagName() simply=20
never works. I'd be hard pressed to believe this without some real=20
proof. This is something that we'd be getting complaints about constantly=
=20
if it were true, which is why I remain skeptical.
>> If you are using the HTML DOM, that should be
>> node.getElementsByTagName("TD") anyway, since the HTML DOM stores its
>nodes in
>> upper case.
>
>I tried both "td" and "TD", don't worry :-)
>
Ok, but I still think you may have been expecting something that shouldn't=
=20
have happened anyway.
>> > It's easy to write an implementation of getElementsByTagName that wor=
ks
>> > correctly and I am just doing that but I still wonder why the supplied
>> > DOM method doesn't do what I'd expect.
>
>> I wonder if your expectation is valid?
>
>what's invalid on expecting the getElementsByTagName to return some
>elements?
>
<td>
<input ...>
</td>
td.getElementByTagName("td") should return an empty nodelist. It would be=
=20
"invalid" to expect anything else. td.getElementsByTagName("input")=20
should return a list with a single element of type HTMLInputElement. If=20
this is not the case, there are serious problems in the Xerces which I've=
=20
never run into.
>> I also wonder if your test is valid.
>
>I can't be 100% sure that my test was valid but I wrote my own function
>that does what I thought the getElementsByTagName would do - and it does
>it well with the same input parameters.
>
But you had previously said that you expected the current element to be=20
returned in the node list along with other mistaken assumptions. So, I=20
suspect that your version of getElementsByTagName() simply returned the=20
current node along with any child nodes, guaranteeing at least one result=
=20
ever time. If that's the behavior you want, then its a pretty useful=20
utility function for you. But that doesn't make what=20
element.getElementsByTagName() does, per the DOM spec, wrong.... unless=20
there truly is a bug, which is unlikely.
>> Can you provide the testcase you mention above so that we can verify=20
whether
>> there really is something wrong here?
>
>When I get some free time then perhaps yes. Sorry not now as I am too
>busy with the project :-| BTW, the HTML was already changed and I don't
>use the function anymore so creating a test case would require some
>work.
>
I hope you do get some free time because I'd love to see the case where=20
getElementsByTagName() fails. It would be pretty important to get a fix in=
=20
before the next release of XMLC. I hope you don't get the impression that=
=20
I'm just blowing you off. But as Carl Sagan said many times,=20
"Extraordinary claims require extraordinary evidence". I'm certainly=20
willing to evaluate the evidence when it is provided, but find it hard to=
=20
believe until then.
Jake
>Petr
------------=_1123808850-24892-334
Content-Type: text/plain; name="message-footer.txt"
Content-Disposition: inline; filename="message-footer.txt"
Content-Transfer-Encoding: 8bit
--
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
------------=_1123808850-24892-334--