Convert XML file into properties file
- Read a XML file with DOM
- Create XML file with DOM
- Delete XML nodes with DOM
- Read a XML file with SAX
- JAX-B Marshal
- JAX-B Unmarshal
- Convert properties file into XML file
- Convert XML file into properties file
- XPath tutorial
- From XML to JSON
- Convert properties file into XML file
- Convert XML file into properties file
Comments (0)
You start with a xml file that you'll read with the fileInputStream.
Original xml file
Rhyme.xml
Java Code
The file is read into the fileInputStream, again it's all API work from here. just call loadFromXML() and the compiler does the rest.
package com.camelcode;
import java.io.FileInputStream;
import java.util.Properties;
public class XmlToProperties {
public static void main(String args[]) throws Exception {
Properties properties = new Properties();
FileInputStream fis = new FileInputStream("Rhyme.xml");
properties.loadFromXML(fis);
properties.list(System.out);
System.out.print("\n");
System.out.println("The one-two rhyme: " + properties.getProperty("one-two"));
}
}
Output
Output from the console.
-- listing properties -- seven-eight=lay them straight five-six=pick up sticks nine-ten=a big, fat hen three-four=shut the door one-two=buckle my shoe The one-two rhyme: buckle my shoe





Latest Posts
Latest Comments
Tag cloud