User: Jorge -- 2012-12-12 << 1031 1033 >> |
Hits: 4128 |
Type: Regular expression replace |
Search all Regular expression replace examples |
Description: |
I have to insert and sometimes replace the content of XML Tags with data from a list or spreadsheet. For example mocking up data. |
Input Sample: |
Sample.xml: <Person:BirthDate>1910-10-2</Person:BirthDate>.... <Address>sample address</Address> <Phone>sample phone</Phone> There is A text file content.txt with 3 lines: 1968-04-23 my address my telephone |
Output Sample: |
Replace/populate the xml file content with data from text file: <Person:BirthDate>1968-04-23</Person:BirthDate>.... <Address>my address</Address> <Phone>my telephone</Phone> |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
Assume the text file is d:\test\data.txt 1. open "Tools->Batch Runner" menu 2. drag xml files from windows file manager to "Batch Runner" window 3. click "Fast Replace" to open "Fast Replace" dialogue 4. click "add" to add new rules * set 'search' to: * set 'replace' to: * click 'ok' 5. click 'add' again to add other info: * set 'search' to: * set 'replace' to: * click 'ok' * set 'search' to: * set 'replace' to: * click 'ok' 7. make sure "reg exp" is checked, click "start", done. |
Screenshot 1: Fast_Replace_Window |