c# - insert xml string to xml element using LINQ -
I have to add two XMLs that one of them is a template and the other is data, how can I do this?
XML one:
XML Two:
& lt; Data & gt; & Lt; Page number = "1" & gt; Data 1 & lt; / Page & gt; & Lt; Page number = "2" & gt; Data 2 & lt; / Page & gt; & Lt; Page number = "3" & gt; Data 3 & lt; / Page & gt; & Lt; / Data & gt;
link resolution:
var content = XDocument .load ("content.xml") .Root.Elements ("Page"). Toofization (p => (int) p.Attribute ("no")); Var xdoc = XDocument.Load ("template.xml"); Foreign exchange (different pages in xdoc.Descendants ("Page")) {XElement data; If (content content.TryGetValue (int) page. ("No"), data released)); Page.ReplaceNodes (data.Nodes ()); }
Comments
Post a Comment