commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Don Vawter <...@vawter.com>
Subject newbie ?, empty config
Date Sat, 08 Jan 2005 07:50:36 GMT
I am making my first attempt to use the Configuration capabilities and 
am obviously doing something wrong.
The configuration object is not null but isEmpty() returns true.

Any guidance would be greatly appreciated as I struggle up the learning 
curve.

TIA


Here is my config.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<configuration>
  <hierarchicalXml 
fileName="/projects/svnVawter/src/com/vawter/vawter/buttons.xml"/>
</configuration>

and here a code snippet:

  private static final Logger logger = Logger.getLogger(NavBar.class);
        private static  ConfigurationFactory factory=null;
        private static URL configURL = null;
        private static Configuration config=null;
        static{
                try{
                        factory = new ConfigurationFactory();
                        String navfile= 
PropertyHandler.getProperty("navigation.config.file");
                        logger.debug("navigation.config.file is " + 
navfile);
                        if(navfile!=null) {
                            factory.setConfigurationFileName(navfile);
                           Configuration config = 
factory.getConfiguration();

                         logger.debug("configuration factory is "+ config);
                        logger.debug("configuration is empty " + 
config.isEmpty());
.....
and here is the logger:

DEBUG,2005-01-08 
00:31:10,com.vawter.jsptags.NavBar,navigation.config.file is 
/projects/svnVawter/src/com/vawter/vawter/config.xml
DEBUG,2005-01-08 00:31:10,com.vawter.jsptags.NavBar,configuration 
factory is org.apache.commons.configuration.CompositeConfiguration@1d144a4
DEBUG,2005-01-08 00:31:10,com.vawter.jsptags.NavBar,configuration is 
empty true

and finally here is the xml file
don@blackbox:/projects/svnVawter/src/com/vawter/vawter$ cat buttons.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<navigation>
<urlbase>/artisan/</urlbase>
<imagebase>images/</imagebase>
<buttons>
<button>
<name>Home</name>
<url></url>
<caption>Home</caption>
<image>home.png</image>
</button>
<button>
<name>Gallery></name>
<url>gallery.do</url>
<caption>Gallery</caption>
<image>gallery.png</image>
</button>
</buttons>
</navigation>






---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message