Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / October 2006

Tip: Looking for answers? Try searching our database.

load properties from xml into objects

Thread view: 
Petterson Mikael - 25 Oct 2006 15:11 GMT
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
Bart Cremers - 25 Oct 2006 15:27 GMT
> Hi,
>
[quoted text clipped - 6 lines]
>
> //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
Petterson Mikael - 26 Oct 2006 09:20 GMT
>>Hi,
>>
[quoted text clipped - 16 lines]
>
> Bart

Thanks for a the hints.

cheers,

//mikael


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.