开发者

Node.js library implementing W3C XML DOM?

开发者 https://www.devze.com 2023-03-10 17:14 出处:网络
I\'ve written some code to manipulate an XML document using standard W3C DOM APIs. It works well in the browser environment, and I\'d like to get it to work under node.js. Unfortunately, I have not be

I've written some code to manipulate an XML document using standard W3C DOM APIs. It works well in the browser environment, and I'd like to get it to work under node.js. Unfortunately, I have not been able to find a working node.js library implementing standard W3C DOM APIs. Here are the libraries I have tried:

  • node-o3-xml - segfaults on parse
  • node-o3-fastxml - segfaults on parse
  • libxmljs - does not use standard W3C DOM APIs
  • jsdom - uses HTML DOM, rather than XML DOM (e.g. element.tagName will return the uppercase form, rather than case-sensitive form)

I could write a second i开发者_如何学编程mplementation, using a different API, to perform the same function, but I'd rather find a library that will expose these standard interfaces, so that I can use the same code in both contexts. Is there a working node.js library that implements the W3C DOM API?


XMLDOM might be a good choice, it's a W3C Standard based DOMParser and XMLSerializer (DOM Level2 CORE)

good luck


Cloud9 uses node-o3-xml, but I have had a horrible time with it while developing on a Mac. I talked to some folks in the #nodejs IRC room and the prevaling choice seemed to be libxmljs. I've used that myself and it seems to work well, though it's not the W3C DOM API.

0

精彩评论

暂无评论...
验证码 换一张
取 消