Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to unmarshall the xml data to a list of Map of Strings? I have an xml data like this , I have tried to

How to unmarshall the xml data to a list of Map of Strings?

I have an xml data like this ,

image text in transcribedI have tried to unmarshall using this code ,

public class Book { private String author; private String title; private String genre; private float price; private float publish_date; private float description; }
public class mainClass { public static void main(String[] args) throws JAXBException, IOException { unmarshall(); } public static Book unmarshall() throws JAXBException, IOException { JAXBContext context = JAXBContext.newInstance(Book.class); return (Book) context.createUnmarshaller() .unmarshal(new FileReader("./books.xml")); } }

I am getting an exception like this ,

Exception in thread "main" javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"catalog"). Expected elements are (none). I knew its because of the "catalog" entity. But i want to do this for my project

please help. Thank you

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

Students also viewed these Databases questions

Question

14. What is a focused factory?

Answered: 1 week ago