I got big problems while unmarshalling. I generated with xjc data classes from my xsd file. This seems to work without any problem.
Now I tried this in my Kotlin project
val jaxbContext = JAXBContext.newInstance("org.inek.xml.schema.standortverzeichnis")//.newInstance(Standortverzeichnis::class.java)
val unmarshaller = jaxbContext.createUnmarshaller()
when I run the code I got following error message:
Exception in thread "main" javax.xml.bind.JAXBException: "org.inek.xml.schema.standortverzeichnis" does not contain ObjectFactory.class or jaxb.index
I don't know whats wrong with the code. The export from xjc is located in the same directory like the main.kt. The directory is named "org.inek.xml.schema.standortverzeichnis". The directory contains all data classes including ObjectFactroy and package-info.java
Thanks for help
Whether specified by the tool used or derived from namespace declared in XSD, generating java classes from XSD should generate classes in a base package with an
ObjectFactoryclass in it.For example, having the
targetNamespacedeclared astargetNamespace="http://po.example.org", it will generate java classes like hereThen, in my code (here kotlin syntax, but Java should be the same), I'll instantiate the
jaxbContextby refering the base packageorg.example.po, containing theObjectFactoryclass in itYou can then adapt this sample to your code to find the best package to instantiate your
JAXBContextRegards,
Laurent