Find & Replace All Genre in XML file
Posted: Sun Apr 28, 2013 5:21 pm
Hello, I have a folder called "Movie" and underneath that folder I have category folders like "Comedy", "Drama", etc.. Inside those folder I have individual movie folders like "Caddy Shack".
So the directory structure is: Movie\Comedy\Caddy Shack\*.*
Inside each individual movie folder is an XML file with a ton of info in it. The main content I want to modify is the "Genre". The reason is most movies have several genre's but not all main genre's are listed 1st or 2nd which is how my media player picks up this text and categorizes it by itself.
So the section in each *.xml file looks exactly like this (sometimes there are up to 5 or 6 genre's):
<genre>
<name>Comedy</name>
<name>Action</name>
</genre>
What I want to do is look for the <genre> heading in each file automatically inside each category directory (Comedy - all main and sub folders) and replace everything in-between <genre> and </genre> with 1entry which for our example above could be <name>Comedy</name>
The Genre I want to have as 1 entry may already be there and it may not. Everything else should be gone in between the Genre start and finish tags except the Genre specified in text crawler. In addition, the <genre> start tag is not always on the same line in every file depending upon how much data is before it.
How can I setup text crawler to do this??
Thanks!
So the directory structure is: Movie\Comedy\Caddy Shack\*.*
Inside each individual movie folder is an XML file with a ton of info in it. The main content I want to modify is the "Genre". The reason is most movies have several genre's but not all main genre's are listed 1st or 2nd which is how my media player picks up this text and categorizes it by itself.
So the section in each *.xml file looks exactly like this (sometimes there are up to 5 or 6 genre's):
<genre>
<name>Comedy</name>
<name>Action</name>
</genre>
What I want to do is look for the <genre> heading in each file automatically inside each category directory (Comedy - all main and sub folders) and replace everything in-between <genre> and </genre> with 1entry which for our example above could be <name>Comedy</name>
The Genre I want to have as 1 entry may already be there and it may not. Everything else should be gone in between the Genre start and finish tags except the Genre specified in text crawler. In addition, the <genre> start tag is not always on the same line in every file depending upon how much data is before it.
How can I setup text crawler to do this??
Thanks!