Actually I think your implementation mostly fine (though it would only keep
the first element of each name as you were using the element(name) function
rather than elements(name)).

The main problem was the use of Collections.singletonList() - if you remove
it I think it would have mostly worked I think.

e.g. change this

  this.root.content().retainAll(Collections.singletonList(listToRetain));

to this

  this.root.content().retainAll(listToRetain);

James

----- Original Message -----
From: "Tobias Rademacher" <[EMAIL PROTECTED]>
To: "James Strachan" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, June 19, 2001 3:43 PM
Subject: Re: [dom4j-user] Collection.retainAll(...) and dom4j Elements


> Hi James,
>
> > I think the problem is that you are creating a List containing a List,
> > rather than a List of Elements.
> > Are you trying to retain all chldren whose name matches one of the names
> > in
> > aNameList? If so how about doing it like this:-
>
> Oh no!
> Your'e completly right. It works now. Thanks for your quick help.
>
> What a stupid mistake. That's the result when trying to write the most
> efficient code.
> ;-)
>
> Shame on me ...
>
> Bye
>
> Toby
>
> --
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.net
>
> --
> GMX Tipp:
>
> Machen Sie Ihr Hobby zu Geld bei unserem Partner 1&1!
> http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a
>
>
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dom4j-user
>



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to