How do I read properties from an XML file?
Author: Deron Eriksson
Description: This Java tutorial describes how to read properties from an XML file.
Tutorial created using: Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 1.5.1

Page: < 1 2

(Continued from page 1)

If we execute our ReadPropertiesXmlFile class, we obtain the following result.

Execution of ReadPropertiesXmlFile

In the console, the three key/value pairs are displayed. If all your application does with the properties in terms of the file system is read/write the properties, I do not see a great deal that is gained via the XMLW format, which is more complicated than the standard properties format. However, if you perform any other actions with the properties in the file, benefits can be gained from storing the data in the XML format.

Page: < 1 2