JAXB xjc mapping to existing domain objects JAXB xjc mapping to existing domain objects xml xml

JAXB xjc mapping to existing domain objects


You can use an external binding file to configure XJC to do what you want.

<jxb:bindings     xmlns:xs="http://www.w3.org/2001/XMLSchema"    xmlns:jxb="http://java.sun.com/xml/ns/jaxb"    version="2.1">    <jxb:bindings schemaLocation="yourSchema.xsd">        <jxb:bindings node="//xs:complexType[@name='CustomerOffice']">            <jxb:class ref="com.blah.domain.CustomerOffice"/>        </jxb:bindings>    </jxb:bindings></jxb:bindings>

XJC Call

xjc -d outputDir -b binding.xml yourSchema.xsd