Sample code for 30+ languages & platforms
Xbase++

Xml.UpdateAttrAt Example #2

Another Xml.UpdateAttrAt example...

Chilkat Xbase++ Downloads

Xbase++
LOCAL oXml
LOCAL oSbValue
LOCAL i

oXml := CreateObject("Chilkat.Xml")
oXml:Tag := "abc"

oSbValue := CreateObject("Chilkat.StringBuilder")

i := 0
DO WHILE i < 10
    oXml:I := i
    oSbValue:Clear()
    oSbValue:AppendInt(i)
    oXml:UpdateAttrAt("xyz|test[i]", 1, "index", oSbValue:GetAsString())
    i := i + 1
ENDDO

? oXml:GetXml()

//  Output is:

//  	<?xml version="1.0" encoding="utf-8" ?>
//  	<abc>
//  	    <xyz>
//  	        <test index="0" />
//  	        <test index="1" />
//  	        <test index="2" />
//  	        <test index="3" />
//  	        <test index="4" />
//  	        <test index="5" />
//  	        <test index="6" />
//  	        <test index="7" />
//  	        <test index="8" />
//  	        <test index="9" />
//  	    </xyz>
//  	</abc>

oXml:destroy()
oSbValue:destroy()