Can't deserialize xml-doc due to lack of XSD file

I have a class that I want to de-serialize an XML document into:

[XmlRoot(ElementName = "MyType", Namespace = "MyNamespace")]
public class MyClass : MyBase { }

and

[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
[SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[XmlTypeAttribute(Namespace = "BaseNamespace")]
[XmlRootAttribute("MyBaseType", Namespace = "BaseNamespace", IsNullable = false)]
[GuidAttribute("8d9586ec-f263-48e2-ad47-53093430bce4")]
public class MyBase { }

When deserializing, I get an error

XML Schema File with Metadata Not Found in AAA-Fachschema.xsd ": null

This is a simplified Xml:

<?xml version="1.0" encoding="utf-8"?>
<!--some comments -->
<q1:MyType xsi:schemaLocation="http://www.adv-online.de/namespaces/adv/gid/6.0 NAS-Operationen.xsd" xmlns:q1="MyNamespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:ogc="http://www.adv-online.de/namespaces/adv/gid/ogc" xmlns:wfs="http://www.adv-online.de/namespaces/adv/gid/wfs" xmlns:gss="http://www.isotc211.org/2005/gss" xmlns="BaseNamespace">
</q1:MyType>

And code deserialization:

using (var reader = new XmlReader(theFile, new XmlReaderSettings { ValidationType = ValidationType.None }))
{
    var ser = new XmlSerializer(typeof(MyClass));
    var o = ser.Deserialize(reader);
}

But I'm not at all sure where this Xsd file is installed to be downloaded by the serializer.

Does anyone know where to set this information for the serializer or even easier, how to completely disable the check?

+4
source share
1 answer

, , URL- xsd, , , . , http://repository.gdi-de.org/schemas/adv/nas/6.0 ?

, -, , , , .

0

Source: https://habr.com/ru/post/1625277/


All Articles