svgdotjs / svgdom

Straightforward DOM implementation to make SVG.js run headless on Node.js
MIT License
269 stars 53 forks source link

Error: Unbound namespace prefix: "svgjs" #99

Closed BuyingANew-Soul closed 1 year ago

BuyingANew-Soul commented 1 year ago

I am trying to create a svg file from some existing svg elements. `

Code:BR 4001, Size:X L Code:BR 4001, Size:X L

This is the structure of the elements. I am holding this as a string in a variable named "elements" and trying to create a svg file as follows: const { createSVGWindow } = require('svgdom') const window = createSVGWindow() const document = window.document const { SVG, registerWindow } = require('@svgdotjs/svg.js')

// register window and document registerWindow(window, document);

const svgFromString = (string) => {

const draw = SVG(document.documentElement);
var svg = draw.svg(string);
return svg;

}; var newsvg = svgFromString(elements) ` I am getting this error: Unbound namespace prefix: "svgjs" on the last line. I am able to create svg this way with similar files, but getting error on these specific svg files, from where the elements were taken. [https://drive.google.com/file/d/1sxDc1-XsB0cip575btGCG6yHw7VNuZqy/view](here is svg file I'm working with)