admin 管理员组

文章数量: 1184232


2024年3月29日发(作者:视频教程网大全)

/**

* 描述:

*

* @author anliex

* @date 2018/11/26 11:26

*/

public class Xml2Map {

/*xml转map*/

public static Map xml2Map(String xmlResult){

Map map = new HashMap<>();

Document result ;

try {

result = ext(xmlResult);

// 获取根节点

Element rootElt = tElement();

//获取根节点下所有节点

List list = ts();

//遍历节点

for (Element element : list) {

//节点的name为map的key,text为map的value

(e(), t());

}

} catch (Exception e) {

tackTrace();

}

return map;

}

}

结果奉上


本文标签: 节点 视频教程 作者 获取 遍历