bharath
bharath

Reputation: 14453

How to generate XML on MonoTouch?

I need to generate XML on MonoTouch application ? How i can create like this,

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root>
...
</root>

I need to post the XML to web service as string format. And again I want to parse the response data. Response data also XML format string. I done it in j2me applications. But I don't know how to do this on MonoTouch? Anyone tell me How to do this?

Upvotes: 1

Views: 366

Answers (2)

miguel.de.icaza
miguel.de.icaza

Reputation: 32694

My favorite API these days is the System.Xml.Linq API, look at the documentation and samples here:

http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.aspx

For what you want, this is very easy:

  var s = new XDocument () {
      new XElement ("root")
  };
  Console.WriteLine ("The XML is: {0}", s.ToString ());

Upvotes: 3

Jason
Jason

Reputation: 89102

You can create the XML by using the XmlWriter class.

The easiest way to parse XML would be to use LINQ.

Upvotes: 1

Related Questions