cxml icon indicating copy to clipboard operation
cxml copied to clipboard

Bug with parsing an array of numbers with value 0

Open xerom opened this issue 8 years ago • 2 comments

Hi,

There seems to be a bug when parsing 0 values from an array like this from xml: <values><value>1</value><value>0</value><value>2</value></values> which ends up in a json object like: values: [1, 2]

Hopefully that'd be easy to fix.

xerom avatar May 11 '17 20:05 xerom

This affects version 0.1.1 (which is effectively the current stable version). It's also more general than <xs><x>0</x><x>1</x></xs>. It affects any element with the text content 0. Such elements will be parsed as {_exists: false} in the resulting object.

ironchicken avatar Nov 26 '19 08:11 ironchicken

I have a fork with a fix against the v0.1.1 tag: https://github.com/charto/cxml/compare/v0.1.1...ironchicken:bug/parsing-0-text.

But I don't think you can open a pull request against a tag Github, and this bug no longer exists in master.

I think the 0.1.1 branch is important because it's the only one that you can use in any context where you have a plain JavaScript runtime without relying on native code.

ironchicken avatar Nov 26 '19 09:11 ironchicken