linkeddata / rdflib.js

Linked Data API for JavaScript
http://linkeddata.github.io/rdflib.js/doc/
Other
565 stars 143 forks source link

node compatibility error #41

Open ariutta opened 10 years ago

ariutta commented 10 years ago

I tried adding a node.js example here, but the parser claims root is null, with the following error:

/mypath/rdflib.js/dist/rdflib.js:6999
                if (root.nodeName == 'parsererror') { //@@ Mozilla only See is
                        ^
TypeError: Cannot read property 'nodeName' of null
    at xhr.handle (/mypath/rdflib.js/dist/rdflib.js:6999:25)
    at null.onreadystatechange (/mypath/rdflib.js/dist/rdflib.js:7851:25)
    at dispatchEvent (/mypath/rdflib.js/node_modules/XMLHttpRequest/lib/XMLHttpRequest.js:570:25)
    at setState (/mypath/rdflib.js/node_modules/XMLHttpRequest/lib/XMLHttpRequest.js:589:14)
    at IncomingMessage.<anonymous> (/mypath/rdflib.js/node_modules/XMLHttpRequest/lib/XMLHttpRequest.js:427:13)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

When I run an n3-example, the body is undefined.

Both of the above two were when running the code from my copy of the repo itself. When I npm install rdflib in a directory containing just one file with the code from the n3 example, I get the following error:

Asynch fetch fail: Error trying to parse <http://bblfish.net/people/henry/card> as Notation3:
Line 1 of <http://bblfish.net/people/henry/card>: Bad syntax: ']' expected
at: "cert:modulus"B9234D5F150539282":
undefined for http://bblfish.net/people/henry/card
ariutta commented 10 years ago

I specified that xmldom is to be used when running in Node.js: here, and it works. I didn't make a pull request, because I haven't fully tested the code.