I'm trying to convert bunch of XSD files to Java source POJOs at runtime. These XML schemas will be generated based on some protocol specific model definitions.
I have used the JAXB's XJC to compile the schema to pojo. Started facing problem when I used Jaxb2-annotate-plugin for doing custom annotation.
For testing, I have added following in my schema,
<xs:schema xmlns:aa="http://acme.example.com/system"
xmlns:another="http://acme.example.com/another"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:ncn="urn:ietf:params:xml:ns:netconf:notification:1.0"
jaxb:extensionBindingPrefixes="annox"
xmlns:annox="http://annox.dev.java.net"
targetNamespace="http://acme.example.com/system"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
XJC started giving the following error from there after,
Unsupported binding namespace "http://annox.dev.java.net". Perhaps you meant "http://java.sun.com/xml/ns/jaxb/xjc"?
As per suggestions provided in various sources, added required JARS in XJC's classpath as follows, but nothing seems to workout for me.
xjc -p com.test -classpath="jaxb2-basics-annotate-1.0.2.jar;tools-0.4.1.5.jar;commons-logging-1.1.1.jar;jaxb2-basics-runtime-0.9.5;annox-1.0.1.jar;javaparser-1.0.11.jar;jaxb2-basics-tools-0.9.5.jar" -extension myschema.xsd
I couldn't find a proper example for generating java sources using XJC with jaxb2-annotate-plugin. I cannot add this in my maven/ant, as I mentioned I've to generate xsd and pojo at runtime.
If using the XJC tool as java process is the only way, please let me know,
- What are the dependent jars to be included in classpath?
- How to activate the plugin and -Xannotate switch?
If the pojo generation can be done in other ways with this plugin, please suggest the same.
I'm a newbie in jaxb. Any suggestions would be really helpful. Thanks in advance!