x2js icon indicating copy to clipboard operation
x2js copied to clipboard

Produces invalid XML element names

Open liftarn opened this issue 8 years ago • 1 comments

When converting from JSON to XML I get invalid XML element names such as <0> and that is not allowed. Perhaps they should be escaped in some way.

Example, this JSON:

   "deMag": [
      {
        "settings": {
          "generator": 1,
          "startCurrent": 5
        },
        "data": [ { } ]
      }
    ],

produce this XML:

    <deMag>
      <settings>
        <generator>1</generator>
        <startCurrent>5</startCurrent>
      </settings>
      <data>
        <$H>7535</$H>
      </data>
    </deMag>

liftarn avatar Jul 11 '16 07:07 liftarn

JSON key with spaces produces incorrect results also, i.e. "dosage amount" : 5 ==> <dosage amount>5</dosage amount>

ddgflorida avatar Jun 23 '17 12:06 ddgflorida