Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

how to read XML configuration parameters, bool, int, double, string

Thread view: 
Andrew Marlow - 07 Mar 2007 15:23 GMT
Hello,

I am new to java and need to write a program that uses an XML file for its
configuration. I have an equivalent C++ program that uses libxml2 from
gnome for this task. I wrapped this up in a class (libxml2 is a C
interface). I am wondering how people solve this problem in java.

Googling reveals a tonne of xml configuration projects all pulling in
different directions with different dependencies. The ones that stick out
(IMHO) are JFig, JConfig and Carbon. Can anyone make any recommendations
please?

Ideally the solution should offer the ability to specify the name of a
file that contains the XML, and provide functions to get named attributes
as boolean, integer, double or string values. These functions need to be
able to take an optional default value. Where the configuration value is
missing from the config file and no default has been specified there must
be a means of communicating this to the caller.

Regards,

Andrew Marlow
Signature

There is an emerald here the size of a plover's egg!
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

Andrew Marlow - 23 Mar 2007 12:35 GMT
> Hello,
>
> I am new to java and need to write a program that uses an XML file for its
> configuration. I have an equivalent C++ program that uses libxml2 from
> gnome for this task. I wrapped this up in a class (libxml2 is a C
> interface). I am wondering how people solve this problem in java.

For anyone who's interested, I found out how to do this: use JDOM.

Signature

There is an emerald here the size of a plover's egg!
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.