Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Carl Leiby leibys-place.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Loading an xml properties file

// simple example of loading an xml file into Properties.

   1  
   2  Properties properties = new Properties();
   3  try {
   4      InputStream xmlStream = getClass().getResourceAsStream("properties.xml");
   5      if( xmlStream == null ) {
   6           //throw some error
   7      }            
   8      properties.loadFromXML(xmlStream);
   9  } catch (IOException exception) {
  10      // throw exception
  11  }


   1  
   2  <?xml version="1.0" encoding="UTF-8"?>
   3  <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
   4  <properties>
   5      <entry key="plugin.TestPlugin">com.plugin.test.TestPluginModule</entry>
   6      <entry key="messages.TestPlugin">TestPluginMessages.properties</entry>
   7  </properties>
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS