天下无双

欢迎加群【107262577】讨论技术、吹水

JAXB 2.0 Hello World

For people who have played with JAXB 1.x, JAXB 2.0 has the same beahavior: it can marshall/unmarshall object from/to XML. But the syntax is completly different. It uses all kind of annotations. This blog is just about writing and executing a good old Hello World with JAXB 2.0.

First you need to download and install the binary. For the following example you will just need to put jaxb-api.jar and jaxb-impl.jar in your classpath.

The following code represents a HelloWorld class with two attributes. The main method creates a HelloWorld object, sets some values, marshalles it to the hello.xml file, displays the xml representation, unmarshalles the xml file into a HelloWord and displays the toString method :

http://agoncal.wordpress.com/2006/07/06/jaxb-20-hello-world/

 

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭