-
-
Notifications
You must be signed in to change notification settings - Fork 357
Closed
Description
- 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?
Description
It seems like something in the recent version (3.16.0 seems to not have this problem) changed the behavior of the parsing for namespaced tags with no attributes. Until now these would be parsed as simple strings, but recently they are parsed as objects. Apparently, from the change-log, this was not an intended change.
Input
This can be reproduced in the online tool by using the following input
<example>This is a test</example>
<ns1:otherexample>This is another test</ns1:otherexample>
And only selecting these options:
Remove namespace string from tag and attribute names.Allow Boolean Attributes
Un-selecting either of them gives an expected output.
Code
var xml = "<example>This is a test</example><ns1:otherexample>This is another test</ns1:otherexample>"
parser.parse(xml, {
ignoreNameSpace: true,
allowBooleanAttributes: true,
ignoreAttributes: false,
});Output
{
"example": "This is a test",
"otherexample": {
"#text": "This is another test",
"@_otherexample": true
}
}
expected data
{
"example": "This is a test",
"otherexample": "This is another test"
}
Would you like to work on this issue?
- Yes
- No
Bookmark this repository for further updates.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels