Etewa - 2009-06-12

I am trying to convert a simple HashMap<String, String> to an XML document.  The JSON conversion works fine, but the XML Conversion fails.

Map<String, String> data = new HashMap<String, String>();
data.put("1", "Hello");
data.put("2", "World");
JSONObject json = JSONObject.fromObject(data);

JSON Output

XML Output causing exception
new XMLSerializer().write(json);

Exception in thread "main" nu.xom.IllegalNameException: NCNames cannot start with the character 31
    at nu.xom.Verifier.throwIllegalNameException(
    at nu.xom.Verifier.checkNCName(
    at nu.xom.Element._setLocalName(
    at nu.xom.Element.<init>(
    at nu.xom.Element.<init>(
    at net.sf.json.xml.XMLSerializer.newElement(
    at net.sf.json.xml.XMLSerializer.processJSONObject(
    at net.sf.json.xml.XMLSerializer.write(
    at net.sf.json.xml.XMLSerializer.write(
    at test.SMTSerializer.main(