Comments (2)
Hi Frédéric,
This is a design decision. As far as I know, there is no official rule for how whitespace should be handled. Some libraries (like mine) ignore whitespace, while others preserve all whitespace, and still others make it configurable through a property or settings.
The primary goal of my library is to keep the XML document in memory as small as possible. Preserving whitespace would add additional nodes to the tree which is undesirable in most cases (since this is not real content). It could make traversing the tree harder, especially if the single space wasn't originally intended to be inside the XML document.
Maybe I'll add a WhitespaceHandling property or something in the future that you can use to configure how whitespace should be handled. For now, I would like to keep things simple though.
Of course, you are free to modify the library for your own needs or fork it. You could also try to implement this WhitespaceHandling property yourself and create a pull request. In that case, you will have to update the unit tests as well so they work both with and without preserving whitespace.
Hope this helps,
Erik
from neslib.xml.
Hi Erik,
OK, this is more or less what I expected. The only thing which is not really consistent is that it's only in case of single space.
For example ' test' or 'te st' or 'test ' are correctly retrieved. This is why it's a little disturbing. But of course this is not a big deal !!
I don't know in details the WhitespaceHandling property but this would probably need to keep or remove also the spaces in these examples...
I will take a look regarding the modification needed concerning the implementation of this property.
Thanks !
Frédéric
from neslib.xml.
Related Issues (8)
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 neslib.xml.