示例#1
0
 /**
  * 解析attributes为hashMap
  *
  * @param attributes 格式: name='badqiu' sex='F'
  * @return
  */
 public static Map<String, String> parse2Attributes(String attributes) {
   Map result = new HashMap();
   Pattern p = Pattern.compile("(\\w+?)=['\"](.*?)['\"]");
   Matcher m = p.matcher(attributes);
   while (m.find()) {
     result.put(m.group(1), StringHelper.unescapeXml(m.group(2)));
   }
   return result;
 }