Delete and Insert Help

JamesKK

New member
Joined
Jun 8, 2005
Messages
1
Location
Mississippi
Programming Experience
10+
I have a unique challenge. I have two XML files that have an identidal structure. However, one file (File A) will update the other (File B). The trick is that File B contains information that must remain in the resulting file. The end product has to have the updated information only. Which means we need to remove the elements that will be updated but leave the others alone.

(File A)
<?xml version="1.0"?>
<!-- Avista -->
<MVLoan Version="1.0" Loan_ID="245-1028" CaseName="CHRISTOPHER COCOZELLO" CaseProgram="W2101" CaseInsured="" CaseIns="" CaseState="SC" CaseRefi="0" CaseBydn="0" CaseBlln="0" CaseSecMtg="0" ActiveBuyer="" Mode="" Severe="0" Warning="0" WholesaleIndicator="">
<LoanData>
<System>
<Question Num="6">NONE</Question>
<Question Num="8">NONE</Question>
<Question Num="219">F</Question>
<Question Num="222">New Question 1</Question>
<Question Num="223">New Question 2</Question>
<Question Num="401">250000.00</Question>
<Question Num="402">5.500</Question>
<Question Num="403">360</Question>
</System>
</MVLoan>

(File B)
<?xml version="1.0"?>
<!-- MORvision -->
<MVLoan Version="1.0" Loan_ID="245-1028" CaseName="CHRISTOPHER COCOZELLO" CaseProgram="W2101" CaseInsured="" CaseIns="" CaseState="SC" CaseRefi="0" CaseBydn="0" CaseBlln="0" CaseSecMtg="0" ActiveBuyer="" Mode="" Severe="0" Warning="0" WholesaleIndicator="">
<LoanData>
<System>
<Question Num="6">NONE</Question>
<Question Num="8">NONE</Question>
<Question Num="219">F</Question>
<Question Num="222">New Question 1</Question>
<Question Num="223">New Question 2</Question>
<Question Num="401">180000.00</Question>
<Question Num="402">5.500</Question>
<Question Num="403">360</Question>
</System>
</MVLoan>

Help! I need to make multiple changes and have tried several different methods. XML is new to me and I could use a good kickstart! Thanks very much for any help...

</Jim>
 
Though some complicated method are avialable to do the trick but i can list here a simple one
as i got ur XML files , i pick that your information that can be change is only the elements with Question Elements (Am i right ?? ) so if it is here is simple method to do that
Dim list XmlNodeList
Dim node as XmlNode
dim count as integer
listA = docA.SelectNodes("//Question")
listB = docB.SelectNodes("//Question")
for each node in list
if node.FirstChild.Value <> listb.item(count).FirstChild.Value then
// do what ever u want as info has updated
// like to update the old one with new info and then use as final data
end if
count = count +1
next

for more info plz reply
 
Back
Top