Comments (12)
from fast-xml-parser.
Umm, sorry if I'm missing some point. But I never seen namespace with attribute's value. Can you please give me some reference from w3 or wikipedia? I would be interested to know more about it as I may have to update the validator and may have to handle some negative scenarios.
from fast-xml-parser.
@amitguptagwl for example http://www.xmlplease.com/xml/attributexmlns/
Namespace can be specified as simply xmlns
attribute for element cause it default for self and children and even can be specified for single attribute.
So I offer to remove xmlns
attribute as well in ignoreNamespace mode.
I updated my PR to include this, tests updated. Also make Coverage only for Library code, not for tests
from fast-xml-parser.
Currently when we ignoreNamespace
input XML
<xp:products xmlns:xp="http://www.xmlplease.com">
<xp:product id="p1"/>
</xp:products>
Output JSON
{
"products": {
"xp": "http://www.xmlplease.com",
"product": {
"id": "p1"
}
}
}
What should be output after your changes?
from fast-xml-parser.
{
"products": {
"product": {
"id": "p1"
}
}
}
from fast-xml-parser.
I appreciate your effort for the changes. But I believe this change may impact some projects using this library. So until there are some users who want this change explicitly, we should hold this change.
Or if we think in a way that when people ignoring namespace, would it benefit them to ignore xmls attribute or not to have at all in JSON.
from fast-xml-parser.
@amitguptagwl if we remove namespaces from all elements and from all attributes, what the purpose of namespace values in output? Using this namespace urls we still cannot differ namespaced elements & attributes from plain, but can make some incosistence with attributes in output, that does not make any meaning in output
from fast-xml-parser.
@amitguptagwl
For example:
Valid XML
<root attr="value" xmlns:attr="urn:none">1</root>
Code:
parser.parse(xml,{ignoreTextNodeAttr : false, ignoreNameSpace : true})
Current output:
{"root":{"@_attr":"urn:none","#text":1}}
PR output:
{"root":{"@_attr":"value","#text":1}}
from fast-xml-parser.
I agree with you.
from fast-xml-parser.
Thanks you took care of tests and browser lib js file. I'll publish the changes soon.
from fast-xml-parser.
@amitguptagwl Thanks to you for offer this parser to everyone
from fast-xml-parser.
Did anything come of this?
from fast-xml-parser.
Related Issues (20)
- V3 to V4 migration guide? HOT 5
- Circular Dependency Error While trying to validate xml HOT 3
- Online demo does not handle DOCTYPE correctly and gives an error HOT 2
- Regex Injection Via Doctype Entities HOT 4
- unreliable for parsing html HOT 2
- Introduce isObject option for unpaired tags HOT 2
- Parsing of Empty Tags HOT 4
- Entities are being processed in CDATA sections HOT 1
- Attribute in oneListGroup is not parsed correctly HOT 1
- All special characters are not correctly parsed HOT 4
- Ability to read & write DOCTYPE information HOT 2
- parser malfunctions when textNodeName is the same as a tag name HOT 8
- Node attributes get lost on XML parsing HOT 1
- Decimal point is not preserved after parsed to json. HOT 6
- Difficulty treating some numeric tags as string HOT 2
- XML parse looks good on Online tool, but when using API crashes HOT 2
- Any tag which has a format like <!D%s> where %s - any sequence of characters is perceived as <!DOCTYPE> and causes error HOT 2
- Not getting attribute value using XMLBuilder.build function HOT 7
- Object doesn't support property or method 'trimStart' HOT 3
- Parser erroneously adds `"@_/": true` attr for self-closing stop nodes HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fast-xml-parser.