Sample code for 30+ languages & platforms
Tcl

Xml.ChildContent Example #2

Another Xml.UpdateChildContent example...

Chilkat Tcl Downloads

Tcl

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_UpdateChildContent $xml "xyz|test[i]" [CkStringBuilder_getAsString $sbValue]
    set i [expr $i + 1]
}

puts [CkXml_getXml $xml]

# Output is:

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

delete_CkXml $xml
delete_CkStringBuilder $sbValue