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>开发者_StackOverflow社区
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?
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 ());
You can create the XML by using the XmlWriter class.
The easiest way to parse XML would be to use LINQ.
精彩评论