summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/isode/stroke/parser/payloadparsers/LastParser.java')
-rw-r--r--src/com/isode/stroke/parser/payloadparsers/LastParser.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/com/isode/stroke/parser/payloadparsers/LastParser.java b/src/com/isode/stroke/parser/payloadparsers/LastParser.java
new file mode 100644
index 0000000..d2c2a82
--- /dev/null
+++ b/src/com/isode/stroke/parser/payloadparsers/LastParser.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2011, Isode Limited, London, England.
+ * All rights reserved.
+ */
+/*
+ * Copyright (c) 2011, Kevin Smith.
+ * All rights reserved.
+ */
+
+package com.isode.stroke.parser.payloadparsers;
+
+import com.isode.stroke.elements.Last;
+import com.isode.stroke.parser.AttributeMap;
+import com.isode.stroke.parser.GenericPayloadParser;
+
+public class LastParser extends GenericPayloadParser<Last> {
+
+ private int level_ = 0;
+
+ public LastParser() {
+ super(new Last());
+ }
+
+ public void handleStartElement(String element, String ns, AttributeMap attributes) {
+ if (level_ == 0) {
+ int seconds = 0;
+
+ try {
+ seconds = Integer.parseInt(attributes.getAttribute("seconds"));
+ }
+ catch (NumberFormatException ex) {
+ }
+ getPayloadInternal().setSeconds(seconds);
+ }
+ ++level_;
+ }
+
+ public void handleEndElement(String element, String ns) {
+
+ }
+
+ public void handleCharacterData(String data) {
+
+ }
+
+}