Mono(Touch): System.Xml.Schema.Extensions
I tried validating an XML file via the XDocument.Validate
method defined in System.Xml.Schema.Extensions
. However the compiler says that XDocument
“does not contain a definition for ‘Validate’ and no extension method ‘Validate’ of type ‘System.Xml.Linq.XDocument’ could be found”.
Is the System.Xml.Schema.Extensions
class really m开发者_高级运维issing from MonoTouch? And if so, is there any other way to validate an XML read into a XDocument?
edit:
The class in question seems to be missing from Mono as well, according to their documentation. Is there any replacement?
MonoTouch is based on the Silverlight profile. Neither Silverlight nor WinPhone7 include System.Xml.Schema.Extensions.
Fortunately, Mono is open source, so you can take the code you need and add it to your project:
https://github.com/mono/mono/blob/master/mcs/class/System.Xml.Linq/System.Xml.Schema/Extensions.cs
Extensions appears to be new in 3.5 - MonoTouch is core 2.0, with bits of later versions (ie, LINQ) included.
精彩评论