xjc type definition name resolution error
-
02-07-2021 - |
Вопрос
I am running into troubles when wanting to compile my XSDs (which I am not the author of) with XJC.
Specifically, I get the error (there are actually more like these):
[ERROR] src-resolve: Cannot resolve the name "ifopt:CountryRefStructure" to a(n) 'type definition' component.
line 131 of file:/E:/ansdef/schema/siri-1.3/siri/siri_situationIdentity-v1.1.xsd
That is strange since the mentioned file (siri_situationIdentity-v1.1.xsd
) refers to another XSD where the suspicious type is declared.
I tried several things
- switch Java version to get different xjc
- tried some different xjc directly from java.net
- applied some modifications to the files so that the currently applied JAXB workarounds regarding includes/imports are removed
- tried to use the whole directory with dependent schemas as target for xjc
- Altova XMLSpy Java code generation works well without errors (but is no way to go for me)
None of them worked.
Does anybody have a clue what the error message is caused by? I don't see the point. You may get all the XSDs directly from here: Verband Deutscher Verkehrsunternehmen (VDV) - Ist-Daten-Schnittstellen
The command line I tried (amongst others) was:
xjc -readOnly -d generated -npa -target 2.1 -verbose VDV453_incl_454_V2.3e.xsd
Any help or hint is greatly appreciated.
Regards
Решение
The solution here was to use the -nv
switch to disable strict validation.
Другие советы
The error message is caused by XJC's failure to load the other schema document successfully. You have several options.
- The xjc documentation suggests that it accepts multiple command-line arguments, so try specifying all the schema documents you want it to read as command-line arguments.
- You can also try to figure out what base URI it's using for resolving relative references, or (more directly) ...
- You can (try to) figure out how to tell XJC what base URI to use.
- Since XJC also supports XML catalogs, you may be able to use a catalog to tell it where to find the files your top-level schema document is referring to.