i wish you a happy new year! I got following XML structure:
<?xml version="1.0" encoding="UTF-8"?>
<SW.CodeBlock ID="0">
<SW.CompileUnit ID="1">
<AttributeList>
<NetworkSource>
<FlgNet xmlns="http://www.TEST.com">
<Parts> </Parts>
</FlgNet>
</NetworkSource>
</AttributeList>
</SW.CompileUnit>
<SW.CompileUnit ID="2">
<AttributeList>
<NetworkSource>
<FlgNet xmlns="http://www.TEST.COM">
<Parts> </Parts>
</FlgNet>
</NetworkSource>
</AttributeList>
</SW.CompileUnit>
</SW.CodeBlock>
How can i add a Child in "Parts" from SW.CompileUnit ID = 1 and SW.CompileUnit ID = 2 etc.?
I would like to create a loop (for-loop), which creates a child in "Parts" for every "SW.CompileUnit"-Node
Could you please help me?
PS: I use VS2015, C#, not using Linq or XPath etc.
Until now I add a child like this:
XmlNode xPiece = xdoc.SelectSingleNode("//NS2:Parts",nsmgr);
xPiece.AppendChild(myXMLElement);
but it only adds a child in the first SW.CompileUnit Node (with the ID=1) ...
Thanks in advance