andles / x2js

Automatically exported from code.google.com/p/x2js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set a null prefix

GoogleCodeExporter opened this issue · comments

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

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

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

  • Changed state: Accepted
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