This is easy to do with
LINQ to XML[
^]:
XDocument document = new XDocument(
new XDeclaration("1.0", null, null),
new XElement("TALLYMESSAGE",
new XAttribute(XNamespace.Xmlns + "UDF", "TallyUDF"),
new XElement("VOUCHER",
new XAttribute("VCHTYPE", "Sales"),
new XAttribute("ACTION", "Create"),
new XElement("VOUCHERTYPENAME", "Sales"),
new XElement("ALLLEDGERENTRIES.LIST",
new XElement("REMOVEZEROENTRIES", "No"),
new XElement("ISDEEMEDPOSITIVE", "Yes"),
new XElement("LEDGERFROMITEM", "No"),
new XElement("LEDGERNAME", "Customer 1"),
new XElement("AMOUNT", -5000)
)
)
)
);