But I bet writing a simple Filter and using getDescendants(Filter) would :-)
Brad
Mike Brenner writes:
> This does not work like, say, getElementById in an
> xml svg file, which searches all levels. This code
> only searches one level.
>
> > No, no, no. Document.getElementById(String id) would return the Element
> > that has an attribute whith type ID_ATTRIBUTE and which value is equal to
> > the id parameter. The name of the attribute is irrelevant.
> >
> > It should behave exactly as
org.w3c.dom.Document#getElementById(String id)
> >
> > It is very easy to implement:
> >
> > Element getElementById(String value) {
> > for(Iterator i = getDescendants(); i.hasNext(); ) {
> > Object node = i.next();
> > if (node instanceof Element) {
> > Element e = (Element) node;
> > for(Iterator j = e.getAttributes().iterator(); j.hasNext();) {
> > Attribute a = (Attribute) j.next();
> > if (a.getAttributeType() == Attribute.ID_TYPE &&
> > value.equals(a.getValue())
> > {
> > return e;
> > }
> > }
> > }
> > }
> > return null;
> > }
> >
> > Probably performs like dog for large documents, but then you could enhance
> it
> > with Laurent's mapping solution.
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)