Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does .NET schema validation claim that the namespace:lang attribute is not declared?
    text
    copied!<p>I try to validate an XML document against the schema named MedisinskeOpplysninger-v1.5.xsd from this collection: <a href="http://www.kith.no/upload/1611/v1.5/PLO-schema%20v1.5.zip" rel="nofollow">http://www.kith.no/upload/1611/v1.5/PLO-schema%20v1.5.zip</a></p> <p>Basically, I add the referenced schemas to a SchemaSet in C#, and validate my XML by assigning the SchemaSet to the corresponding property of the XmlReaderSettings and run an XmlReader. </p> <p>I get the following error message: </p> <pre><code>System.Xml.Schema.XmlSchemaException : The 'http://www.w3.org/XML/1998/namespace:lang' attribute is not declared. at System.Xml.Schema.XmlSchemaSet.InternalValidationCallback(Object sender, ValidationEventArgs e) at System.Xml.Schema.BaseProcessor.SendValidationEvent(XmlSchemaException e, XmlSeverityType severity) at System.Xml.Schema.BaseProcessor.SendValidationEvent(XmlSchemaException e) at System.Xml.Schema.Compiler.CompileElement(XmlSchemaElement xe) at System.Xml.Schema.Compiler.Compile() at System.Xml.Schema.Compiler.Execute(XmlSchemaSet schemaSet, SchemaInfo schemaCompiledInfo) at System.Xml.Schema.XmlSchemaSet.Compile() </code></pre> <p>I see in Fiddler that .NET is trying to download xml.xsd from w3c.org, but fails (the server responds with a 504), so I have tried to download xml.xsd and include it explicitly in my SchemaSet. When I try this, .NET claims that </p> <pre><code>The global attribute 'http://www.w3.org/XML/1998/namespace:lang' has already been declared. </code></pre> <p>I am confused. Any ideas?</p> <p>I'm on .NET 3.5, C#, Visual Studio 2010, Windows 7.</p> <p><strong>Update</strong></p> <p>I have tried Ian's suggestion per the comments, and added the custom resolver from <a href="http://londata.svnrepository.com/xmlcatalog.net/trac.cgi/wiki/WikiStart" rel="nofollow">LonData</a>. I can see by watching the Fiddler trace that it is indeed in effect, since no attempt to resolve schemas from external addresses happens now. </p> <p>I now get the following error message: The 'http://www.w3.org/2000/09/xmldsig#:Signature' element is not declared.</p> <p>My XML catalog file looks like this:</p> <pre><code>&lt;catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"&gt; &lt;systemSuffix systemIdSuffix="XMLSchema.xsd" uri="C:\Users\eax\AppData\Local\Temp\XMLSchema.xsd"/&gt; &lt;systemSuffix systemIdSuffix="datatypes.dtd" uri="C:\Users\eax\AppData\Local\Temp\datatypes.dtd"/&gt; &lt;systemSuffix systemIdSuffix="XMLSchema.dtd" uri="C:\Users\eax\AppData\Local\Temp\XMLSchema.dtd"/&gt; &lt;systemSuffix systemIdSuffix="Xmldsig.xsd" uri="C:\Users\eax\AppData\Local\Temp\Xmldsig.xsd"/&gt; &lt;systemSuffix systemIdSuffix="xmldsig-core-schema.xsd" uri="C:\Users\eax\AppData\Local\Temp\xmldsig-core-schema.xsd"/&gt; &lt;systemSuffix systemIdSuffix="xml.xsd" uri="C:\Users\eax\AppData\Local\Temp\xml.xsd"/&gt; &lt;systemSuffix systemIdSuffix="xhtml1-strict.xsd" uri="C:\Users\eax\AppData\Local\Temp\xhtml1-strict.xsd"/&gt; &lt;/catalog&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload