c# XML add an XML node as a child to a particular other node
Posted
by kacalapy
on Stack Overflow
See other posts from Stack Overflow
or by kacalapy
Published on 2010-05-01T16:05:25Z
Indexed on
2010/05/01
16:17 UTC
Read the original article
Hit count: 493
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...
© Stack Overflow or respective owner