mike Delvotti

mike Delvotti

  • NA
  • 262
  • 0

XML Element

Feb 16 2012 6:54 AM
Guys, I'm having a little trouble formating an xml element, i want to create an element like the below xml output example:

<rpc module="SMS" method="Send_SMS" version="1.0">
(my other elements will go here as below)
</rpc>

My problem is getting the element to output as above, below is an example of an xml output of mine that is working fine, i just need to add the element as above?

(my above sample here)
XElement xml = new XElement("Persons", new XElement("Person",
               new XElement("Server", Server.Text),
               new XElement("User", Username.Text),
               new XElement("Password", Password.Text),
               new XElement("Recipient1", Recipient.Text),
               new XElement("Recipient2", Recipient2.Text),
               new XElement("Recipient3", Recipient3.Text),
               new XElement("Subject", Subject.Text),
               new XElement("Message", Message.Text),
               new XElement("Ping", Ping.Text)));
             (and ends here)

               xml.Save("c:\\XMLFile.xml");

Answers (5)