W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2002

Re: method to return only the specificied child elements?

From: Joseph Kesselman <keshlam@us.ibm.com>
Date: Tue, 22 Jan 2002 08:51:54 -0500
To: <www-dom@w3.org>
Message-ID: <OFC605C304.57448CB3-ON85256B49.004BB3E7@pok.ibm.com>

>: how come there are no method that allows an Element to get only the
child elements specified by their tag name?

The DOM doesn't provide every possible convenience function. It provides
the essentials, and some conveniences which have specific historical or
efficiency justifications. If we don't provide a function, write your own
support routine that does.

In this case: You could write an appropriate filter to test the "tag name",
and plug it into a NodeIterator or TreeWalker. But it may be easier and
possibly more efficient to write a
get-next-sibling-and-test-node-name-and-type loop. Given that it's so easy
to do either way, there's really no need for the DOM to supply a canned

Joe Kesselman  / IBM Research
Received on Tuesday, 22 January 2002 08:52:34 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:09 UTC