Is there a way via Jaxen to create a new node? I am using Jaxen in conjunction with JDOM and I would like to create a new node based on an XPath. Here is a snippet of code that I tried, which doesn't work:
try { Element elem = getElement(xpathString); // create the Element if it doesn't already exist if (elem == null) { System.out.println("creating new XPath Element: " + xpathString); int index = xpathString.lastIndexOf("/"); String varName = xpathString.substring(++index); SimpleVariableContext context = new SimpleVariableContext(); context.setVariableValue( null, varName, value ); XPath path = new XPath( xpathString ); path.setVariableContext( context ); // now try getting the element again elem = getElement(xpathString); } elem.setText(value); } catch (Exception e) { e.printStackTrace(); } ______________________________________________________________ [EMAIL PROTECTED]
<<attachment: winmail.dat>>