Giter Site home page Giter Site logo

Comments (2)

neslib avatar neslib commented on July 28, 2024

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.

fschenckel avatar fschenckel commented on July 28, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.