commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Proposal - A Very Simple API for Reading Simple XML Data
Date Mon, 01 Jun 2009 05:37:04 GMT
This should have gone to the dev list.

On May 31, 2009, at 10:33 PM, Ralph Goers wrote:

>
> On May 31, 2009, at 9:24 AM, chris0 wrote:
>
>>
>> Hello,
>>
>> I'm making this proposal because I couldn't find a good solution to a
>> problem that I recently had.
>>
>> What I wanted to do was to configure an application with a simple  
>> XML file,
>> something along the lines of:
>>
>> <config>
>> 	<title>test</title>
>> 	<version
>> 		major="1"
>> 		minor="2"/>
>> 	<roles>
>> 		<role name="admin"/>
>> 		<role name="user"/>
>> 	</roles>
>> 	<users>
>> 		<user name="joe" password="pass" role="admin"/>
>> 		<user name="harry" password="secret" role="user"/>
>> 	</users>
>> </config>
>>
>> So the point is that it's really a very simple bit of XML data and  
>> what I
>> wanted was a nice easy way to read it in. The current options seem  
>> to be
>> SAX, DOM or JAXB.
>>
> Why not just use Commons Configuration and do:
>
> HierarchicalConfiguration config = new XMLConfiguration("config.xml");
> String title = config.getString("title");
> int majorVersion = config.getInt("version[@major]");
>
> etc.
>
> Ralph
>


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


Mime
View raw message