Am 19.02.2010 10:56, schrieb Lorenzo Cavina:
Hi all,
i'm using the Commons Configuration library to manage XML
configurations. I'm trying to manage this configuration using the
built-in XPath expression engine based on Commons JXPath.
My XML configuration document looks like following:

<?xml version="1.0" encoding="utf-8"?>
<cfg:configuration
xmlns:cfg="http://www.noemalife.com/configuration/xml/main";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.noemalife.com/configuration/xml/main
configuration.xsd">

<cfg:entry name="background">blue</cfg:entry>
<cfg:entry name="showmenu" mode="free">yes</cfg:entry>
<cfg:entry name="showstatusbar">yes</cfg:entry>

</cfg:configuration>

Now the problem is that i really don't know how to manage the cfg
namespace.
That is:
- if i execute
configuration.getProperty("cfg:ent...@name='background']"); it doesn't
work at all, returning NULL (i also tryed with
configuration.getProperty("/cfg:ent...@name='background']") or
configuration.getProperty("/cfg:configuration/cfg:ent...@name='background']").....same
result!)
- if i REMOVE the namespace declarations from the configuration root
element and i execute
configuration.getProperty("ent...@name='background']"); i get the right
result. But i need the namespace declaration.

Does anybody knows how to manage namespaces?

Thank you very much.

Lorenzo

I am not sure, but I think it is possible that namespace prefixes are simply dropped. Can you check which keys your configuration contains? For instance, obtain the iterator returned by getKeys() and print its elements.

Oliver

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

Reply via email to