Solving xsd generation error: 'The element .... is missing'
In attempting to build source from an XML schema using the XSD command line tool, I kept getting an error about an element missing.
C:\dev\hrxml\xsd AssessmentResult.xsd /classes /fields /language:CS /namespace:hrxml.AssessmentResult
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.3038]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:title' element is not declared. Line 1074, position 5.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:format' element is not declared. Line 1075, position 5.
Schema validation warning: The 'http://www.w3.org/2000/09/xmldsig#:Signature' element is not declared. Line 1173, position 5.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:creator' element is not declared. Line 1079, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:subject' element is not declared. Line 1080, position 8.
Schema validation warning: The <a href="http://purl.org/dc/elements/1.1/:description'" title="http://purl.org/dc/elements/1.1/:description'">http://purl.org/dc/elements/1.1/:description'</a> element is not declared. Line 1081, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:publisher' element is not declared. Line 1082, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:contributor' element is not declared. Line 1083, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:date' element is not declared. Line 1084, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:type' element is not declared. Line 1085, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:identifier' element is not declared. Line 1086, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:source' element is not declared. Line 1087, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:language' element is not declared. Line 1088, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:relation' element is not declared. Line 1089, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:coverage' element is not declared. Line 1090, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:rights' element is not declared. Line 1091, position 8.
Warning: Schema could not be validated. Class generation may fail or may produce incorrect results.
Error: Error generating classes for schema 'AssessmentResult'.
- The element 'http://purl.org/dc/elements/1.1/:title' is missing.
If you would like more help, please type "xsd /?".
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.3038]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:title' element is not declared. Line 1074, position 5.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:format' element is not declared. Line 1075, position 5.
Schema validation warning: The 'http://www.w3.org/2000/09/xmldsig#:Signature' element is not declared. Line 1173, position 5.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:creator' element is not declared. Line 1079, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:subject' element is not declared. Line 1080, position 8.
Schema validation warning: The <a href="http://purl.org/dc/elements/1.1/:description'" title="http://purl.org/dc/elements/1.1/:description'">http://purl.org/dc/elements/1.1/:description'</a> element is not declared. Line 1081, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:publisher' element is not declared. Line 1082, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:contributor' element is not declared. Line 1083, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:date' element is not declared. Line 1084, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:type' element is not declared. Line 1085, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:identifier' element is not declared. Line 1086, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:source' element is not declared. Line 1087, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:language' element is not declared. Line 1088, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:relation' element is not declared. Line 1089, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:coverage' element is not declared. Line 1090, position 8.
Schema validation warning: The 'http://purl.org/dc/elements/1.1/:rights' element is not declared. Line 1091, position 8.
Warning: Schema could not be validated. Class generation may fail or may produce incorrect results.
Error: Error generating classes for schema 'AssessmentResult'.
- The element 'http://purl.org/dc/elements/1.1/:title' is missing.
If you would like more help, please type "xsd /?".
The error was related to the import of external schemas into the document. The solution is to download the external schemas and build your source using your target schema file as well as the import schema files.
In the example below, AssessmentResult.xsd is my target, XmlSignatureSyntaxProcessing.xsd and DublicCoreSimple.xsd are the imports in the AssessmentResult schema:
xsd AssessmentResult.xsd DublinCoreSimple.xsd XmlSignatureSyntaxProcessing.xsd /classes /fields /language:CS /namespace:hrxml.AssessmentResult
Voila!
Recent blog posts
- Canned VirtualPC Instances for IE 6, 7, 8 on XP/Vista
- Checking assembly dependencies for .NET
- Google's Public DNS
- Server Utility Functions for Non-Web Apps
- reCAPTCHA for ASP.NET MVC that uses ModelState
- Adding a container to ValidationSummary helper in ASP.NET MVC
- Generic XML Serialization Class
- Re-throwing Exceptions in C# with InternalPreserveStackTrace
- Solving xsd generation error: 'The element .... is missing'
- Enum DropDownList in ASP.NET MVC
Recent comments
9 weeks 2 days ago
12 weeks 3 days ago
15 weeks 4 days ago
21 weeks 2 days ago
31 weeks 1 day ago
1 year 15 weeks ago
1 year 32 weeks ago
1 year 33 weeks ago
1 year 39 weeks ago
2 years 16 weeks ago