Closed patanne closed 7 months ago
I'm not really sure how this library works internally either, but it sounds like the type of thing that happens if you don't preload required assemblies up front. For instance, you have three assemblies being generated. But if one is using Java reflection to find classes in the other, you'll have to make sure the assembly is loaded before it tries. It can't see classes just from dlls on disk.
Assembly. Load?
Oh. Also, arrive you're not using MavenReference, you'll probably want to say the class loader for each reference to AppDomainAssemblyClassLoader.
Thank you! That did it.
I am trying to build a proof of concept console app project that uses xerces2-J to validate XML against a XML Schema 1.1 XSD. I am using Jetbrains Rider for C#/.net and IntelliJ for Java. I am using .net 8.0 and JDK 11 for their respective platforms. I am also using the specific download, Xerces-J 2.12.2-xml-schema-1.1.
I am being tripped up right away when trying to create a SchemaFactory. In IntelliJ this line of code works...
In .NET you get the somewhat vague exception,
No SchemaFactory that implements the schema language specified by: http://www.w3.org/XML/XMLSchema/v1.1 could be loaded.
Going back to Java I dug further to learn that the factory supporting XSD 1.1 is org.apache.xerces.jaxp.validation.XMLSchema11Factory
Attempting to force use of that factory class I changed out the line of code above for this...
This line led to the slightly more descriptive exception,
Factory org.apache.xerces.jaxp.validation.XMLSchema11Factory could not be loaded to implement the schema language specified by: http://www.w3.org/XML/XMLSchema/v1.1.
I then attempted to cut out the whole factory resolution process by doing this...
That led back to the first, less descriptive exception.
When attempting to debug it appears I cannot step into the Java code from the jar file handled by IKVM, so I can go no further trying to identify the root cause.
I know the generated xerces dll is loading and can be referenced. Aside from namespace intellisense functioning as expected, these lines yield the correct results...
My project file has the following that is relevant...
The results are the same with or without the above 'references' tag in the project file.
Any idea what I am missing?