I've read through the documentation, and some of the source code of
jsdom.js, and it seems like it should be possible to use jsdom to
parse an XML document so that it can be manipulated with the DOM Level
2 Core API. I've followed the instructions in this code snippet in the
README:
level is null (which means level3) by default, but you can pass
another level if you'd like.
var jsdom = require('jsdom'),
doc = jsdom.jsdom('<html><body></body></html>', jsdom.dom.level1.core)
jsdom.dom.level1 is actually not exposed on jsdom.dom (it seems that
only level 3 is), but I was able to reference it by passing the full
path to the module. Unfortunately, the results were the same: in the
resulting document, doc.documentElement was none, the element that
should have been the documentElement was the first child, and tagName
returned the tag's name in normalized uppercase.
I then dove into the source of jsdom, and found the following code snippets
var dom = exports.dom = require("./jsdom/level3/index").dom,
...
exports.defaultLevel = dom.level3.html;
I tried changing these to:
var dom = exports.dom = require("./jsdom/level2/index").dom,
...
exports.defaultLevel = dom.level2.core;
With the intention that it would use core XML DOM, as opposed to HTML
DOM, but the results were the same as above.
I'm not sure where I'm going wrong, or what else to try. It seems like
what I'm attempting should be possible, and I also seem to be
following the documentation, but it doesn't seem to be working. I'd
appreciate any guidance anyone can offer into this. Thanks,
Jake