开发者

Dump a Java HashMap<K,V> to XML and back

does anyone know of a good library or开发者_C百科 method of converting the contents of a HashMap to XML and then parsing this to reconstruct the HashMap?


The XStream library is what you want. http://x-stream.github.io/

It has a HashMap converter, and a tutorial on how to use convertors.


Java Architecture for XML Binding (JAXB) allows Java you to map Java classes to XML representations. JAXB provides two main features: the ability to marshal Java objects into XML and tunmarshal XML back into Java object

Where to start? Pick a tutorial from these:

  • http://en.wikipedia.org/wiki/Java_Architecture_for_XML_Binding

  • http://jaxb.java.net/

  • http://java.sun.com/developer/technicalArticles/WebServices/jaxb/

In 15 minutes your done!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜