JAXB Marshalling Example: Converting Object into XMLBy the help of Marshaller interface, we can marshal(write) the object into xml document. In the previous page, we have seen the simple example of converting object into xml. In this example, we are going to convert the object into xml having primitives, strings and collection objects. Let's see the steps to convert java object into XML document.
File: Question.java File: Answer.java File: ObjectToXml.java Output:The generated xml file will look like this: File: question.xml Next TopicJaxb Unmarshalling Example |