Victor Charles
asked on
Help with merging multiple files in file1 based on identical values in file2 using VB.NET
Hi,
If file1.xml contains:
<?xml version="1.0" encoding="utf-8"?>
<Root>
<AOP6A>
<SN>10412</SN>
<CHPT>104</CHPT>
<CA></CA>
</AOP6A>
<AOP6A>
<SN>10471</SN>
<CHPT>105</CHPT>
<CA></CA>
</AOP6A>
</Root>
and file2.xml contains:
<?xml version="1.0" encoding="utf-8"?>
<Root>
<AOP5>
<SN>10412</SN>
<CHPT>104</CHPT>
<Ctry>BEL</Ctry>
</AOP5>
<AOP5>
<SN>10412</SN>
<CHPT>105</CHPT>
<Ctry>FRA</Ctry>
</AOP6A>
How do I enter Ctry values to iCA element in file1 based on matching SN, for example above, file1.xml should be as follows:
<?xml version="1.0" encoding="utf-8"?>
<Root>
<AOP6A>
<SN>10412</SN>
<CHPT>104</CHPT>
<CA>BEL,FRA</CA> 'Data from file2 based on SN = 10412 in both files
</AOP6A>
<AOP6A>
<SN>10471</SN>
<CHPT>105</CHPT>
<CA></CA>
</AOP6A>
</Root>
Thanks,
Victor
If file1.xml contains:
<?xml version="1.0" encoding="utf-8"?>
<Root>
<AOP6A>
<SN>10412</SN>
<CHPT>104</CHPT>
<CA></CA>
</AOP6A>
<AOP6A>
<SN>10471</SN>
<CHPT>105</CHPT>
<CA></CA>
</AOP6A>
</Root>
and file2.xml contains:
<?xml version="1.0" encoding="utf-8"?>
<Root>
<AOP5>
<SN>10412</SN>
<CHPT>104</CHPT>
<Ctry>BEL</Ctry>
</AOP5>
<AOP5>
<SN>10412</SN>
<CHPT>105</CHPT>
<Ctry>FRA</Ctry>
</AOP6A>
How do I enter Ctry values to iCA element in file1 based on matching SN, for example above, file1.xml should be as follows:
<?xml version="1.0" encoding="utf-8"?>
<Root>
<AOP6A>
<SN>10412</SN>
<CHPT>104</CHPT>
<CA>BEL,FRA</CA> 'Data from file2 based on SN = 10412 in both files
</AOP6A>
<AOP6A>
<SN>10471</SN>
<CHPT>105</CHPT>
<CA></CA>
</AOP6A>
</Root>
Thanks,
Victor
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Fernando,
How do you modify the code to remove duplicates in <CA> and also sort the data.
Thank You.
victor
How do you modify the code to remove duplicates in <CA> and also sort the data.
Thank You.
victor
ASKER
Hi,
I am able to sort the data In CA, but how do you remove or avoid duplicates in <CA>.
Thanks,
Victor
I am able to sort the data In CA, but how do you remove or avoid duplicates in <CA>.
Thanks,
Victor
ASKER
Hi,
The solution for the second question in in another post.
Thanks,
victor
The solution for the second question in in another post.
Thanks,
victor
ASKER
Thank You!
Not a problem Victor, glad to help.
ASKER