blob: 7b94b783af898799e38b239e45e01b75034cd3ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*
* Copyright (c) 2015, Isode Limited, London, England.
* All rights reserved.
*/
/*
* Copyright (c) 2011 Tobias Markmann
* Licensed under the BSD license.
* See http://www.opensource.org/licenses/bsd-license.php for more information.
*/
package com.isode.stroke.parser.payloadparsers;
import com.isode.stroke.elements.DeliveryReceipt;
import com.isode.stroke.parser.AttributeMap;
import com.isode.stroke.parser.GenericPayloadParser;
public class DeliveryReceiptParser extends GenericPayloadParser<DeliveryReceipt> {
private int level_;
public DeliveryReceiptParser() {
super(new DeliveryReceipt());
}
public void handleStartElement(String element, String ns, AttributeMap attributeMap) {
if (level_ == 0) {
if ("received".equals(element)) {
String id = attributeMap.getAttributeValue("id");
if (id != null) {
getPayloadInternal().setReceivedID(id);
}
}
}
++level_;
}
public void handleEndElement(String element, String ns) {
--level_;
}
public void handleCharacterData(String data) {
}
}
|