5

I've seen many times xml in rest web services, having the following format:

<author>
   <atom:link rel="author" type="application/xml" href="http://www.../author/1"/>
</author>

and the url (http://www.../author/1) will contain something like this:

<author xmlns="http://www.../ckp" xmlns:atom="http://www.w3.org/2005/atom">
  <name>S. Crocker</name>
  <address>None</address>
  <affiliation></affiliation>
  <email>None</email>
</author>
  1. I was wondering why the first form of xml is being used?
  2. How can these be modeled on a java model class (using the mvc pattern)?
Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
Alex Dowining
  • 980
  • 4
  • 19
  • 41

1 Answers1

0

The answer to your first question is simple: ATOM is a solid standard that covers a bunch of standard things that you want to do for publishing, updating, and otherwise managing information.

So, people use ATOM for the same reason they use HTTP - they could invest something unique, but the standard gives them better tools.

To the second, various Java libraries exist, but there is no definitive way to do this. Everything from "write your own model objects and hand-parse the XML" through to the sort of "do it for you" libraries that question links to will work just fine.

Community
  • 1
  • 1
Daniel Pittman
  • 16,733
  • 4
  • 41
  • 34