Read XML Properties in Java

Once in a while you need to externalize some configuration without the overhead of a complete framework, here’s a simple method to read an XML formatted property file in java. In most cases, it’s a performance advantage to wrap this up in a Singleton pattern, but that’s a different topic altogether.

private getAttributes() {
final String filename = "";
final InputStream input = getClass().getClassLoader().getResourceAsStream(filename);
System.err.println("Cannot find properties:"+ filename);
final java.util.Properties props = new java.util.Properties();
try {
hostprop = props.getProperty("hostname",null);
userprop = props.getProperty("username",null);
pswdprop = props.getProperty("password",null);
catch(final Exception e){
System.err.println("Error occurred while reading properties file:"+ input);
try {
catch(final ex){

The matching file would resemble…

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE properties SYSTEM "">
<entry key="hostname">localhost</entry>
<entry key="username">example</entry>
<entry key="password">example</entry>

MSIE CSS zoom (and -ms-zoom) property

Even when you’ve used conditional includes, there are often cases where MSIE just will not cooperate with your CSS manipulations. In those cases, it can often be attributed to the hasLayout property of the element. To correct this quirk, setting zoom:1; will often “convince” MSIE to work in the way you expect it to (like other browsers!)

<style type="text/css">
.someclass {
/* your CSS definitions */