[jdom-interest] Creating attributes via XPath

Keith Tingle Keith_Tingle at payformance.com
Thu Mar 11 11:28:05 PST 2004

Is it possible to use XPATH in JDOM to _create_ an attribute in a node?

For instance in the following code if the attribute node doesn't exsist I
would like to create it before I set its value;

XPath nodePath = XPath.newInstance(strXPath2Attrib);
Attribute attrib = (Attribute)nodePath.selectSingleNode(xmlDoc);

if(attrib == null)
	// Here I would like to create the attribute!!


Thanks for any help.

More information about the jdom-interest mailing list