commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trenton D. Adams" <tre...@athabascau.ca>
Subject Re: Commons Configuration XML problem
Date Wed, 18 Oct 2006 16:53:13 GMT
That was so subtle I missed it.

Thank you!!!

Borut Bolčina wrote:
> Try
> 
> Collection collection = (Collection)config.getProperty("menu.display");
> 
> Drop "menus" prefix.
> 
> Cheers,
> Borut
> 
> On 18.10.2006 1:12, Trenton D. Adams wrote:
>> Hi guys,
>>
>> I'm playing with commons-configuration.  It doesn't appear to be working
>> correctly.  it is loading my config file, as the getRootElementName()
>> does return the appropriate string.
>>
>> The menus.menu.display log entries return null.  I've attached a sample
>> config.  Any help to shed light on this issue would be much appreciated.
>>
>> Thanks.
>>
>>
>>       try
>>       {
>>           XMLConfiguration config = new XMLConfiguration(
>>               "/path/to/menu.xml");
>>           logger.info("File: " + config.getFileName());
>>           logger.info("root element: " + config.getRootElementName());
>>           logger.info("display:" +
>> config.getString("menus.menu(0).display"));
>>           logger.info("display:" + config.getString("menus.menu.display"));
>>           Collection collection =
>> (Collection)config.getProperty("menus.menu.display");
>>           if (collection != null)
>>           {
>>               logger.info("IT'S A COLLECTIONS");
>>               Iterator menus = collection.iterator();
>>               while (menus.hasNext())
>>               {
>>                   logger.info("menus." + menus.next());
>>               }
>>           }
>>       }
>>       catch(ConfigurationException cex)
>>       {
>> 	// this reports NOTHING.  There appears to be no errors.
>>           logger.error("Configuration error: " + cex);
>>       }
>>
>> __ 
>>     This communication is intended for the use of the recipient to whom it
>>     is addressed, and may contain confidential, personal, and or privileged
>>     information. Please contact us immediately if you are not the intended
>>     recipient of this communication, and do not copy, distribute, or take
>>     action relying on it. Any communications received in error, or
>>     subsequent reply, should be deleted or destroyed.
>> ---
>>   
>> --------------------------------------------------------------------------------
>>
>> <?xml version="1.0" encoding="ISO-8859-1" ?>
>> <!-- 
>>   Each menu item has...
>>     1. a 'type' attribute.  This attribute is either All, or
>>        a comma separated list of Groups of people that should have access
>>        to the menu.
>>     2. a 'displaymodes' attribute, which determines when the menu item should
>>        appear.  This could be for instance when they are on the *Home* page,
>>        or on the *Reports* page.
>>     3. a 'display' element which is what the link will display as to the user
>>     4. a 'description' element, which could be a pop-up style help.
>>   Each url element has...
>>     1. a 'absolute' attribute, indicating if it is an absolute URL, in
>>        which case it should not be touched.
>>     2. URL content
>> -->
>> <menus>
>>   <!-- Newton Tutor Menus -->
>>   <menu type="All">
>>     <display>Home</display>
>>     <description>Go Home</description>
>>     <url>welcome.html</url>
>>   </menu>
>>   <menu type="All">
>>     <display>Help</display>
>>     <description>Get Newton Help</description>
>>     <url>help.html</url>
>>   </menu>
>>   <menu type="All">
>>     <display>Login</display>
>>     <description>Login to Newton</description>
>>     <url absolute="true">
>>     https://reuben.pc.athabascau.ca/cas/login?service=https%3A%2F%2Freuben.pc.athabascau.ca%2Fnewton%2Fservlet%2FDispatcherServlet
>>     </url>
>>   </menu>
>>   <menu type="Tutor,Admin" displaymodes="Home,Reports">
>>     <display>Assignments</display>
>>     <description>Manage assignments</description>
>>     <url>assignments.html</url>
>>   </menu>
>>   <menu type="Tutor,Admin" displaymodes="Home">
>>     <display>Reports</display>
>>     <description>Some sort of reports</description>
>>     <url>reports.html</url>
>>   </menu>
>> </menus>
>>
>>
>>   
>> --------------------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> -- 
> bLOG <http://www.delo.si/blog/borutb/>
> --
> Naključna *izjava tedna* iz tednika Mladina:


---------------------------------------------------------------------
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