Search code examples
xmlnode.jssax

Which library can be used for parsing big xml files using css/xpath selectors in nodejs?


I love sax parser. But i have to handle nesting level while parsing my files.

I would much more usable to use css (or in worst way xpath) paths.

Could you please advise one?

I definitely don't want anything based on node-expat, and would like sax-based solutions. I'd write one, but it seems that there are a lot of similar solutions, but i can't find something really working in all nodejs' mess.


Solution

  • CSS selector parser that work with data streams:

    html-select

    XPATH parsers based on SAX:

    saxtract

    saxpath

    Please note both of the libraries for xpath are not very tolerant for invalid xml in the parsed document.