问题描述
解析http post 返回消息时一个字符串形式的xml我想获取字符串<ResultDesc>successful</ResultDesc>如下,....<ResultDesc xmlns="http://www.huawei.com/bme/cbsinterface/common">successful</ResultDesc>......我用了正则表达式,结果没有输出returnMsg,请建议 Pattern regex = Pattern.compile("<ResultDesc>(.*?)</ResultDesc>", Pattern.DOTALL); Matcher matcher = regex.matcher(resp); String returnMsg = null; while (matcher.find()) { returnMsg = matcher.group(1); System.out.println("Return Message: " + returnMsg);
解决方案
<ResultDesc.*>(.*?)</ResultDesc>
时间: 2024-10-02 01:10:39