Lets say that i have following XML and i use JAXB for marshalling:
<bookstore name="bookstoreName">
<book title="bookTitle">
<author fullname="authorName">
</author>
</book>
</bookstore>
I know how to create:
I did this by using annotations @XmlRootElement, @XmlElement and @XmlAttribute.
What i don't know is how to create attributes of child nodes. For example attribute "title".
title
will be a property on the Book
class annotated with @XmlAttribute
. Book
will be referenced by BookStore
probably as a List
property.
@XmlElement(name="book")
List<Book> getBooks() {
return books;
}