日期:2014-05-20 浏览次数:20618 次
org.dom4j.io.SAXReader reader = new org.dom4j.io.SAXReader();
doc = reader.read(new File("conf/you.cfg.xml"));
Element root = doc.getRootElement();
List dbs = root.elements();
if (dbs.size() > 0) {
Element elm = (Element) dbs.get(0);
String name = elm.getName();
initConnProp(elm);
}
String xml = "<Row><Data>0</Data><Data>10057</Data><Data>8602</Data>\n<Data>114.018909</Data>\n<Data>23.209072</Data>\n<Data>广东省惠州市的G324附近,新禾村附近</Data></Row>";
Pattern pattern = Pattern.compile("<data>(\\d*\\.\\d*)</data>", Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(xml);
ArrayList<String> lst = new ArrayList<String>();
while (matcher.find()) {
lst.add(matcher.group(1));
}
System.out.println(lst);