commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lorenzo Cavina <lcav...@noemalife.com>
Subject Commons Configuration XPath engine
Date Fri, 19 Feb 2010 09:56:01 GMT
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:entry[@name='background']"); it doesn't 
work at all, returning NULL (i also tryed with 
configuration.getProperty("/cfg:entry[@name='background']") or 
configuration.getProperty("/cfg:configuration/cfg:entry[@name='background']").....same 
result!)
- if i REMOVE the namespace declarations from the configuration root 
element and i execute 
configuration.getProperty("entry[@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

-- 
Ing. Lorenzo Cavina
Analyst \ Emr Development

NoemaLife S.p.A
Via Gobetti, 52
40129 Bologna - ITALY
T +39 051 70.98.247
F +39 051 70.98.200
lcavina@noemalife.com

www.noemalife.com


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message