# How to edit the path of an SVG using the code

**URL:** <https://discourse.processing.org/t/how-to-edit-the-path-of-an-svg-using-the-code/22604>\
**Category:** Coding Questions\
**Created:** [July 14, 2020, 8:41am UTC](https://discourse.processing.org/t/how-to-edit-the-path-of-an-svg-using-the-code/22604 "2020-07-14T08:41:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeathEater](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@DeathEater](https://discourse.processing.org/u/DeathEater)\
**Post date:** [July 14, 2020, 8:41am UTC](https://discourse.processing.org/t/how-to-edit-the-path-of-an-svg-using-the-code/22604/1 "2020-07-14T08:41:43Z")

</div>

In the path of an SVG file \<path id =“12121”, fill=“FF0000”…\>. How to get the attributes inside the path and edit any specific attribute. For example, if i want to change the color of that path for any selected ids. how do i write a code for that?  
Thank you

---

<div class="post-metadata">

**Author:** ![matheplica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/matheplica/32/21035_2.png) [@matheplica](https://discourse.processing.org/u/matheplica)\
**Post date:** [July 15, 2020, 3:10pm UTC](https://discourse.processing.org/t/how-to-edit-the-path-of-an-svg-using-the-code/22604/2 "2020-07-15T15:10:19Z")

</div>

I use xml and svg work similar I think.

```auto
slImg = loadXML("images.xml");
    slImgs = slImg.getChildren("diapo");
    for (int i=0; i<slImgs.length; i++) {
        XML[] imgs;
        imgs = slImgs[i].getChildren("path");
        for (int j=0; j<imgs.length; j++) {
            int x = imgs[j].getInt("x");//here put your attribute

}

```
