I am currently working on a project that needs to process a bunch of SVG files by applying a few predefined operations on them, for example:
- Find an element with id
door
and set itsfill
attribute toblack
,- Find an element with id
roof
and set itsclass
attribute toon-fire
,- Change the
width
,height
, andviewport
attributes of the rootsvg
element to shrink the image on the x-axis by 50%,- β¦and so on.
Afterward, I need to export the data back to a string representing a valid SVG document.
The Erlang xmerl library is capable of doing all of those operations. Unfortunately, itβs not that easy for an Elixir developer without a solid Erlang background to use.
Today Iβm sharing with you what learned about using xmerl in your Elixir project: how to parse strings containing XML documents, modify them, and export back to string.
continue reading on angelika.me
β οΈ This post links to an external website. β οΈ
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.