bharath456 / x2js

Automatically exported from code.google.com/p/x2js
0 stars 0 forks source link

Set a null prefix #30

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'd like to have no prefix set by the parsing at all. The issue comes in from: 
config.attributePrefix = config.attributePrefix || "_";
When passing in an empty string (attributePrefix: ""), this evaluates to false, 
and the underscore is set as the prefix. 

Original issue reported on code.google.com by colinwma...@gmail.com on 7 Oct 2014 at 8:29

GoogleCodeExporter commented 9 years ago
Hello, I was trying the same, so I modify the line which initializes 
config.attributePrefix in initConfigDefaults() function. I've changed the 
original one with:

config.attributePrefix = (typeof config.attributePrefix !== "string") ? "_" : 
config.attributePrefix;

and now can use empty string as prefix. If you don't pass any value, it keep 
working as original version.

Regards

Original comment by jmsanche...@gmail.com on 11 Nov 2014 at 9:50

GoogleCodeExporter commented 9 years ago

Original comment by abdulla....@gmail.com on 12 Nov 2014 at 11:08

GoogleCodeExporter commented 9 years ago
Hello,

I was also trying to have an empty string as prefix. But I saw, that you use in 
other places the keyword "none" - this would also ok for me to have an empty 
prefix.

Thank You for your library!

Regards

Original comment by ottmar.g...@gmail.com on 7 Jan 2015 at 9:30