I think maybe you are right. For some reason the only way I came up with before to get a backed list was Branch.content(), which I think returned all the nested children recursively and was too much.
I've give Element.elements() a shot. If true, it seems like a JTable data model would be more suited to using the list returned from Element.elements() than the actual Document...at least if you have a potential for needed to shift things around.
Thanks
Steen Lehmann wrote:
Hi Brian,
As I understand it, Element.elements() is a backed list of the child
elements of a given Element. In your example,
document.getRootElement().elements() (or 'elements("Row")') would then
give you a backed list of elements named Row that you should be able to
swap about as you please.
Is this what you were looking for?
-- Steen
[EMAIL PROTECTED]
-----Original Message-----
From: Brian W. Young [mailto:byoung@;decadesystems.com] Sent: 13. november 2002 15:16
To: [EMAIL PROTECTED]
Subject: [dom4j-user] inserting/moving nodes?
I have several JTables and JLists with custom models that return data from a dom4j Document. In a couple of these cases, I need to be able to easily move nodes from once place to another or insert a node. Detaching nodes is easy enough, but I've not found a good solution for inserting or moving a node. Like this example below. Say I wanted to insert a new <Row> structure through an insert feature in my JTable between BBB and CCC. Or detach BBB and move it before AAA.
<Root>
<Row>
<data>AAA</data>
</Row>
<Row>
<data>BBB</data>
</Row>
<Row>
<data>CCC</data>
</Row>
<Row>
<data>DDD</data>
</Row>
</Root>
It is almost like there should be a Document.selectNodes(//Row) that returns a backed list. The only way to date I've found to get a backed list didn't work- it had too much stuff in it. Couldn't get just the "Row" elements. So, for now I'm stuck almost completely rebuilding documents when a user requests a move or insert. Can someone help me out here!?!
Thanks, Brian
-------------------------------------------------------
This sf.net email is sponsored by: Are you worried about your web server security? Click here for a FREE Thawte Apache SSL Guide and answer your Apache SSL security needs: http://www.gothawte.com/rd523.html
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user
-------------------------------------------------------
This sf.net email is sponsored by: Are you worried about your web server security? Click here for a FREE Thawte Apache SSL Guide and answer your Apache SSL security needs: http://www.gothawte.com/rd523.html
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user