0

I have a bunch of Java classes. I have been using JAX-B to serialize them to XML. I am not interested in deserializing from XML.

I am dissatisfied with how JAX-B works, especially when it comes to inheritance.

I am exploring using XmlBeans. I cannot use XStream as it will never pass certification due to its vulnerabilities.

I do not have any XSD. The following is an overly simplified set of classes I need to serialize to XML.

public class Line {
  @XmlAttribute
  public int width;
  @XmlAttribute
  public Color color;
} 

@XmlRootElement
public class Chart {
  @XmlAttribute
  public Color background;
  public List<Line> lines;
}

In what ways could I use XmlBeans, as well as how should I modify these classes, to serialize an instance of the Chart class?

Blessed Geek
  • 21,058
  • 23
  • 106
  • 176

0 Answers0