EDN Admin
Well-known member
I have an xsd file like below:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" xmlns:umam="http://www.aquo.nl/umam2011"
targetNamespace="http://www.aquo.nl/umam2011" elementFormDefault="qualified" version="unknown <br/>
<!-- niet gebruikt ivm foutmeldingen: xmlns:smXML="http://www.isotc211.org/smXML" --><br/>
<xs:annotation><br/>
<xs:documentation>XXXXXXXXXX</xs:documentation><br/>
</xs:annotation><br/>
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>
<br/>
<xs:include schemaLocation="http://www.aquo.nl/Aquo/schemas/NEN3610-domein_infrastructuurtype.xsd"/>
When I validate my xml file by this xsd from internet, it seems OK. but when I download the gml.xsd file, and use XmlUrlResolver to mapping the URI, it cause an Error:
Undefined complexType http://www.opengis.net/gml:AbstractFeatureType is used as a base for complex type extension.
The source code almost like below:
LocalXmlResolver myResolver = new LocalXmlResolver(new Uri(@"file:///C:/SchemaCache/"));<br/>
myResolver.UriMap.Add(@"http://schemas.opengis.net/gml/3.1.1/base/gml.xsd", "gml.xsd");<br/>
myResolver.UriMap.Add(@"http://www.aquo.nl/Aquo/schemas/NEN3610-domein_rechtstype.xsd", "NEN3610-domein_rechtstype.xsd");
fs = new FileStream(xmlFile, FileMode.Open);<br/>
<br/>
settings = new XmlReaderSettings();<br/>
settings.ValidationType = ValidationType.Schema;<br/>
settings.ValidationFlags = XmlSchemaValidationFlags.ReportValidationWarnings;<br/>
<br/>
set = new XmlSchemaSet();<br/>
set.XmlResolver = myResolver;<br/>
<br/>
foreach (string schemaFile in schemaFiles)<br/>
{<br/>
schemaReader = XmlReader.Create(schemaFile);<br/>
set.Add(null, schemaReader);<br/>
}<br/>
settings.Schemas.Add(set);<br/>
xmlreader = XmlTextReader.Create(fs, settings);<br/>
while (xmlreader.Read())<br/>
{<br/>
Console.WriteLine(xmlreader.LocalName);<br/>
}
Any body can help me? Im crazy now!!!
View the full article
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" xmlns:umam="http://www.aquo.nl/umam2011"
targetNamespace="http://www.aquo.nl/umam2011" elementFormDefault="qualified" version="unknown <br/>
<!-- niet gebruikt ivm foutmeldingen: xmlns:smXML="http://www.isotc211.org/smXML" --><br/>
<xs:annotation><br/>
<xs:documentation>XXXXXXXXXX</xs:documentation><br/>
</xs:annotation><br/>
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>
<br/>
<xs:include schemaLocation="http://www.aquo.nl/Aquo/schemas/NEN3610-domein_infrastructuurtype.xsd"/>
When I validate my xml file by this xsd from internet, it seems OK. but when I download the gml.xsd file, and use XmlUrlResolver to mapping the URI, it cause an Error:
Undefined complexType http://www.opengis.net/gml:AbstractFeatureType is used as a base for complex type extension.
The source code almost like below:
LocalXmlResolver myResolver = new LocalXmlResolver(new Uri(@"file:///C:/SchemaCache/"));<br/>
myResolver.UriMap.Add(@"http://schemas.opengis.net/gml/3.1.1/base/gml.xsd", "gml.xsd");<br/>
myResolver.UriMap.Add(@"http://www.aquo.nl/Aquo/schemas/NEN3610-domein_rechtstype.xsd", "NEN3610-domein_rechtstype.xsd");
fs = new FileStream(xmlFile, FileMode.Open);<br/>
<br/>
settings = new XmlReaderSettings();<br/>
settings.ValidationType = ValidationType.Schema;<br/>
settings.ValidationFlags = XmlSchemaValidationFlags.ReportValidationWarnings;<br/>
<br/>
set = new XmlSchemaSet();<br/>
set.XmlResolver = myResolver;<br/>
<br/>
foreach (string schemaFile in schemaFiles)<br/>
{<br/>
schemaReader = XmlReader.Create(schemaFile);<br/>
set.Add(null, schemaReader);<br/>
}<br/>
settings.Schemas.Add(set);<br/>
xmlreader = XmlTextReader.Create(fs, settings);<br/>
while (xmlreader.Read())<br/>
{<br/>
Console.WriteLine(xmlreader.LocalName);<br/>
}
Any body can help me? Im crazy now!!!
View the full article