Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js library implementing W3C XML DOM?

Tags:

dom

node.js

xml

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 implementation, 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?

like image 897
jbeard4 Avatar asked Jun 05 '11 02:06

jbeard4


2 Answers

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

good luck

like image 110
user1409346 Avatar answered Oct 25 '22 18:10

user1409346


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.

like image 21
Bill Barnhill Avatar answered Oct 25 '22 20:10

Bill Barnhill