xsd2 icon indicating copy to clipboard operation
xsd2 copied to clipboard

XSD2 code generation failed

Open R0l1I3S opened this issue 5 years ago • 2 comments

The execution of the command

"<PATH_TO_XSD2.exe>\Xsd2.exe" ^ INSPIRE_LU_PLANNED\BaseTypes.xsd ^ INSPIRE_LU_PLANNED\BaseTypes2.xsd ^ INSPIRE_LU_PLANNED\LandUseNomenclature.xsd ^ INSPIRE_LU_PLANNED\xlink\1.0.0\xlinks.xsd ^ INSPIRE_LU_PLANNED\gml\3.2.1\gml.xsd ^ INSPIRE_LU_PLANNED\gml\3.3\extdEncRule.xsd ^ INSPIRE_LU_PLANNED\iso\19139\20070417\gmd\gmd.xsd ^ INSPIRE_LU_PLANNED\iso\19139\20070417\gco\gco.xsd ^ INSPIRE_LU_PLANNED\iso\19139\20070417\gmx\gmx.xsd ^ INSPIRE_LU_PLANNED\iso\19139\20070417\gss\gss.xsd ^ INSPIRE_LU_PLANNED\iso\19139\20070417\gts\gts.xsd ^ INSPIRE_LU_PLANNED\iso\19139\20070417\gsr\gsr.xsd ^ INSPIRE_LU_PLANNED\Sonstiges\Addresses.xsd ^ INSPIRE_LU_PLANNED\Sonstiges\GeographicalNames.xsd ^ INSPIRE_LU_PLANNED\PlannedLandUse.xsd ^ @pause

within a batch file leads to the following error message:

C:\Daten\xxx\INSPIRE_LU_PLANNED\BaseTypes.xsd C:\Daten\xxx\INSPIRE_LU_PLANNED\BaseTypes.cs XSD2 code generation failed. System.Xml.Schema.XmlSchemaException: Nicht definiertes 'complexType' 'http://www.opengis.net/gml/3.2:AbstractFeatureType' wird als Basis für die Erweiterung des komplexen Typs verwendet. bei System.Xml.Schema.XmlSchemaSet.InternalValidationCallback(Object sender, ValidationEventArgs e) bei System.Xml.Schema.BaseProcessor.SendValidationEvent(XmlSchemaException e, XmlSeverityType severity) bei System.Xml.Schema.Compiler.CompileComplexContentExtension(XmlSchemaComplexType complexType, XmlSchemaComplexContent complexContent, XmlSchemaComplexContentExtension complexExtension) bei System.Xml.Schema.Compiler.CompileComplexType(XmlSchemaComplexType complexType) bei System.Xml.Schema.Compiler.Compile() bei System.Xml.Schema.Compiler.Execute(XmlSchemaSet schemaSet, SchemaInfo schemaCompiledInfo) bei System.Xml.Schema.XmlSchemaSet.Compile() bei System.Xml.Serialization.XmlSchemas.Compile(ValidationEventHandler handler, Boolean fullCompile) bei Xsd2.XsdCodeGenerator.Generate(IList`1 schemas, TextWriter output) in C:\Users\xxx\Downloads\xsd2-master\Xsd2\XsdCodeGenerator.cs:Zeile 79. bei Xsd2.Program.Main(String[] args) in C:\Users\xxx\Downloads\xsd2-master\Xsd2\Program.cs:Zeile 131.

That means there is a 'complexType' which is not defined and which is used as a base for the extension of the complex type.

The files I used above can be found here:

INSPIRE_LU_PLANNED.zip

Is this behaviour a bug or do I have to use other options of xsd2.exe to successfully generate C# or VB .NET classes from the xsd files?

R0l1I3S avatar Jul 24 '19 08:07 R0l1I3S

Hi Still having this issue? Have you tried generating only a single xsd file?

meirkr avatar Jun 06 '20 22:06 meirkr

Hi I have same issue.

I want generate C# classes from several xsd downloaded to one local directory. All XSD files are in https://datex2.eu/schema/3/

I think the problem is because each XSD file have several references to other XSD files and the error is 'complexType' which is not defined. Example reference to
<xs:import namespace="http://datex2.eu/schema/3/trafficRegulation" schemaLocation="DATEXII_3_TrafficRegulation.xsd"/>

Could I merge all XSD files in one? How?

Thanks

javiernaturalvox avatar Feb 02 '24 10:02 javiernaturalvox