This is standard text in the xml file I need to edit, example:
<?xml version="1.0"?>
<info>
<rect scale="8">
<x>300</x>
<y>295</y>
<width>370</width>
<height>540</height>
</rect>
</info>
Lets say its a XML file for a part of a clothing "238_9-0_Aquamarine"
Than there are 10 other dyes of this clothing
238_9-0_White
238_9-0_Grey
238_9-0_Yellow
etc....
1st question:
What I need to do is to change lets say <y>295</y> TO <y>275</y> in ALL selected files.
How to do it fast?
2nd question is:
how can I create lets say 1000 XML files called the same as the source PNG files? With this content lets say:
<?xml version="1.0"?>
<info>
<rect scale="8">
<x>100</x>
<y>100</y>
</rect>
</info>
Thank you!
HELP! How to edit/create multiple XML files at once
- King of Worms
- Posts: 4753
- Joined: Mon Oct 17, 2016 11:18 pm
- Location: Scourg Barrow (CZ)
- Contact:
HELP! How to edit/create multiple XML files at once
Last edited by King of Worms on Mon Oct 19, 2020 7:15 pm, edited 1 time in total.
DREAM Nexus https://www.nexusmods.com/users/73250038?tab=user+files
DREAM Forums viewtopic.php?f=27&t=1168
DISCORD: king_of_worms_cz
DREAM Forums viewtopic.php?f=27&t=1168
DISCORD: king_of_worms_cz
- TheLacus
- Posts: 1305
- Joined: Wed Sep 14, 2016 6:22 pm
Re: HELP! How to edit multiple XML files at once
You should be able to do it with any text editor that can open a folder instead of a single file at a time. Visual Studio Code is an example.
- King of Worms
- Posts: 4753
- Joined: Mon Oct 17, 2016 11:18 pm
- Location: Scourg Barrow (CZ)
- Contact:
Re: HELP! How to edit multiple XML files at once
Thank you, I will look into that direction. Ive edited in the 2nd question, its in bold, can u take a look please?
2nd question is:
how can I create lets say 1000 XML files called the same as the source PNG files? With this content lets say:
<?xml version="1.0"?>
<info>
<rect scale="8">
<x>100</x>
<y>100</y>
</rect>
</info>
Thank you!
DREAM Nexus https://www.nexusmods.com/users/73250038?tab=user+files
DREAM Forums viewtopic.php?f=27&t=1168
DISCORD: king_of_worms_cz
DREAM Forums viewtopic.php?f=27&t=1168
DISCORD: king_of_worms_cz
- pango
- Posts: 3359
- Joined: Wed Jul 18, 2018 6:14 pm
- Location: France
- Contact:
Re: HELP! How to edit/create multiple XML files at once
Under Unix I'd use a tool like xmlstarlet,
Then iterate over files to modify:
That tool has been compiled for Windows, so it should be usable there too, with some adjustments
Code: Select all
ᐅ xmlstarlet ed -u info/rect/y -v 275 /tmp/test.xml
<?xml version="1.0"?>
<info>
<rect scale="8">
<x>300</x>
<y>275</y>
<width>370</width>
<height>540</height>
</rect>
</info>
Code: Select all
ᐅ for file in /tmp/*.xml; do
mv "$file" "$file.old" &&
xmlstarlet ed -u info/rect/y -v 275 "$file.old" > "$file"
done
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
- Ferital
- Posts: 282
- Joined: Thu Apr 05, 2018 8:01 am
Re: HELP! How to edit/create multiple XML files at once
Under Windows, one of the best tool for this is the good old Notepad++, unsurpassed in many ways (fast, simple and efficient). I use several IDE for programming but when it comes to quickly open a file and find/replace something in a bunch of files, I always go back to Notepad++.
Install it, open it and go to "Search", "Find in Files..." (or Ctrl+Shift+F), you will find what you want there.
Install it, open it and go to "Search", "Find in Files..." (or Ctrl+Shift+F), you will find what you want there.
- King of Worms
- Posts: 4753
- Joined: Mon Oct 17, 2016 11:18 pm
- Location: Scourg Barrow (CZ)
- Contact:
Re: HELP! How to edit/create multiple XML files at once
Notepad++ sounds the best, thank you everyone
DREAM Nexus https://www.nexusmods.com/users/73250038?tab=user+files
DREAM Forums viewtopic.php?f=27&t=1168
DISCORD: king_of_worms_cz
DREAM Forums viewtopic.php?f=27&t=1168
DISCORD: king_of_worms_cz
- King of Worms
- Posts: 4753
- Joined: Mon Oct 17, 2016 11:18 pm
- Location: Scourg Barrow (CZ)
- Contact:
Re: HELP! How to edit/create multiple XML files at once
This prog (I used it before but only for basic notes) with the info you provided - instant success, thanks a lot!!!Ferital wrote: ↑Tue Oct 20, 2020 8:08 am Under Windows, one of the best tool for this is the good old Notepad++, unsurpassed in many ways (fast, simple and efficient). I use several IDE for programming but when it comes to quickly open a file and find/replace something in a bunch of files, I always go back to Notepad++.
Install it, open it and go to "Search", "Find in Files..." (or Ctrl+Shift+F), you will find what you want there.
DREAM Nexus https://www.nexusmods.com/users/73250038?tab=user+files
DREAM Forums viewtopic.php?f=27&t=1168
DISCORD: king_of_worms_cz
DREAM Forums viewtopic.php?f=27&t=1168
DISCORD: king_of_worms_cz