Archived Forum Post

Index of archived forum posts

Question:

Why Following AddChildTree Not Working?

Oct 05 '16 at 02:59

Greetings, i am trying to add a XML tree to an existing XML in multiple times.

i am using below code:

    objXML.LoadXmlFile("g:\My Documents\Apps.xml")
    objHXML.LoadXmlFile("g:\My Documents\Bulk Update.xml")
    For intALoop As Integer = 0 To (objXML.GetChildWithTag("PRO_Aps").NumChildren - 1)
        If objXML.GetChildWithTag("PRO_Aps").GetChild(intALoop).GetChildWithTag("Title").Content <> "Discontinued" Then
            objXML.GetChildWithTag("PRO_Aps").GetChild(intALoop).GetChildWithTag("History").AddChildTree(objHXML)
        End If
    Next
    objXML.SaveXml("g:\My Documents\Apps.xml")

but it is not working, it only add to the last item not all.

where is the issue with my code?

thanks in advance best regards