I have one xml template that looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<EmailTemplate>
<subject></subject>
<displayName></displayName>
<Message1>
</Message1>
<Copyright></Copyright>
</EmailTemplate>
I am using LINQ to write values to the elements when the method is executing. after i write the values i use xslt transformation and get the html output in the same method. Everything works fine. but what i want is i want this xml to look like above. I mean the elements shouldn't contain any value after the method is executed successfully. At the moment as soon as the method is executed the xml contains values. My code for writing to xml looks like this:
var xmlElement = XElement.Load(@"myxmlfile.xml");
var element3 = xmlElement.Elements("subject").Single();
element3.Value = subject;
var element4 = xmlElement.Elements("displayName").Single();
element4.Value = displayName;
xmlElement.Save(@"myxmlfile.xml");
Note: if i don't include the last line (xmlelement.save...) during the transformation it doesn't pickup the values. Any help and suggestion most welcome.