xsd - Expected or Recommended usage of the Maven JAXB 2.x Plugin -


i'm new xml schema , jaxb , wondering best or expected approach using maven jaxb plugin (http://static.highsource.org/mjiip/maven-jaxb2-plugin/generate-mojo.html)is.

i have simple xml document format i've defined schema. i'm interested in reading compliant xml file java, i'll want add properties pojos won't in xml, used @ runtime.

by default plugin places generated code ${project.build.directory}/generated-sources/xjc. think want copy generated code /src/main/java/whatever , add to/modify code add properties. when change schema, i'd merge changes form newly generated pojos own ones.

the alternative tell plugin place generated source directly /src/main/java , perhaps subclass pojos add own properties, i'm not sure whether marshaling/unmarshaling can still made use extended classes.

anyone have guidance on approach more normal or pitfalls of each are?

in place i'd leave generated sources corresponding jar can built maven without further configuration , put custom code in different project depends on first one. ensures build in right order.

it choice whether derive generated classes or use instances of them in code, attributes or, better, local variables. i'd avoid derivation; after jaxb low level machinery use perform i/o in specific format.

most importantly: forget modifying generated sources; why introduce error prone manual step in development process when can same effect automatically?


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -