quick example:
-
// Assuming hashtable is in variable hash
-
String result = "<hashtable>";
-
for (Enumeration e = hash.keys() ; e.hasMoreElements() ;) {
-
Object key = e.nextElement;
-
result += "<pair>";
-
result += "<key>"+key+"</key>";
-
result += "<value>"+hash.get(key)+"</value>";
-
result += "</pair>";
-
}
-
result += "</hashtable>
-
-
Hmmmm.... This brings up another good question. What Java object type are you wanting to transfer the Hashtable data to. This code will produce a string object. Will that work, or will you need it in a XML element or node object?