문제

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

도움이 되었습니까?

해결책

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"/>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top