简体   繁体   中英

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

有没有人知道一个好的库或方法将HashMap的内容转换为XML然后解析它来重建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:

In 15 minutes your done!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM