Hello, thanks for the great product. I have been using
commons-configuration for some time but am new to the
XPathExpressionEngine and am having trouble figuring out how to use it
properly.
I am trying to use the XPathExpressionEngine to populate a new
XMLConfiguration using commons-configuration-1.5. It seems that
setProperty will create a new attribute for the root but not for child
nodes.
Can you please explain why the following works:
XMLConfiguration config = new XMLConfiguration();
config.setExpressionEngine(new XPathExpressionEngine());
config.setProperty("/ @version", "1.0");
but if I add a child node to the root and then try to add a new
attribute to the child using setProperty it fails:
config.setProperty("/ child", "");
config.setProperty("/child @name", "child0"); //Fails with
"org.apache.commons.jxpath.JXPathException: Invalid XPath: '/child
@name'. Syntax error after: '/c'"
If I change the last call to setProperty to addProperty the new
attribute is created and after that I can call setProperty with out
getting an exception.
Is this a bug, or do I not understand how this should work?
I also expected to be able to create the child node and the attribute
with one call like:
config.setProperty("/ child/@name", "child0"); //Fails with
java.lang.IllegalArgumentException: Invalid node path: "child/@name"
contains an attribute delimiter at an unallowed position.
Thanks for your time,
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]