From c53fdd16d37761c77005519b47efef1a61b2c98f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 2 May 2013 22:35:38 +1200 Subject: Fix XML parsing (fix #45) --- src/org/traccar/web/shared/model/XmlParser.java | 40 ------------------------- 1 file changed, 40 deletions(-) delete mode 100644 src/org/traccar/web/shared/model/XmlParser.java (limited to 'src/org/traccar/web/shared/model/XmlParser.java') diff --git a/src/org/traccar/web/shared/model/XmlParser.java b/src/org/traccar/web/shared/model/XmlParser.java deleted file mode 100644 index f19c75a8..00000000 --- a/src/org/traccar/web/shared/model/XmlParser.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.traccar.web.shared.model; - -import java.util.LinkedList; -import java.util.List; - -import com.google.gwt.regexp.shared.MatchResult; -import com.google.gwt.regexp.shared.RegExp; - -public class XmlParser { - - public static List enumerateElements(String input) { - List list = new LinkedList(); - - RegExp parser = RegExp.compile("<([^/<][^<]*)>", "g"); - MatchResult result = parser.exec(input); - while (result.getGroupCount() > 0) { - list.add(result.getGroup(1)); - result = parser.exec(input); - } - - return list; - } - - public static String getElement(String input, String key) { - - StringBuilder pattern = new StringBuilder(); - pattern.append("<").append(key).append(">"); - pattern.append("([^<]*)"); - pattern.append(""); - - RegExp parser = RegExp.compile(pattern.toString()); - MatchResult result = parser.exec(input); - if (result.getGroupCount() > 0) { - return result.getGroup(1); - } - - return null; - } - -} -- cgit v1.2.3