import org.json.JSONObject;
import org.json.XML;

// xml解析后的JSON
JSONObject parseJSON;
try {
  parseJSON = XML.toJSONObject(xmlStr).getJSONObject("BaseLine"); //xmlStr传入的xml格式字符串,BaseLine xml中的顶层节点
} catch (JSONException e) {
  logger.error("XML格式错误******" + e.getMessage() + "******");
  return "N-" + e.getMessage();
}

XML参考示例:

<?xml version="1.0" encoding="GB2312"?>

<BaseLine>

        <Number>0000073676</Number>

        <Name>JC-xxx-S-20190411</Name>

        <State>RELEASED</State>

        <LastModified>2019/04/11 00:43</LastModified>

        <Product>D/代号-名称(S阶段)</Product>

        <Type>MBOM</Type>

</BaseLine>

相关文章:

  • 2021-06-04
  • 2022-12-23
  • 2021-10-13
  • 2022-12-23
  • 2022-03-08
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
相关资源
相似解决方案