简体   繁体   中英

Create POJO class structure using JAXB from XML

I have looked at below mentioned question:

Java JAXB how to create POJO classes

Java JAXB xml pojo classes

Here is what I want to do.

I want to use JAXB and create POJO Java classes at runtime . If I change my XML in future, I don't need to make change POJO Java class structure manually. I need to only restart whole Java Application and it will generate all classes at runtime without user input

FYI :-

  • using XJC is not helpful as i can not merge it into application.

  • I have already automated whole business logic which is not affected by XML file.

Here are some maven modules which you may find helpful

jaxb2-maven-plugin

Mojo's JAXB-2 Maven plugin is used to create an object graph from XSDs based on the JAXB 2.1 implementation and to generate XSDs from JAXB annotated Java classes.

maven-jaxb2-plugin

This Maven plugin wraps and enhances the JAXB Schema Compiler (XJC) and allows compiling XML Schemas (as well as WSDL, DTDs, RELAX NG) into Java classes in Maven builds.

jaxb2-maven-plugin

This plugin uses the Java API for XML Binding (JAXB), version 2+, to generate Java classes from XML Schemas (and optionally binding files) and to create XML Schemas from annotated Java classes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM