Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Add Element to existing Node in dom4j using XPath

807589Jan 19 2009 — edited Jan 19 2009
Hi,

I have searched far and wide and can not find an answer. I am using dom4j and have obtained a Node thus:
XPath xp;
String search = "/project/sco[@id='" + scormID + "']/sequence[@id='" + sequenceID + "']";
xp = DocumentHelper.createXPath(search);
Node node = (Node) xp.evaluate(doc); //doc is a Document
Now I need to add a brand new (therefore not cloneable) Element under this Node.
There doesn't appear to be a way to do this. I would expect something like:
node.addElement(new Element());
but this is not possible.

Can anyone please help me out here?
Thanks in advance..
Hugh
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 16 2009
Added on Jan 19 2009
1 comment
809 views