logo       

Re: [xmlc] getElementsByTagName in XHTML ?: msg#00003

java.enhydra.xmlc

Subject: Re: [xmlc] getElementsByTagName in XHTML ?

Jacob Kjome píše v Pá 05. 08. 2005 v 10:46 -0500:

> > node.getTagName() returns "td" because that node is of type
> > HTMLTableCellElement...

> You are using the HTML DOM or XHTML? From above, it looks like the HTML DOM
> as
> the XHTML DOM would be XHTMLTableCellElement, no? Typo?

I probably use HTML DOM but I compile source xhtml and get xhtml like
output :-) (that's due to IE's compatibility to real xhtml or something
like that).

> > Well, even if the getElementsByTagName was supposed to start from
> > children of the supplied node instead from the node itself then it still
> > 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 :-)

> If you were to do node.getElementsByTagName("td") and the
> current node is a "td", I wouldn't expect to have any results returned unless
> you were using nested tables.

well of course I did node.getParentNode().getElementsByTagName("td"). Or
actually I did search for some other elements, perhaps <input> or
something like that inside of <td>'s.

> 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 :-)

> > It's easy to write an implementation of getElementsByTagName that works
> > 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?

> 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.

> Can you provide the testcase you mention above so that we can verify 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.

Petr




--
You receive this message as a subscriber of the xmlc@xxxxxxxxxxxxx mailing list.
To unsubscribe: mailto:xmlc-unsubscribe@xxxxxxxxxxxxx
For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise