Take the 2-minute tour ×

in the post located here

Andrew Finnell's reply was by far the most helpful to a point. I do however need to know how to expand that into allowing other sections other than just


If the answer is already on that page please let me know, if not can someone help me out.

Basically I want to have


etc... as my sections. All the normal xml libs and such I have found are far to bulky and confusing so I am hoping to be able to use the afore referenced method with much more ease. Thanks in advance.

share|improve this question
add comment

3 Answers

An xml file needs excatly one root element. Otherwise it is not valid and can't be processed by xml parsers.

A valid xml with sections could look like this:

<properties>  <!-- root element -->
  <section1>  <!-- section 1 as a child of root -->
  <section2>  <!-- section 2 as a child of root -->
share|improve this answer
add comment

If you put sections into an XML properties file, it is no longer an XML properties file, and you can't expect to use java.utils.Properties to process it.

If your requirement is for properties (name/value pairs) within named sections, then you could use INI file syntax. There's a Java library for handling this.

If you want something more general, then take a look at JSON. There are a numer of Java libraries that handle JSON. (I like Jackson because it allows you to map regular Java beans to JSON.)

share|improve this answer
add comment

Ok thanks for quick responses. I have restructured things a bit and here is my xml. Is this 100% compliant or are minor changes needed?

<?xml version="1.0"?>
<settings name="connection">

<settings name="prvtmsg">
    <hello>Hello %person. How are you today?</hello>
    <commands>I have the following commands: About, Help, and Join</commands>

<settings name="timers">
share|improve this answer
add comment

Your Answer


