Need to add a node at a specific position in XML in QTP

danyesu

New Member
I need to add a node at a specific position. please check the example below.\[code\]<root><ASNHeader><ASNStart>text</ASNStart><ASNprop>text_prop</ASNprop><ASNDetail><ASNAprvr>Mr.X</ASNAprvr><ASNAprvrDt>20Mar</ASNAprvrDT><ASNAprvrSub>XXX</ASNAprvrsUB></ASNDetail><ASNSHIP>XYZ</ASNSHIP><ASNSRDC>XYZ123</ASNSRDC></ASNHeader></root>\[/code\]Here i have to copy "ASNDetail" tag and paste it after existing "ASNDetail" and before "ASNSHIP" tag. I need to copy paste this based on the number of times user specifies.Note: I have to do this in QTP and i'm using MSXML2.DomDocument as xml parser. can anyone suggest a way. AppendChild copies it after "ASNSRDC" tag but i don't want in this way.Here "ASNHeader" is child of "root". ASNDetail is child of "root\ASNHeader". I am not format the code properly in this post. kindly adjust.
 
Back
Top