I have downloaded xsd files from the Greek government's site here and I am trying to create C# classes.
Most of them will be created fine, but the ones I really need will not, and the cause these errors:
xsd.exe InvoicesDoc-v1.0.11.xsd /classes /language:cs
Schema validation warning: Type 'https://www.aade.gr/myDATA/incomeClassificaton/v1.0:IncomeClassificationType' is not declared. Line 519, position 5.
Schema validation warning: Type 'https://www.aade.gr/myDATA/expensesClassificaton/v1.0:ExpensesClassificationType' is not declared. Line 524, position 5.
Schema validation warning: Type 'https://www.aade.gr/myDATA/incomeClassificaton/v1.0:IncomeClassificationType' is not declared. Line 435, position 5.
Schema validation warning: Type 'https://www.aade.gr/myDATA/expensesClassificaton/v1.0:ExpensesClassificationType' is not declared. Line 440, position 5.
Warning: Schema could not be validated. Class generation may fail or may produce incorrect results.
Error: Error generating classes for schema 'InvoicesDoc-v1_0_11'.
- The datatype 'https://www.aade.gr/myDATA/incomeClassificaton/v1.0:IncomeClassificationType' is missing.
xsd.exe SimpleTypes-v1.0.11.xsd /c /language:cs
Microsoft (R) Xml Schemas/DataTypes support utility [Microsoft (R) .NET Framework, Version 4.8.3928.0] Copyright (C) Microsoft Corporation. All rights reserved. Warning: cannot generate classes because no top-level elements with complex type were found.
Am I doing something wrong, or is this some kind of a bug in these two xsds?
I had a look at the xsd, but since I don't know much about xsds and xml, I couldn't find a solution.
xsd.exe will generate /dataset fine for these two that fail when option is /classes.
If anyone can download and check and let me know, I will be thankful.
*.xsdor specifying the files in the command line.xsd.exeis ancient, so don't remember what's needed. It's very common for complex web services to break document schemas into separate files that can be reused into other documents through a referencexsd.exe InvoicesDoc-v1.0.11.xsd incomeClassification-v1.0.11.xsd expensesClassification-v1.0.11.xsd SimpleTypes-v1.0.11.xsd /classes /language:csxsd.exeis beyond ancient, replaced bysvcutil.exeback in 2008. It matters, because the generated code uses better serialization. Both tools are very old though. It may not be a bad idea to use XDocument with LINQ-to-XML, or newer generator tools.