blob: d2c2a824ee187b9c9e07dac9bbfb2330f2039ba7 (
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) 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) {
}
}
|