Tcl
Tcl
Xml.UpdateAttrAt Example #2
Another Xml.UpdateAttrAt example...Chilkat Tcl Downloads
load ./chilkat.dll
set xml [new_CkXml]
CkXml_put_Tag $xml "abc"
set sbValue [new_CkStringBuilder]
set i 0
while {$i < 10} {
CkXml_put_I $xml $i
CkStringBuilder_Clear $sbValue
CkStringBuilder_AppendInt $sbValue $i
CkXml_UpdateAttrAt $xml "xyz|test[i]" 1 "index" [CkStringBuilder_getAsString $sbValue]
set i [expr $i + 1]
}
puts [CkXml_getXml $xml]
# 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>
delete_CkXml $xml
delete_CkStringBuilder $sbValue