Sample code for 30+ languages & platforms
Rust

Xml.ChildContent Example #2

Another Xml.UpdateChildContent example...

Chilkat Rust Downloads

Rust
let xml = chilkat::Xml::new();
xml.set_tag("abc");

let sb_value = chilkat::StringBuilder::new();

let mut i = 0;
while i < 10 {
    xml.set_i(i);
    sb_value.clear();
    let _ = sb_value.append_int(i);
    xml.update_child_content("xyz|test[i]", &sb_value.get_as_string().unwrap_or_default());
    i = i + 1;
}

println!("{}", xml.get_xml().unwrap_or_default());

// 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>