Convert xml to object java and vice versa

Thursday, June 8th, 2017 (0 Comment)

We have a xml file and we want to convert xml to object java and after that we want to convert object to xml string or file.

Example: We have Room object and User object. This room have many User objects. We want convert Room. User objects to xml and vice versa using java

1) Convert object to xml file by java

1.1. Write XML file with one object

Define Users.java object

Main to run

Output

1.2. Write XML file with Object parent have many Object child

Define Room.java object (room have many user)

Main to run

Output

2) Convert xml to object java

Main to run

Output

 

Tags: , ,

Related Posts

core java
Export Crystal Report with Subreport in java
core java
Java basic tutorial on lvtutorial.com
core java
Java hibernate manytomany to manage user role
core java
Java hibernate mongodb OneToMany and ManyToOne

Related Posts

core java
Export Crystal Report with Subreport in java
core java
Java basic tutorial on lvtutorial.com
core java
Java hibernate manytomany to manage user role
core java
Java hibernate mongodb OneToMany and ManyToOne

Leave a Reply

Your email address will not be published. Required fields are marked *