[thelist] ignore xml whitespace?

Diane Soini dianesoini at earthlink.net
Sun Jun 27 10:40:47 CDT 2004


On Sunday, June 27, 2004, at 04:12 AM, thelist-request at lists.evolt.org 
wrote:
>
>   function childElements(parentNode) {
>     var l= new Array();
>     for (var i= 0; i<parentNode.childNodes.length; i++)
>       if (parentNode.childNodes[i].nodeType==1)
>         l[l.length]= parentNode.childNodes[i];
>     return l;
>   }
>
> Or you could even removeChild the whitespaces. But often, judicious 
> use of getElementsByTagName, the HTMLCollection-based properties, and 
> just skipping over text nodes may do the trick.
>
> -- 
> Andrew Clover

Thank you. The use of getElementsByTagName is probably best, although 
not as simple (seemingly) as hasChildNodes.

Thanks again.

***
Don't be afraid to try something new. An amateur built the ark. 
Professionals built the Titanic. -unknown



More information about the thelist mailing list