JAXB - Parse element into string
问题 Is there a way to parse part of an XML message into a String keeping it in XML format? Example... <person> <name>John Doe</name> <age>24</age> <address> <street>bailey</street> <city>boston</city> </address> </person> public class Person { @XmlElement private NameClass name; @XmlElement private int age; @XmlElement private String address; ... } public class NameClass { ... } Where I want the entire address element to be kept in XML format and parsed as a String. 回答1: You can use