if you already have your java classes, then the schema isn't necessary.
jaxb can bind directly on to your hand-written classes, assuming you
have annotated them appropriately.
I believe that the generateValueClass binding customisation is for those
who need to migrate from JAXB 1 to 2, I think it's over-complicating
your situation.
Mitch Claborn wrote:
> I need some help getting started with JAXB. I'm using version 2.1.
>
> I have an existing set of Java classes that I want to load from an XML
> file. I've manually created a schema file with generateValueClass="false"
> and the xjc compiler generates interfaces and also some "Impl" classes
> which implement the interfaces. How do I indicate to the xjc program to
> use my existing classes as the implementations instead of the generated
> "Impl" classes?
>
> Or is there a better way to do this? I saw a reference to the
> JavaCompiler utility but can't find any examples on how to use it.
>
> Here is the xsd that I have been playing with:
>
>
> <?xml version="1.0"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
> jaxb:extensionBindingPrefixes="xjc"
> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1">
> <xsd:annotation>
> <xsd:documentation xml:lang="en">
> W3C XML Schema for surveys - use with JAXB
> </xsd:documentation>
> <xsd:appinfo>
> <jaxb:globalBindings
> collectionType="java.util.Vector"
> enableValidation="true"
> generateValueClass="false"
> >
> </jaxb:globalBindings>
> </xsd:appinfo>
> </xsd:annotation>
>
> <xsd:element name="survey">
> <xsd:complexType>
> <xsd:attribute name="versionID" type="xsd:int" />
> </xsd:complexType>
> </xsd:element>
>
> </xsd:schema>
>
>
>