0

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.

10
  • 1
    The error is right. The type isn't declared in this file. You have to process all of the files together, either with *.xsd or specifying the files in the command line. xsd.exe is 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 reference Commented Oct 15 at 13:04
  • 1
    xsd.exe InvoicesDoc-v1.0.11.xsd incomeClassification-v1.0.11.xsd expensesClassification-v1.0.11.xsd SimpleTypes-v1.0.11.xsd /classes /language:cs Commented Oct 15 at 13:07
  • 1
    BTW if you think government web services are weird, wait until you see what airlines use. xsd.exe is beyond ancient, replaced by svcutil.exe back 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. Commented Oct 15 at 13:15
  • 1
    For .NET Core (.NET 5 and later are .NET Core versions) a newer svcutil version is available as a .NET tool Commented Oct 15 at 13:18
  • @Selvin it worked great! so much time i spend on it! i had no idea that must be all at once.I tried one by one!Thank you very much Commented Oct 15 at 13:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.