rubyjs / therubyracer

Embed the V8 Javascript Interpreter into Ruby
1.67k stars 190 forks source link

[Question] Howto pass a XML Object to loaded context #376

Closed computerlyrik closed 8 years ago

computerlyrik commented 8 years ago

Hi there!

I am using therubyracer with a custom Javascript that wants an XML-Objekt as an param. My code currently fails on TypeError: Cannot read property 'nodeType' of undefined because i try to put the xml-String into the JS-Method directly.

How do i achieve the requirement to convert the String into a JS-capable XMLDocument and pass it to the Script?

computerlyrik commented 8 years ago

My current approach - Using the DOM-Parser - is not working due to no ability to require("dom").

Is it available in the V8-Implementation?

cowboyd commented 8 years ago

V8 does not come with a DOM implementation. You may consider using something like jsdom.