Creating java properties file from XMLThe Properties class available in the package "java.util" can be used to create properties object and then load the properties from the XML file into that object. Before you load the properties defined in the XML element into the Properties object you have to create a FileInputStream object which can hold the XML file you are going to use. The import statements that are needed to work with this properties class might include, import java.util.*; Using the properties object's loadFromXML() method you can load the FileInputStream object into it and use the list() method to list down the properties if needed. To get the value of a particular property you can also use the getProperty() method. Once you get this you can store in your java program to manipulate it anyway. Lot of samples are available in the internet for using this Properties class. Check out the URL http://www.ibm.com/developerworks/java/library/j-tiger02254.html for some.
|
|
|||
|
||||
“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”
Copyright - © 2004 - 2019 - All Rights Reserved.