code: public static String toNamespace(String packageName) {
  
          if (packageName == null || packageName.length() == 0) {
              return null;
          }
          List < String > tokens = reverse(tokenize(packageName, "."));
          
          StringBuilder buf = new StringBuilder("http://");
          for (int i = 1; i < tokens.size(); i++) {
              buf.append(tokens.get(i));
              buf.append(".");
          }
          if (buf.charAt(buf.length() - 1) == '.') {
              buf.deleteCharAt(buf.length() - 1);
              buf.append("/");
          }
          buf.append(tokens.get(0));
          return buf.toString();
         
      }
docs: Create an XML namespace out of a java package name.
  
  @param packageName
  @return null if unable to derive a namespace