I use node.js on windows. I want to evaluate xpath so I'm looking for a node.js xml module that can do this (not sax). So far I found Libxmljs but I am not able to install it on windows.
Any idea?
EDIT: I prefer not to use cygwin as more people will work on this and my experience is that cygwin will be confusing.
EDIT: This is the solution
You can try parsing an HTML file using a XML parser, but it's likely to fail. The reason is that HTML documents can have the following HTML features that XML parsers don't understand. XML parsers will fail to parse any HTML document that uses any of those features.
Reading XML from a File js has no inbuilt library to read XML. The popular module xml2js can be used to read XML. The installed module exposes the Parser object, which is then used to read XML. const xml2js = require('xml2js'); const fs = require('fs'); const parser = new xml2js.
I found it - use xmldom with xpath.js. Full details are here.
https://github.com/Leonidas-from-XIV/node-xml2js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With