bodoni / svg

Composer and parser for SVG
Other
299 stars 45 forks source link

feature request: expose a way to create arbitrary element? #66

Closed gre closed 1 year ago

gre commented 1 year ago

I have a trivial need which is to create an element with some attributes on it, outside of scope of the elements provided in this library, and I don't seem to find an API to allow this. Element::new(name) can be created but it doesn't allows to set attributes and the struct Element is private.

Thanks

gre commented 1 year ago

Ok, I've found this way

let mut new_element = Element::new("plotdata");
for attr in attributes {
  new_element.assign(attr.0, attr.1);
}
abey79 commented 1 year ago

Came here for the same. Great "plotter minds" think alike? :)