Developer notes written down before they get lost.
XML Mapper for GWT
I’m a big fan of RESTful architectures. When using REST resources with XML representations in combination with GWT
you have to parse the XML and map it to the model used in the GWT client. The code therefore is tedious and
error-prone. So I decided to start a little framework called “piriti” (Maori for bridge). It is hosted on goolge code
under https://github.com/hpehl/piriti. The basic idea behind piriti is to use annotations on your model and generate
the parsing / mapping code with the help of deferred binding.
Let’s assume you have a REST resource for a book which produces the following XML representation
<book><isbn>978-0345417954</isbn><pages>432</pages><title>The Hotel New Hampshire</title><author><firstname>John</firstname><surname>Irving</surname></author><reviews><review>A hectic gaudy saga with the verve of a Marx Brothers movie.</review><review>Rejoice! John Irving has written another book according to your world. You must read this book.</review><review>Spellbinding, intensely human, a high-wire act of dazzling virtuosity.</review></reviews></book>
On the GWT client you have the following model classes