All
I have an XML document of the following form:
<RootNode>
<ChildNode>
<ChildA/>
<ChildB/>
<ChildC/>
</ChildNode>
<ChildNode>
<ChildA/>
<ChildB/>
<ChildC/>
</ChildNode>
</RootNode>
What I need is a means to insert a new node underneath one of the <ChildNode> elements. However, this requires indexing to specify which <ChildNode> I'd like to add to. So, using a SetValue, I have the following left-hand side of an expression:
/process_data/xmlVar/RootNode/ChildNode[2]/NewNode
and on the right-hand side of the expression:
'test'
However, the above throws an XML parsing error stating that an "invalid XML character was specified". If I simply remove the indexing from the left-hand side to yield:
/process_data/xmlVar/RootNode/ChildNode/NewNode
the SetValue properly adds the node <NewNode> but it does so under the first<ChildNode> - which I understand.
So my question is simply: "How does one index their XML expression properly when trying to dynamically build XML?" I have tried putting both single quotes and double quotes around the index but to no avail.
Thanks in advance.