As bob said, the List isn't 'backed' however...
From: "Field, Richard" <[EMAIL PROTECTED]>
> We've just started using dom4j and really like it a great deal. One thing
> has us confused, however.
>
> We'd like to use the "backed List" concept to replace nodes/elements in
the
> document by manipulating a List. This works fine when we get the List
like
> this:
>
> List list = document.getRootElement().elements("someElement");
>
> However, when we get the list as a result of a use of an XPath, as in
>
> List list1 = document1.selectNodes("//topLevel/someElement");
>
> the list doesn't seem 'backed'.
>
> Is this true?
Yes. Though if you want to swap 'someElement' with a new element, you can
itereate through the list and modify the nodes.
e.g.
List list1 = document1.selectNodes("//topLevel/someElement");
for (Iterator iter = list1.iterator(); iter.hasNext(); ) {
Node node = (Node) iter.next();
Element parent = node.getParent();
node.detach();
parent.addElement( "newElement" );
}
etc.
James
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev