-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssetHandler.java
More file actions
92 lines (71 loc) · 2.52 KB
/
AssetHandler.java
File metadata and controls
92 lines (71 loc) · 2.52 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package com.brightkeep.dropionotes;
import java.util.ArrayList;
import java.util.List;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class AssetHandler extends DefaultHandler {
private String currentElementData;
private Asset asset;
List<Asset> assets = new ArrayList<Asset>();
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
currentElementData = "";
if (localName.equalsIgnoreCase("asset")) {
asset = new Asset();
}
}
public void characters(char[] ch, int start, int length)
throws SAXException {
currentElementData += new String(ch, start, length);
}
public void endElement(String uri, String localName, String qName)
throws SAXException {
if (localName.equalsIgnoreCase("asset")) {
assets.add(asset);
// add it to the list
// myEmpls.add(tempEmp);
} else if (localName.equalsIgnoreCase("name")) {
asset.name = currentElementData;
} else if (localName.equalsIgnoreCase("status")) {
asset.status =currentElementData;
} else if (localName.equalsIgnoreCase("title")) {
asset.title =currentElementData;
} else if (localName.equalsIgnoreCase("hidden_url")) {
asset.hidden_url =currentElementData;
} else if (localName.equalsIgnoreCase("created_at")) {
asset.created_at =currentElementData;
} else if (localName.equalsIgnoreCase("description")) {
asset.description =currentElementData;
} else if (localName.equalsIgnoreCase("contents")) {
asset.contents =currentElementData;
} else if (localName.equalsIgnoreCase("name")) {
asset.name =currentElementData;
} else if (localName.equalsIgnoreCase("url")) {
asset.url =currentElementData;
} else if (localName.equalsIgnoreCase("thumbnail")) {
asset.thumbnail =currentElementData;
} else if (localName.equalsIgnoreCase("width")) {
asset.width =currentElementData;
} else if (localName.equalsIgnoreCase("height")) {
asset.height =currentElementData;
} else if (localName.equalsIgnoreCase("duration")) {
asset.duration =currentElementData;
}
else if (localName.equalsIgnoreCase("type")) {
asset.type =currentElementData;
}
else if (localName.equalsIgnoreCase("filesize")) {
asset.filesize =currentElementData;
}
else if (localName.equalsIgnoreCase("converted")) {
asset.converted =currentElementData;
}
}
public Asset getAsset() {
return this.asset;
}
public List<Asset> getAssetList() {
return this.assets;
}
}