> if a node has children, then its not a leaf, so i imagine
> you could continue to traverse until you reach the leaf
> that actually has the address needing magical conversion.

I tried that.  $Element->hasChildNodes() returns true for just about
everything except tags like <br> and <img> that have no corresponding </br>
or </img> because the content that appears between <p> and </p>, for
example, apparently counts as a child node, even though they're not HTML
tags.  So, if you have:

<p>Foo!</p>

when you look at $Element->hasChildNodes() for the <p> tag, you will get
"true", and $Element->childNodes->length is equal to "1", even though "Foo!"
isn't an HTML tag.  Interestingly though, when you iterate through the tree,
you get the <p> tag as one of the elements, but you never get a text-only
element that has that <p> as a parentNode.  In fact, get_class($Element)
always returns DOMElement, even on the text-only nodes, which I would have
expected to be DOMText elements...but I guess not.  So I'm wondering why
$Element->hasChildNodes() would return true, but iterating through the DOM
tree returns no elements that have that $Element as a parentNode.

What's more, looking at $Element->childNodex->length isn't too helpful,
because, for example:

<h2><a name="bar"></a>Foo</h2>

returns two child nodes, neither of which has "Foo" for its textContent.

Tim Gustafson
SOE Webmaster
UC Santa Cruz
[EMAIL PROTECTED]
831-459-5354



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to