开发者

How to generate XML on MonoTouch?

开发者 https://www.devze.com 2023-02-20 01:08 出处:网络
I need to generate XML on MonoTouch application ? How i can create like this, <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号