How to generate classes from XSD that implements serializable?

前端 未结 2 691
后悔当初
后悔当初 2020-12-15 08:03

I need to generate many classes from my XML Schema (XSD) in a package (.jar). How can I configure these classes to be serializable?

(I\'m using Eclipse and JAX-B)

2条回答
  •  猫巷女王i
    2020-12-15 09:02

    If you are using XJC, I recomend you to read this reference: JavaTM Architecture for XML Binding: JAXB RI Vendor Extensions Customizations :

    You have to add in your schema aditional namespaces definition to add xjc aditional markup:

    
    

    Then, including an node within :

    
       
          
              
          
       
    
    

    This will cause that all the concrete classes implement the Serializable interface. Also, you can define the UUID value of the resulting classes (that's an optional attribute).

提交回复
热议问题