Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1230.Advanced search and replace -- How to fill in one xml file with elements from another xml file?

User: Dilip -- 2014-08-09          << 1229  1231 >>
Hits: 997
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
I am having two xml files.

File1.xml is the pricing from the merchant and it is stock. So this is the
master data

Fil2.xml contains description.

I want to map File1.xml both <brand> and <sku> as criteria to File.2.xml and get
the description found in File2.xml.
Input Sample:
<----File1.xml--->

<?xml version=\"1.0\" encoding=\"utf-8\"?>
<document>
        <item>
                <brand>Audi</brand>
                <sku>123456</sku>
                <price>100000</price>
                <image>1.jpg</image>
        </item>
..

<---File2.xml--->
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<document>
        <item>
                <brand>Audi</brand>
                <sku>123456</sku>
                <description>This is 
description of Audi 123456.Some 
Output Sample:
<?xml version="1.0" encoding="utf-8"?>
<document>
<item>
<brand>Audi</brand>
<sku>123456</sku>
<price>100000</price>
<image>1.jpg</image>
<description>This is 
description of Audi 123456.Some more 
description about Audi</description>
</item>
<item>
<brand>Benz</brand>
<sku>12345</sku>
<price>200000</price>

<image>image2.jpg</image>
<description>This is 
description of Benz 12345.Some more 
description about Benz</description>
</item>
</document>
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
First of all, put file2.xml in d:\test\ folder, then:
1. ctrl-o open the master xml file: file1.xml
2. ctrl-h open 'replace' dialogue
* set 'search for pattern' to:

* set 'replace with pattern' to:

3. click 'replace', done.
4. ctrl-s save to file.

Screenshot 1:  Replace_Window


Similar Examples:
How to multiply column in one file with multiple columns in another? (62%)
How to replace a string in one text file with random words from another file? (62%)
How to extract from a file according to content of another file? (59%)
How to update values in xml file according to values from another xml? (58%)
How to split a 100 line text file into 100 text files? (58%)
How to shuffle all elements in a specified range in text file? (57%)
How to batch rename each html file to the title of the html file? (57%)
How to replace strings in one file with words from another file sequentially? (56%)

Check Demo of Advanced search and replace
Keywords:
avi  xml files  xml  xml file  desc  toc  stock  found  mer  script  replace all in with xml  xml files search and replace  xml search replace  xml search and replace  replace xml  two files  replace another  another file