简体   繁体   中英

How to fetch value from xml in Springboot java

我的xml包含<List><came cameId="cam-1" cameName="Came 1"></List>所以在这里我想要帮助如何在Java类中获取cameid

you can use XStream jar write the code like this

XStream xstream = new XStream();
(java object name) xstream.fromXML(new ClassPathResource("location of your xml file ").getFile());

variable name should be same in both java object and xml file.

hope this will help :)

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