znerol / node-xmlshim Goto Github PK
View Code? Open in Web Editor NEWDOMWriter and XMLParser for node.js
License: MIT License
DOMWriter and XMLParser for node.js
License: MIT License
Not sure if this is a jsdom or xmlshim issue, but here goes...
Tag cases in documents parsed with xmlshim's DOMParser generally preserve their original cases, but as soon as you use jsdom to parse HTML, xmlshim's behavior changes and starts returning them as uppercase. Sample script:
var DOMParser = require('xmlshim').DOMParser;
var jsdom = require("jsdom");
console.log((new DOMParser()).parseFromString('<xml></xml>', 'text/xml').documentElement.tagName);
jsdom.jsdom("<html><head></head><body></body></html>");
console.log((new DOMParser()).parseFromString('<xml></xml>', 'text/xml').documentElement.tagName);
This produces:
xml
XML
Per jsdom/jsdom#175 it does look like jsdom switches its behavior back and forth depending on whether or not it thinks it's parsing HTML or XML, but that bug implies that it's per-document. It looks from this example, though, like jsdom and xmlshim are sharing global state in a way I wouldn't have expected.
This is all on node 0.6.8, jsdom 0.2.10, and xmlshim 0.0.3.
var DOMParser = require("xmlshim").DOMParser;
var parser = new DOMParser();
var xml = parser.parseFromString("", 'text/xml');
Will crash node
> var DOMParser = require("xmlshim").DOMParser;
> var parser = new DOMParser();
> var xml = parser.parseFromString("", 'text/xml');
node: ../src/xml_sax_parser.cc:71: void libxmljs::XmlSaxParser::initializeContext(): Assertion `context_' failed.
[1] 1682 abort (core dumped) node
Seems libxmljs
finally got Node12
But where is no release yet. Maybe we can fetch code from master branch?
npm install xmlshim
no longer works, because the libxmljs
dependency no longer builds under recent node versions.
Node v4.3.0, npm v2.14.12.
See issue: libxmljs/libxmljs/issues/546
I do not think a patch is coming anytime soon - the issue's been hanging since late April and hasn't even been acknowledged by the creator.
Suggestion would be to switch to dependency on libxmljs2
need support node >=10
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.