Sample code for 30+ languages & platforms
Unicode C

Xml.ChildContent Example #2

Another Xml.UpdateChildContent example...

Chilkat Unicode C Downloads

Unicode C
#include <C_CkXmlW.h>
#include <C_CkStringBuilderW.h>

void ChilkatSample(void)
    {
    HCkXmlW xml;
    HCkStringBuilderW sbValue;
    int i;

    xml = CkXmlW_Create();
    CkXmlW_putTag(xml,L"abc");

    sbValue = CkStringBuilderW_Create();

    i = 0;
    while (i < 10) {
        CkXmlW_putI(xml,i);
        CkStringBuilderW_Clear(sbValue);
        CkStringBuilderW_AppendInt(sbValue,i);
        CkXmlW_UpdateChildContent(xml,L"xyz|test[i]",CkStringBuilderW_getAsString(sbValue));
        i = i + 1;
    }

    wprintf(L"%s\n",CkXmlW_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>


    CkXmlW_Dispose(xml);
    CkStringBuilderW_Dispose(sbValue);

    }