cyrfer / x2js

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

Namespaces stripped from elements but not attributes #34

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Parse an XML string containing namespaced elements *and attributes* into 
JSON.
2. Note that while namespaces are stripped from the element names (which become 
keys in the JSON), the namespaces are still present in the attribute key names.

I'm not sure if this is deliberate or not, but it seems like it should be 
consistent. Since namespaces are removed from the element names in the JSON 
output, it seems like they should be removed from the attribute names as well. 
The namespace IS properly populated in the "__prefix" key for attributes, so 
it's there is someone needs it (just as it is for elements).

Also, not sure if this would affect the translation from JSON back to XML. If 
it doesn't already, I'd say it should take the __prefix and prepend it to the 
attribute name, which is how I assume it already works for elements?

Original issue reported on code.google.com by brian...@gmail.com on 23 Jan 2015 at 3:40