/**
* Description: 对http接口的返回值strResult进行格式化
* @param xmlContentxml文本格式字符串
* @return String[][] String[0][0] 接口调用返回码 String[1] 如果有返回集,从1开始计数
*/
private static Element getresultbyxml(String xmlContent) {
ByteArrayInputStream stream = null;
DocumentBuilderFactory factory = null;
try {
// 将输入内容转换编码为UTF-8
stream = new ByteArrayInputStream(xmlContent.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
factory = DocumentBuilderFactory.newInstance();
Element root = null;
try {
Document doc = factory.newDocumentBuilder().parse(stream);
// 返回根元素<searchresult>
root = doc.getDocumentElement();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
return root;
}
http5
最新推荐文章于 2023-10-24 15:51:08 发布