<book>
<price>50.0</price>
</book>
@Root(name = "book")
public class Book {
@Element(name = "title")
private String title;
@Element(name = "author")
private String author;
@Element(name = "price")
private double price;
}
public class Main {
public static void main(String[] args) throws Exception {
Serializer serializer = new Persister();
Book book = serializer.read(Book.class, xml);
book.setPrice(60.0);
StringWriter writer = new StringWriter();
serializer.write(book, writer);
}
}