summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/isode/stroke/parser/payloadparsers/SubjectParser.java')
-rw-r--r--src/com/isode/stroke/parser/payloadparsers/SubjectParser.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/com/isode/stroke/parser/payloadparsers/SubjectParser.java b/src/com/isode/stroke/parser/payloadparsers/SubjectParser.java
new file mode 100644
index 0000000..5aa69c5
--- /dev/null
+++ b/src/com/isode/stroke/parser/payloadparsers/SubjectParser.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010-2015, Isode Limited, London, England.
+ * All rights reserved.
+ */
+package com.isode.stroke.parser.payloadparsers;
+
+import com.isode.stroke.elements.Subject;
+import com.isode.stroke.parser.AttributeMap;
+import com.isode.stroke.parser.GenericPayloadParser;
+
+public class SubjectParser extends GenericPayloadParser<Subject> {
+
+
+ private int level_;
+ private String text_ = "";
+
+ public SubjectParser() {
+ super(new Subject());
+ }
+
+ public void handleStartElement(String element, String ns, AttributeMap attributes) {
+ ++level_;
+ }
+
+ public void handleEndElement(String element, String ns) {
+ --level_;
+ if (level_ == 0) {
+ getPayloadInternal().setText(text_);
+ }
+ }
+
+ public void handleCharacterData(String data) {
+ text_ += data;
+ }
+}