XML is an enabling technology for the virtuous programmer. A basic XML parser does a great deal of work for the programmer, recognizing tokens, translating encoded characters, enforcing rules on XML file structure, checking the validity of some data values, and making calls to application-specific code, where appropriate. In fact, early standardization, combined with a fiercely competitive marketplace, has produced scores of freely available implementations of standard XML parsers in many languages, including C, C++, Tcl, Perl, Python, and, of course, Java.
The java.util.Properties class has build-in functionality to convert properties file into XML file or vice verses.
Convert properties file into XML file in JAVA
public class PropertiesXMLExample
public static void main(String args) throws IOException
Properties props = new Properties();
OutputStream os = new FileOutputStream("c:/email-configuration.xml");
props.storeToXML(os, "Support Email","UTF-8");
The above example will write the properties detail into a XML file “c:/email-configuration.xml“ as:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">