Skip to content

Values that start with "E" are parsed incorrectly to Nan #746

Open
@danieljbrennan

Description

@danieljbrennan
  • Are you running the latest version?
  • Have you included sample input, output, error, and expected output?
  • Have you checked if you are using correct configuration?
  • Did you try online tool?
  • Have you checked the docs for helpful APIs and examples?

Description

Node values that start with E result in NaN

Input

 <CodeList>
    <CodeListName>E29</CodeListName>
    <CodeListVersion>1</CodeListVersion>
    <Description>113</Description>
</CodeList>
<CodeList>
    <CodeListName>A29</CodeListName>
    <CodeListVersion>1</CodeListVersion>
    <Description>113</Description>
</CodeList>

Code

const {XMLParser} = require('fast-xml-parser')
let parse = new XMLParser()
console.log(parser.parse(test));

Output

[
{ CodeListName: NaN, CodeListVersion: 1, Description: 113 },
{ CodeListName: 'A29', CodeListVersion: 1, Description: 113 }
]

expected data

[
{ CodeListName: E29, CodeListVersion: 1, Description: 113 },
{ CodeListName: 'A29', CodeListVersion: 1, Description: 113 }
]

Would you like to work on this issue?

  • Yes
  • No

Image

Bookmark this repository for further updates. Visit SoloThought to know about recent features.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions