1.第一步,加入如下jar包
<!-- 解析xml文件 -->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.1</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.5</version>
</dependency>
2.测试代码,一眼就懂
package com.example.zhanyestudy.controller;
import net.sf.json.JSON;
import net.sf.json.JSONObject;
public class XMLSerializer {
public static void main(String[] args) {