开发者

XML Parser on MonoTouch?

I want to parse XML formatted st开发者_运维知识库ring. How to use XML parser on MonoTouch?


Exactly the same way you would in standard C#.

Your options include:

XmlSerializer - good if you want to translate a full document to a set of C# objects

XmlDocument - good if the document is custom beyond XmlSerializer can handle

XPath - good for pulling out small pieces of data, if you don't care about the whole doc.

Linq2XML - another option using Linq.

Depending on what exactly you need.


You can use LINQ to XML in MonoTouch.

So,

var element = XElement.Parse("<cat>dog</cat>");
Console.WriteLine(element.Value); 

prints "dog".


You can´t use System.Xml.Linq in full, there will be a JIT part that will blow up when testing in the device, see Xamarin Monotouch limitations:

link

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜