开发者

The best and/or fastest to learn Java API for consuming XML feeds with attributes

What is the best and/or fastest to learn Java API for consuming XML feeds like this:

<body copyright="Company">
    <student id="1" fname="Anthony" lname="Hopkins"/>
    <student id="2" fname="John" lname="Anderson"/>
    <student id="3" fname="Will" lname="Smitherman"/>
</body>

As you can see it provides all the data with attributes. Also, XML Feed d开发者_StackOverflowata will be accessed using URLs with parameters specified in the query string.

Thanks in advance guys.


Easiest way is to use JaxB to generate the Java classes for you. If you have a schema you use xjb tool that will create the classes and can let java do all the parsing without you needing to do anything.

Look at http://www.javaworld.com/javaworld/jw-06-2006/jw-0626-jaxb.html


It depends on what you want to do with it but XStream might be the easiest way to import data from XML. This can produce a data structure to match your data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜