Forum Stats

  • 3,872,915 Users
  • 2,266,490 Discussions
  • 7,911,382 Comments

Discussions

How to create XSD classes for Jackson.

Jackson does not provide a tool for generating Jackson classes from XSD or JSON, as JAXB does for a specific XSD.

The JAXB class generator was used to generate a set of classes for the specified XSD schema. For polymorphic types, for example, JAXB provides the following annotation to identify the name based on the name of an XML element.

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

Can such courses be offered in Jackson? Specifically, determining the type based on the name of an XML element.

Tagged: