Pergunta

Is there any way to generate classes implementing Serializable with xjc without changes in xsd? Initially (and I tried it with no luck) I thought that binding.xml for xjc would do the job but apparently it is not possible without placing globalBindings sections in xsd. I'm executing xjc from ant task if that is important.

Thank you

Foi útil?

Solução

Ok, I have found a solution.

My bindings.xml

<jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc">
<jxb:bindings schemaLocation="./myXsd.xsd" node="/xs:schema">
    <jxb:globalBindings>
        <xjc:serializable uid="1" />
    </jxb:globalBindings>
</jxb:bindings>

And my ant options:

  <xjc schema="./myXsd.xsd" target="../src/java" package="myxsd.xml" extension="true" binding="./binding.xml"/>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top