05-18-2014, 03:14 AM
Been a while since I've used QM and could use some help finding the right approach for this task:
in a target XML file, I need to find every line that contains <string name="Path" and then change its value from a PC path to a Mac path.
For example, the following line will appear many times in an XML file:
<string name="Path" value="X:\AUDIO PROJECTS\TestFolder\"/>
For each one, I need to
A) replace the PC drive name X: in the value field with its Mac equivalent /Volumes/AUDIO SSD
B) turn all the backslashes in the value field into forward slashes, so each occurrence now looks like this:
<string name="Path" value="/Volumes/AUDIO SSD/AUDIO PROJECTS/TestFolder/"/>
Note: The PC drive name "X:" and replacement Mac equivalent "/Volumes/AUDIO SSD" will always be used in the XMLs I need to process, but the rest of the path will change from XML to XML.
I think I can probably figure it out eventually, but some help getting started would be appreciated. How to find and each line with "<string name="Path"" and load whole line to manipulate, or is there a simple way using QM XML tools to get the value for Path each time it occurs and then I can manipulate its value? Been too long...
Thanks!
in a target XML file, I need to find every line that contains <string name="Path" and then change its value from a PC path to a Mac path.
For example, the following line will appear many times in an XML file:
<string name="Path" value="X:\AUDIO PROJECTS\TestFolder\"/>
For each one, I need to
A) replace the PC drive name X: in the value field with its Mac equivalent /Volumes/AUDIO SSD
B) turn all the backslashes in the value field into forward slashes, so each occurrence now looks like this:
<string name="Path" value="/Volumes/AUDIO SSD/AUDIO PROJECTS/TestFolder/"/>
Note: The PC drive name "X:" and replacement Mac equivalent "/Volumes/AUDIO SSD" will always be used in the XMLs I need to process, but the rest of the path will change from XML to XML.
I think I can probably figure it out eventually, but some help getting started would be appreciated. How to find and each line with "<string name="Path"" and load whole line to manipulate, or is there a simple way using QM XML tools to get the value for Path each time it occurs and then I can manipulate its value? Been too long...
Thanks!