Question: a) Write code using JAXB to parse through an XML string and return the data. No main class so return the value. Hint : Will
a) Write code using JAXB to parse through an XML string and return the data.
No main class so return the value. Hint: Will need XmlStreamReader and Unmarshalling.
b) Create an @XmlElement Annotation class to map elements from the XML string.
XML String -
Expected outpout -
{
"Books": {
"book": [
{
"name": "John",
"author": "Josh"
},
{
"name": "Ben",
"author": 10
}
]
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
