I'm using the following code:

//part1
XMLConfiguration config= new XMLConfiguration();
config.setDelimiterParsingDisabled(true);
config.setExpressionEngine(new XPathExpressionEngine());
config.setFile(f);
if (f.exists()) {
    config.load(f);
}

//part2
config.addProperty(" a", "");
config.addProperty("a b", "");
config.addProperty("a/b c", "");
config.save();
        
//part3
System.out.println("a is a valid key " + config.containsKey("a"));
System.out.println("a/b is a valid key " + config.containsKey("a/b"));
System.out.println("a/b/c is a valid key " + config.containsKey("a/b/c"));

After executing it for the first time, the code behaves as I expected,
the simple nested xml structure is created and the output is:
a is a valid key true
a/b is a valid key true
a/b/c is a valid key true

Then, I removed the "part2" code, so the program should just read the
previously created configuration, bat the output was:
a is a valid key false
a/b is a valid key false
a/b/c is a valid key true

So, sometimes if key doesn't have any values it is seen as a key, and
sometimes not. Any explanation, solution,... ?

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to