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

No code generated for schemas located with https: and locally, but http: works. #534

Open
phoyd opened this issue Nov 23, 2024 · 2 comments

Comments

@phoyd
Copy link

phoyd commented Nov 23, 2024

I believed that

XmlSchemaClassGenerator.Console.exe --verbose --output=gen "https://schemas.opengis.net/gml/3.2.1/gml.xsd"

should generate classes for the opengis gml schema types in the exsisting folder "gen". However what happens is

  1. gen stays empty
  2. I get a lot of messages about types already been declared:
[...]
The complexType 'http://www.opengis.net/gml/3.2:FeatureArrayPropertyType' has already been declared.
The complexType 'http://www.opengis.net/gml/3.2:BoundedFeatureType' has already been declared.
The complexType 'http://www.opengis.net/gml/3.2:AbstractFeatureCollectionType' has already been declared.
The complexType 'http://www.opengis.net/gml/3.2:FeatureCollectionType' has already been declared.
The complexType 'http://www.opengis.net/gml/3.2:IndirectEntryType' has already been declared.
The complexType 'http://www.opengis.net/gml/3.2:DefinitionProxyType' has already been declared.
The simpleType 'http://www.opengis.net/gml/3.2:IncrementOrder' has already been declared.
The complexType 'http://www.opengis.net/gml/3.2:MovingObjectStatusType' has already been declared.

Next I mirrored the schema and tried the local files:

XmlSchemaClassGenerator.Console.exe -o "out" -v schemas.opengis.net/gml/3.2.1/gml.xsd

And got the same messages as above and no code.

HOWEVER

If I use http: instead of https: to locate the schema:

XmlSchemaClassGenerator.Console.exe --verbose --output=gen "https://schemas.opengis.net/gml/3.2.1/gml.xsd"

The classes are generated, and they compile and work.

I've tried:

  • The current xscgen tool in windows and linux
  • The current 2.1.1167 release on windows and linux
  • A build of HEAD on linux.

What is wrong? Did I miss something? The gml schemas do a lot of mutual XIncludes, which might explain why the tools receives duplicate definition - so I'd guess that some check for recursive XIncludes is kind of broken?

@mganss
Copy link
Owner

mganss commented Nov 23, 2024

There is a chain of includes that leads to http://schemas.opengis.net/iso/19139/20070417/gco/basicTypes.xsd which has

<xs:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>

The validation in XmlSchemaSet treats this as a different URI than https://schemas.opengis.net/gml/3.2.1/gml.xsd.

@phoyd
Copy link
Author

phoyd commented Nov 23, 2024

Oh wow, thank you! I fixed this for me by using a custom XmlResolver that forces an URL scheme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants