Javatpoint Logo
Javatpoint Logo

JAXB Unmarshalling Example: Converting XML into Object

By the help of UnMarshaller interface, we can unmarshal(read) the object into xml document.

In this example, we are going to convert simple xml document into java object.

Let's see the steps to convert XML document into java object.

  • Create POJO or bind the schema and generate the classes
  • Create the JAXBContext object
  • Create the Unmarshaller objects
  • Call the unmarshal method
  • Use getter methods of POJO to access the data

Unmarshaller example: Converting xml document into java object

Xml Document

File: question.xml

POJO classes


Unmarshaller class



1 What is java?
101 java is a programming language ravi
102 java is a platform john

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA