mapbox / mapbox/togeojson

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

Open
#147 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.3k
Forks
322
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Research direction

Start with the Node.js example in the issue and trace the tj.kml(kml, { styles: true }) path, comparing the xmldom Document with the value passed to XMLSerializer. Reproduce the error with the shown example; done means KML conversion with styles completes without the serializeToString Node-type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.