0

我需要<xml>__content__</xml>java中以下响应字符串的一部分

Content-Type: application/xml; charset=UTF-8; name=response_xml<xml>...</xml>
4

1 回答 1

0

EDIT


Now that I understand what you need, you can use a simple regex to extract the text between the tags <xml> and </xml>


public static void main(String[] args) {
    String a="Content-Type: application/xml; charset=UTF-8; name=response_xml<xml>content</xml>";
    final Pattern pattern = Pattern.compile("<xml>(.+?)</xml>");
    final Matcher matcher = pattern.matcher(a);
    matcher.find();
    System.out.println(matcher.group(1));
}
于 2014-12-30T11:50:36.160 回答