Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to execute 'serializeToString' on 'XMLSerializer': parameter 1 is not of type 'Node' #147

Open
hekejian opened this issue Jul 20, 2018 · 1 comment

Comments

@hekejian
Copy link

help ! I run the example in node .
var tj = require('togeojson'),
fs = require('fs'),
// node doesn't have xml parsing or a dom. use xmldom
DOMParser = require('xmldom').DOMParser;

var kml = new DOMParser().parseFromString(fs.readFileSync('foo.kml', 'utf8'));

var converted = tj.kml(kml);

var convertedWithStyles = tj.kml(kml, { styles: true });
but it throw the error "Failed to execute 'serializeToString' on 'XMLSerializer': parameter 1 is not of type 'Node'", I checked the var kml , it is the type of Document

@sgelb
Copy link

sgelb commented Jul 23, 2018

I ran into the same error message when I unintentionally used the npm package dom-parser although I was running togeojson in a browser. Switching to the DOMParser interface solved my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants