java Jackson:从 XSD 生成 Jackson 类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29676658/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 15:42:53  来源:igfitidea点击:

Hymanson: Generate Hymanson classes from XSD

javaxmlxsdjaxbHymanson

提问by dinup24

Similar to JAXB generating JAXB classes to a given XSD, does Hymanson provide any utility to generate Hymanson classes from XSD or JSON.

类似于 JAXB 为给定的 XSD 生成 JAXB 类,Hymanson 是否提供任何实用程序来从 XSD 或 JSON 生成 Hymanson 类。

JAXB class geberator has generated a set of classes for XSD schema defined. For example, for polymorphic types JAXB has the following annotation to identify the name based on XML Element name.

JAXB 类 geberator 生成了一组为 XSD 模式定义的类。例如,对于多态类型,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 Hymanson. ie., to identify the type based in XML element name.

是否可以在 Hymanson 中创建类似的类。即,根据 XML 元素名称识别类型。

回答by alainlompo

Have you looked at the similar question on StackOverflow? They may fully answer your question or contribute greatly to that.

你在 StackOverflow 上看过类似的问题吗?他们可能会完全回答您的问题或对此做出巨大贡献。

  • This first linkshows how to generate a json schema from an xml schema through java
  • Once you have the Json schema, This second linkshows how to generate the classes from the json schema using jsonschema2pojo
  • 第一个链接显示了如何从通过Java的XML模式的JSON模式
  • 获得 Json 架构后,第二个链接将显示如何使用 jsonschema2pojo 从 json 架构生成类