sports-lib icon indicating copy to clipboard operation
sports-lib copied to clipboard

Using xmldom as default DOMParser

Open codebyshennan opened this issue 2 years ago • 1 comments

This library has been of great help, but the guide should be clear that in NodeJS usage, another DOMParser (e.g. xmldom) should be included as an argument in 'importFromGPX()'. Had to trawl the importer js files to find out.

In the case of Node JS: npm i xmldom

import {SportsLib} from '@sports-alliance/sports-lib';
import { DOMParser } from 'xmldom'

// For GPX you need a string 
const gpxString = 'Some string from a file etc';
SportsLib.importFromGPX(gpxString, DOMParser).then((event)=>{
...
});

codebyshennan avatar Sep 06 '21 07:09 codebyshennan

Thank you very much for taking the time to report this. A PR is welcome, as I am on vacation atm

Thanks again and may you have a great week

jimmykane avatar Sep 06 '21 08:09 jimmykane