• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

load xml on startup

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a .properties file and i have transformed that to a xml file by writing a new DTD. Now on startup i want to read that xml file and i want to parse the file by using DOM. Can anyone please tell me the way to implement this.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello Revathi,

your question is not very clear to me. This is what i got- Initially you have a java property file(.properties) and then you transformed it into xml file, i guess by using java.util.Properties.storeToXML(). Now you want to parse that file using DOM. Why do you want to use DOM? You can read the same xml property file using java.util.Properties.loadFromXML(). Let me know is this is what you wanted.
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Revathi Damera:

I have a .properties file and i have transformed that to a xml file by writing a new DTD.



How are you transforming a properties file into a xml using a DTD ?

As sachin poddar said and if you are using JDK 1.5 and above you can do it directly using Properties object , you can read the xml directly into properties object.But you have to stick of the format specified by sun.You may want to have a look at the DTD of that.

And in case you want to use your own xml format or using JDK 1.4 , then you can read that into java classes using third parties like digester.Or simple use JAXP to construct the DOM and then query it using XPath to fetch required values.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic