Hi bhadriau,
I have created sample code which full-fill your requirement.You need to modify as per your requirement.
HTML
<div>
<asp:Literal ID="lblId" runat="server" />
</div>
XML
<?xml version="1.0" encoding="utf-8" ?>
<left requires="SenderFullName">{SenderFullName}</left>
<left requires="ReceiverFullName">{ReceiverFullName}</left>
<left requires="ReceiverCountry"> {ReceiverCountry}</left>
<left requires="AccountId">{AccountId}</left>
C#
private void PopulateData()
{
string body = string.Empty;
string breakline = "<br />";
string SenderName = "Sender Name";
string Receiver = "Receiver Name";
string country = "Country";
string AccountId = "A0001";
using (StreamReader reader = new StreamReader(Server.MapPath("~/XMLFile.xml")))
{
body = reader.ReadToEnd();
}
body = body.Replace("{SenderFullName}", !string.IsNullOrEmpty(SenderName) ? SenderName + breakline : "");
body = body.Replace("{ReceiverFullName}", !string.IsNullOrEmpty(Receiver) ? Receiver + breakline : "");
body = body.Replace("{ReceiverCountry}", !string.IsNullOrEmpty(country) ? country + breakline : "");
body = body.Replace("{AccountId}", !string.IsNullOrEmpty(AccountId) ? AccountId + breakline : "");
this.lblId.Text = body;
}
Vb.Net
Private Sub PopulateData()
Dim body As String = String.Empty
Dim breakline As String = "<br />"
Dim SenderName As String = "Sender Name"
Dim Receiver As String = "Receiver Name"
Dim country As String = "Country"
Dim AccountId As String = "A0001"
Using reader As New StreamReader(Server.MapPath("~/XMLFile.xml"))
body = reader.ReadToEnd()
End Using
body = body.Replace("{SenderFullName}", If(Not String.IsNullOrEmpty(SenderName), SenderName & breakline, ""))
body = body.Replace("{ReceiverFullName}", If(Not String.IsNullOrEmpty(Receiver), Receiver & breakline, ""))
body = body.Replace("{ReceiverCountry}", If(Not String.IsNullOrEmpty(country), country & breakline, ""))
body = body.Replace("{AccountId}", If(Not String.IsNullOrEmpty(AccountId), AccountId & breakline, ""))
Me.lblId.Text = body
End Sub