private static String getAttribute( Element e, String name, Object defaultValue ) throws IOException
   {
      String value = e.getAttribute( name );

      if (value.isEmpty())
      {
         if (defaultValue == null)
         {
            throw new IOException( "Required attribute '" + name + "' for element '" + e.getTagName() + "' missing." );
         }

         value = defaultValue.toString();
      }

      return value;
   }