Conversion fails when JSON key name is not a legal XML element name #10

dwcramer opened this Issue Nov 11, 2013 · 3 comments


None yet

2 participants


Given the input JSON:

   "^.{0,256}$": "foo"

I receive the following error:

dcramer@anatine ~/Desktop/json2plainparams/json_schema (master)
$ ./ test.json 
Debug mode is on. Events are logged at: dicttoxml.log
Traceback (most recent call last):
  File "./", line 18, in <module>
    dom = parseString(xml)
  File "/usr/lib/python2.7/xml/dom/", line 1931, in parseString
    return expatbuilder.parseString(string)
  File "/usr/lib/python2.7/xml/dom/", line 940, in parseString
    return builder.parseString(string)
  File "/usr/lib/python2.7/xml/dom/", line 223, in parseString
    parser.Parse(string, True)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 46

Due to the fact that <^.{0,256}$>foo</^.{0,256}$> would not be well-formed xml.

I would suggest an xml format like foo to avoid this problem.


Thanks for bringing this to my attention. I should be able to commit a fix in the next day or so.


Thanks! Btw., in my original message I see that my suggested output was munged because I hadn't escaped the angle brackets. Here's what I was trying to say: "I would suggest an xml format like <key name="^.{0,256}$">foo</key> to avoid this problem. "


Sorry it took a lot longer than I expected, but I finally got around to fixing this issue. It's addressed in version 1.3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment