简体   繁体   English

Jackson:从 XSD 生成 Jackson 类

[英]Jackson: Generate Jackson classes from XSD

Similar to JAXB generating JAXB classes to a given XSD, does Jackson provide any utility to generate Jackson classes from XSD or JSON.与 JAXB 为给定的 XSD 生成 JAXB 类类似,Jackson 是否提供任何实用程序来从 XSD 或 JSON 生成 Jackson 类。

JAXB class geberator has generated a set of classes for XSD schema defined. JAXB 类 geberator 已经为定义的 XSD 模式生成了一组类。 For example, for polymorphic types JAXB has the following annotation to identify the name based on XML Element name.例如,对于多态类型,JAXB 具有以下注释来根据 XML 元素名称识别名称。

@XmlElements({
    @XmlElement(name = "Dog", type = Dog.class),
    @XmlElement(name = "Cat", type = Cat.class)
})
protected List<Animal> animal;

Is it possible to create similar classes in Jackson.是否可以在杰克逊创建类似的课程。 ie., to identify the type based in XML element name.即,根据 XML 元素名称识别类型。

Have you looked at the similar question on StackOverflow?你看过 StackOverflow 上的类似问题吗? They may fully answer your question or contribute greatly to that.他们可能会完全回答您的问题或对此做出重大贡献。

  • This first link shows how to generate a json schema from an xml schema through java 第一个链接显示了如何通过 java 从 xml 模式生成 json 模式
  • Once you have the Json schema, This second link shows how to generate the classes from the json schema using jsonschema2pojo一旦你有了 Json 模式, 第二个链接显示了如何使用 jsonschema2pojo 从 json 模式生成类

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM