Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to generate C# classes - ifopt:CountryRefStructure is missing. #140

Open
thucnguyen77 opened this issue May 14, 2024 · 2 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@thucnguyen77
Copy link

Hi,

I was trying to generate C# classes from the 'siri_estimatedTimetable_service.xsd' schema, using Microsoft's xsd.exe tool. I got the following errors and warnings.

Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.8.3928.0]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: Type 'http://www.ifopt.org.uk/acsb:AccessibilityAssessmentStructure' is not declared. Line 1350, position 5.
Schema validation warning: Type 'http://www.ifopt.org.uk/ifopt:EquipmentRefStructure' is not declared. Line 638, position 5.
Schema validation warning: Type 'http://www.ifopt.org.uk/ifopt:EquipmentTypeRefStructure' is not declared. Line 648, position 5.
Schema validation warning: Type 'http://www.ifopt.org.uk/ifopt:EquipmentStatusEnumeration' is not declared. Line 658, position 5.
Schema validation warning: Type 'http://www.ifopt.org.uk/ifopt:StopPlaceRefStructure' is not declared. Line 195, position 5.
Schema validation warning: Type 'http://www.ifopt.org.uk/ifopt:StopPlaceComponentRefStructure' is not declared. Line 200, position 5.
Schema validation warning: Type 'http://www.ifopt.org.uk/acsb:AccessibilityAssessmentStructure' is not declared. Line 383, position 5.
Schema validation warning: Reference to undeclared model group 'http://www.ifopt.org.uk/acsb:MobilityLimitationGroup'. Line 218, position 8.
Schema validation warning: Reference to undeclared model group 'http://www.ifopt.org.uk/acsb:SensoryLimitationGroup'. Line 219, position 8.
Schema validation warning: Type 'http://www.ifopt.org.uk/acsb:AccessibilityAssessmentStructure' is not declared. Line 166, position 5.
Schema validation warning: Type 'http://www.ifopt.org.uk/acsb:SuitabilityStructure' is not declared. Line 229, position 8.
Schema validation warning: Type 'http://www.ifopt.org.uk/ifopt:CountryRefStructure' is not declared. Line 146, position 5.
Schema validation warning: Type 'http://www.ifopt.org.uk/ifopt:CountryRefStructure' is not declared. Line 168, position 5.
Schema validation warning: Type 'http://www.ifopt.org.uk/ifopt:CountryRefStructure' is not declared. Line 209, position 5.
Schema validation warning: The 'http://www.opengis.net/gml/3.2:Polygon' element is not declared. Line 244, position 5.

Warning: Schema could not be validated. Class generation may fail or may produce incorrect results.

Error: Error generating classes for schema 'siri_estimatedTimetable_service'.
  - The datatype 'http://www.ifopt.org.uk/ifopt:CountryRefStructure' is missing.

If you would like more help, please type "xsd /?".

Can someone have a look? Has anyone been successful with this?

Thanks,
Thuc

@haeckerbaer
Copy link
Collaborator

Hello @thucnguyen77
The first nine warnings seem to concern validation of the schema /siri_model/siri_facility.xsd in which the corresponding ifopt import statements should be present. What version or branch did you use?

I see some differences in master branch https://github.com/SIRI-CEN/SIRI/blob/master/xsd/siri_model/siri_facility.xsd compared to v2.1 release https://github.com/SIRI-CEN/SIRI/blob/2.1/xsd/siri_model/siri_facility.xsd. It seems that the latter version has two specific import statements compared to the supposed "global" one which was introduced (without my knowledge) in commit 1216c8b#diff-b5adb2a25ab4eddcc4206b1f69ab8763697a0c72f435211a009d3faa8ef26059. That could be the issue.

Does it work if you try to reference the imported schemas explicitly with "xsd.exe /c schema.xsd import1.xsd import2.xsd"?

Hello @skinkie If I remeber correctly, you fixed some similar issues related to code generation with JAXB. Do you have any idea how to solve this problem and why the imports were changed in the referenced commit?
Cheers

@haeckerbaer haeckerbaer self-assigned this Jun 12, 2024
@haeckerbaer haeckerbaer added bug Something isn't working labels Jun 12, 2024
@skinkie
Copy link
Contributor

skinkie commented Jul 9, 2024

@thucnguyen77 can you try https://github.com/mganss/XmlSchemaClassGenerator instead of the Microsoft tool?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants