Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1032.Regular expression replace -- How to replace the content of XML with a list of words from text file?

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


Similar Examples:
How to replace a word with a list of words repeatly in a text file? (76%)
How to count the occurrence of a list of words in a text file? (72%)
How to replace a list of words with one single word? (67%)
How to replace content of many files with text from a template file? (67%)
How to replace each xxx with the first word in the same line in text file? (67%)
How to replace the second character of every line to 4 in a text file? (67%)
How to replace one specified word with a sequence of words from a file? (66%)
How to replace or remove 3 lines randomly in a text file? (65%)

Check Demo of Regular expression replace
Keywords:
spreadsheet  phone  xml files  xml  xml file  tags  times  list of words  tag  rules  text to spreadsheet  xml files search and replace  xml search replace  xml search and replace  add list of words  replace xml  file content replace windows  replace words from list