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
- Quick Memory Improvement for Firefox
- 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'
Recent comments
- Reply to comment | A.D.D. In IT
3 days 8 min ago - Reply to comment | A.D.D. In IT
4 days 2 hours ago - Reply to comment | A.D.D. In IT
4 days 2 hours ago - Reply to comment | A.D.D. In IT
4 days 20 hours ago - Reply to comment | A.D.D. In IT
4 days 20 hours ago - Reply to comment | A.D.D. In IT
2 weeks 21 hours ago - Xorauguyna
6 weeks 17 hours ago - Best tutorial i've ever read.
22 weeks 3 days ago - answer this post
23 weeks 2 days ago - Thank you
1 year 8 weeks ago
Comments
#1 Anonymous
І was ѕuggеѕteԁ this website by my cousin.
I'm not sure whether this post is written by him as nobody else know such detailed about my trouble. You are incredible! Thanks!
my page New Bingo Sites