Search code examples
chilkatchilkat-xml

Create XML with Multiple Same-Tag Children


I will not describe my xml structure, I have prepared an example for reproduction. Expected result:

<?xml version="1.0" encoding="utf-8" ?>
<A>
    <B>b</B>
    <C>c1</C>
    <C>c2</C>
</A>

Code:

Set xml = CreateObject("Chilkat_9_5_0.Xml")
xml.Tag = "A"
xml.UpdateChildContent "B", "b"
xml.UpdateChildContent "C", "c1"
xml.UpdateChildContent "C[1]", "c2"
Debug.Print xml.getxml

Result

<?xml version="1.0" encoding="utf-8" ?>
<A>
    <B>b</B>
    <C>c1</C>
</A>

If I change c index from 1 to 2 then get two C nodes. Why?


Solution

  • This problem should be fixed in the latest version of Chilkat.