Fw: Core XML DOM suggestion

John,

Perhaps what you are interested in is something like this?

public interface NodeEx extends Node {
    ...
    NodeList getChildNodes(NodeFilter filter);
    ...
}

where NodeFilter is defined as

public interface NodeFilter {
    boolean acceptNode (Node node);
}

This type of node filtering works quiet well and encourages reusability as
well.  In Docuverse DOM SDK, I started with NodeTypeFilter and TagNameFilter
to implement getElementsByTagName and found it so useful that I kept adding
more filters like:

CompoundFilter - for combining multiple filters
AttributeFilter - for finding elements with specific attribute values
IdentityFilter - for finding an element with specific ID
NamespaceFilter - for finding all elements with namespace attributes

[Note that NodeEx and NodeFilter interfaces in the DOM SDK are
'experimental' only and not part of the DOM API.]

Don Park

-----Original Message-----
From: JLemire@walldata.com <JLemire@walldata.com>
To: w3c-dom-ig@w3.org <w3c-dom-ig@w3.org>
Date: Friday, August 28, 1998 2:57 PM
Subject: Core XML DOM suggestion


>After reading this WD I don't see how to get an element's sub-elements
>of a certain nodeName.  Although it did suffer from inconsistent return
>type shortcomings, the IE4 model had a way that was both conceptually
>straightforward and just so plain damned handy that I used it all the
>time.  I could like to see the WD altered slightly to glean the best of
>both.  My suggestion is to add a method to Node to use as an alternative
>to the childNodes attribute that would also return a NodeList but
>filtered on nodeName and nodeType:
>
> NodeList filteredChildNodes( in wstring              name,
>                                                      in unsigned short
>type    );
>
>
>also kind of like the cleanliness of IE5's separation of Node and
>NodeList functionality where all iteration is at NodeList versus the
>WD's Node having childNodes and first/last child and first/last sibling.
>
>also like their NodeList's moveTo and moveToNode
>
>
>food for thought
>John Lemire
>Wall Data Incorporated
>
>
>

Received on Friday, 28 August 1998 21:27:26 UTC