Michael has posted 1 posts at DZone. View Full User Profile

Moose XML for Java Makes XML and Web Services Fun

03.25.2010
| 1767 views |
  • submit to reddit

MooseXML for Java is the newest, best way to get XML data into and out of your Java applications and web services.

Start with a simple Java bean:

@XML(name="hello")
public class HelloWorld {
// Accessors omitted for brevity

@XMLField(name="name")
private String name;
}

And then end up with the following XML:

<hello><name>Moose XML</name></hello>

Moose XML supports the following features:

  • Integrates with Spring Web Services out of the box
  • Automatic XML Schema generation--you annotate your Java classes and Moose will handle the generation of an XML schema to match
  • The above two features combine to allow rapid, code-first web services development
  • Includes examples and developer documentation

More information on Moose XML is available at the following location:

<a href="http://quigley.com/moose/>The Moose XML Homepage</a>

There, you can access the <a href="http://quigley.com/releases/moose/0.4.0/developer-guide.html">Developer Guide</a>, and also download the <a href="http://quigley.com/releases/moose/0.4.0/quigley-moose-src-0.4.0.1109.zip">latest release</a>.

0
Average: 5 (1 vote)
Published at DZone with permission of its author, Michael Quigley.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Seb Cha replied on Thu, 2010/03/25 - 6:48pm

Hello,

 

There are misstyping in your code, it should be :

 

@XmlRootElement(name = "hello")
public class HelloWorld {
// Accessors omitted for brevity

@XmlAttribute(name = "name")
private String name;
}

 

Regards.

Peter Karussell replied on Sat, 2010/03/27 - 8:47am

Don't think that you can say 'best way'. Best always depends on your requirements. There are a lot of tools for that xml stuff, that I am 100% sure one of those tools is better for some usecases in easiness, performance, memory usage, libraray size, community, license, ...

Michael Quigley replied on Thu, 2010/04/01 - 4:14pm

@Seb Cha... That's actually not accurate. What's in the original article are the correct Java annotations for the Moose XML framework.

Perhaps you are thinking of a different framework?

For more details, check out the developer's guide at:

http://quigley.com/releases/moose/0.4.0/developer-guide.html

Specifically there is a section on the Moose XML annotations at:

http://quigley.com/releases/moose/0.4.0/developer-guide.html#id4423193

Michael Quigley replied on Thu, 2010/04/01 - 4:15pm in response to: Peter Karussell

@Peter Karich... I was taking a bit of license. Of course the right tool is always dependent on the job...

Moose XML has helped me with a variety of projects. I'm just hoping it can help others, too.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.