 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Petterson Mikael Guest
|
Posted: Wed Oct 25, 2006 7:11 pm Post subject: load properties from xml into objects |
|
|
Hi,
I have an xml file with properties:
<?xml version="1.0" encoding="UTF-8"?>
<plugins>
<plugin>
<featureid>org.eclipse.platform</featureid>
<version>3.0.0</version>
<actiontype>install</actiontype>
<description></description>
<url>http://update.eclipse.org/updates/3.0</url>
</plugin>
<plugin>
<featureid>org.eclipse.check</featureid>
<version>3.1.0</version>
<actiontype>update</actiontype>
<description></description>
<url>http://update.eclipse.org/updates/3.1</url>
</plugin>
</plugins>
Plugin class
------------
ublic class Plugin {
private String featureId = null;
public Plugin(String featureId, String version, String actionType,
String description, String url){
}
//Then apply get and set methods.
}
I need to read this file and create plugin objects containing this
information. Any hints on how I can do this easily?
cheers,
//mikael |
|
| Back to top |
|
 |
Bart Cremers Guest
|
Posted: Wed Oct 25, 2006 7:27 pm Post subject: Re: load properties from xml into objects |
|
|
Petterson Mikael wrote:
| Quote: | Hi,
snip
I need to read this file and create plugin objects containing this
information. Any hints on how I can do this easily?
cheers,
//mikael
|
Use a SAX parser to read the xml file.
Store the tag data in fields in the handler by correctly writing the
startTag handling code. On the endTag for a Plugin tag you can create
instances of the Plugin class using the collected data.
Regards,
Bart |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|