blob: 5547a87cd5ab7c3cb93fd8398b30ce6be0c3cd72 (
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) 2014 Kevin Smith and Remko Tronçon
* All rights reserved.
*/
/*
* Copyright (c) 2014, Isode Limited, London, England.
* All rights reserved.
*/
package com.isode.stroke.parser.payloadparsers;
import com.isode.stroke.elements.MAMArchived;
import com.isode.stroke.jid.JID;
import com.isode.stroke.parser.AttributeMap;
import com.isode.stroke.parser.GenericPayloadParser;
public class MAMArchivedParser extends GenericPayloadParser<MAMArchived> {
public MAMArchivedParser() {
super(new MAMArchived());
}
public void handleStartElement(String element, String ns, AttributeMap attributes) {
if (level_ == 0) {
String attributeValue = attributes.getAttributeValue("by");
if (attributeValue != null) {
getPayloadInternal().setBy(JID.fromString(attributeValue));
}
attributeValue = attributes.getAttributeValue("id");
if (attributeValue != null) {
getPayloadInternal().setID(attributeValue);
}
}
++level_;
}
public void handleEndElement(String element, String ns) {
--level_;
}
public void handleCharacterData(String data) {
}
private int level_;
}
|