Rinie
JCHJava Community | Help. Code. Learn.
•Created by Rinie on 11/4/2024 in #java-help
how do I generate POJOs from XSD without XML annotations?
I need to generate a JSON schema within Java application and I've come across few maven plugins which create JSON schema strings from Java classes. Our code has generated .java classes but they're all generated from XSD using jaxb but with annotations like @XmlElement and using these classes might not yield proper JSON schema.
Removing them programmatically using regex and all seems error prone.
I want to generate plain and simple POJOs from XSD without any annotations so that they can be used for generating JSON schema.
Or better yet, how can I generate Java classes with JSON annotations like @JsonProperty from XSD itself? I couldn't find a solution to this so my previous question still stands.
Application is built on Java, Spring boot, Maven, SOAP.
The only solution I tried so far is I used jaxb2-maven-plugin with <arguments> -X none but it threw me an error saying couldn't resolve -X and arguments tag is deprecated.
Could anyone please help with this?
Thank you!!
4 replies