I would like to create XML Documents from XSD files on GWT-based server. Unfortunately I can't use the javax.xml.bind package, the compiler gives me the following error:
No source code is available for type javax.xml.bind.Marshaller; did you forget to inherit a required module?
I tried alternative libraries but they use the Marshaller or JAXBContext from the above package Parse XML file in GWT server-side. GWT's XML Parser doesn't work on the server side. Overriding the package implementation didn't work either. In addition I would like to validate XML files with the schema.
Edit solution:
I referred to the given solution and the links in my initial question. I couldn't get the JAXB-stuff to work on the client side, because there were too many dependencies and I don't like to add all source files in a new package. Nevertheless I can use the xml annotations in shared code. Due to the amount of explanations, their confusing style (my opinion) and the current year, I will explain my approach. It is the same as in other solutions, maybe a little bit easier to understand and totally based on Tassos Bassoukos from the accepted solution:
- Find your needed source file in your JDK. There is a source.zip folder in your installation folder.
- Create a package in your project based on the Overriding one package implementation with another. This new package path corresponds to the path of your desired Java files. Add the
<super-source path="jre" />
annotation in your gwt.xml ! - Copy the files from (1.) in the new package and change their import declaration (All classes referencing the desired classes import the real java package path, not your custom one).