problem with getLastChild() and <xsl:comment /> nodes

Hi list,

the problem I'm facing at the moment is as follows (using org.w3c.dom.*):

in my DOM I have fragments of the following:

<a accesskey="2" class="namedanchor" name="content">

<!->

<span class="test">.</span>

</a>

in my program my code looks like this:

while(current.getLastChild() !=null)

current = current.getLastChild();

suppose the node "current" is the anchor node in the above example (with sub nodes: <xsl:comment /> written as <!->, a span node with attribute class and attribute value "test" and this span node has a childnode - a textnode with the value ".")

If the while loop has the current node being the anchor node it doesn't proceed - it ends up in the anchor node itself, but it should end up in text node with value ".".

Does anyone have a clue whats the problem with the <xsl:comment /> in this case?

thanks for your help

HTH

silentium

[1173 byte] By [silentiuma] at [2007-11-26 15:06:50]
# 1

The last child of that <a> element (that's what you meant by "anchor node", right?) is a white-space text node. Regardless of whether any of its earlier children happen to be comments. (And even though I couldn't understand all that hand-waving about <!> versus <xsl:comment>.)

DrClapa at 2007-7-8 8:56:48 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...