Get 'Curve2D's from raw svg file?

Godot Version

4.3

Question

A while ago while working with Curve2Ds I found this reddit post
It was about saving a curve2D into an SVG file

Is there a way to do the opposite thing, extrapolating from an SVG file the Curve2D(s) that compose it?

I need that for a function that given an input ranging from 0 to 1 returns a point on a specific pre-defined curve, and to define that curve I wanted to use SVG files

Please help me! I have no idea how to do that!
Thanks in advance!

Yes it should be possible, SVG is simply a text file in XML format (like HTML)

Thanks for the reply!
But how would you do that?

Try XMLParser — Godot Engine (stable) documentation in English

Interesting! I’m defenetly gonna try that!

Step 1: “path” parsing, “d” value/attribute or “data” (?)

var path_string := '<path d="%s" fill="none" stroke="#%s" stroke-width="%f"/>' % [
         data_string, stroke_color.to_html(false), stroke_width,
    ]

I’m not an SVG expert, you would have to research whether there are several options.