c# XML add an XML node as a child to a particular other node
- by kacalapy
I have an XML doc with a structure like this:
<Book>
<Title title="Door Three"/>
<Author name ="Patrick"/>
</Book>
<Book>
<Title title="Light"/>
<Author name ="Roger"/>
</Book>
I want to be able to melodramatically add XML nodes to this XML in a particular place. Lets say I wanted to add a Link node as a child to the author node where the name is Roger.
I think it's best if the function containing this logic is passed a param for the name to add an XML node under, please advise and what's the code I need to add XML nodes to a certain place in the XML?
Now I am using .AppendChild() method but it doesn't allow for me to specify a parent node to add under...