[Mono-dev] Validate xml file with schema file

Robert Jordan robertj at gmx.net
Mon Nov 29 05:30:07 EST 2010


On 29.11.2010 10:55, Chakotey STME wrote:
> Hi,
>
> I have a problem with this code under mono 2.6:
>
>          Dim xsdMarkup As XDocument =
> XDocument.Load("/home/stefan/xml/PluginConfigSchema.xsd")
>
>
>          Dim schemas As XmlSchemaSet = New XmlSchemaSet()
>          schemas.Add("", xsdMarkup.CreateReader)
>
>          Dim doc1 As XDocument = XDocument.Load("/home/stefan/xml/Total
> Processes.xml")
>
>          doc1.Validate(schemas, AddressOf XSDErrors)
>
>
>      Private Sub XSDErrors(ByVal o As Object, ByVal e As ValidationEventArgs)
>          Console.WriteLine("{0}", e.Message)
>          errors = True
>      End Sub
>
> If I execute this program I get the following Exception:
> Unhandled Exception: System.NotImplementedException: The requested
> feature is not implemented.
>    at XMLReader4.Module1.Main () [0x00000] in<filename unknown>:0
>
> But the mono migration analyzer says that this code is ok.
>
> So what can I do that this code works under mono 2.6?

You could validate with an XmlReader in advance
and use the XDocument APIs afterwards. With small documents
you won't notice any performance losses.

Robert



More information about the Mono-devel-list mailing list