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 | <?xml version = "1.0" encoding = "UTF-8"?> <alert xmlns = "urnasis:names:tc:emergency:cap:1.1"> <identifier>KAR0-0306112239-SW</identifier> <sender>KARO@CLETS.DOJ.CA.GOV</sender> <sent>2003-06-11T22:39:00-07:00</sent> <status>Actual</status> <msgType>Alert</msgType> <source>SW</source> <scope>ublic</scope> <info> <category>Rescue</category> <event>Child Abduction</event> <urgency>Immediate</urgency> <severity>Severe</severity> <certainty>Likely</certainty> <eventCode> <valueName>SAME</valueName> <value>CAE</value> </eventCode> <senderName>LOS ANGELES POLICE DEPT - LAPD</senderName> <headline>AMBER ALERT</headline> <description>DATE/TIME: 06/11/03, 1915 HRS. VICTIM(S): KHAYRI DOE JR. M/B BLK/BRO 3'0", 40 LBS. LIGHT COMPLEXION. DOB 06/24/01. WEARING RED SHORTS, WHITE T-SHIRT, W/BLUE COLLAR. LOCATION: 5721 DOE ST., LOS ANGELES, CA. SUSPECT(S): KHAYRI DOE SR. DOB 04/18/71 M/B, BLK HAIR, BRO EYE. VEHICLE: 81' BUICK 2-DR, BLUE (4XXX000).</description> <contact>DET. SMITH, 77TH DIV, LOS ANGELES POLICE DEPT-LAPD AT 213 485-2389</contact> <area> <areaDesc>Los Angeles County</areaDesc> <geocode> <valueName>SAME</valueName> <value>006037</value> </geocode> </area> </info> </alert> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Abdera abdera = new Abdera(); Factory factory = abdera.getFactory(); Alert alert = (Alert) factory.newElement(CAP_ALERT); alert.setIdentifier("ABC123DEF456"); alert.setSender("jasnell@example.org"); alert.setSent(new Date()); alert.setStatus(Alert.Status.Actual); //... Info info = alert.addInfo(); info.setCategories(Info.Category.Geo); info.setEvent("Something happened"); info.setUrgency(Info.Urgency.Past); info.setSeverity(Info.Severity.Extreme); //... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Abdera abdera = new Abdera(); Parser parser = abdera.getParser(); InputStream in = ... // get the input stream Document<Alert> doc = parser.parse(in); Alert alert = doc.getRoot(); System.out.println(alert.getIdentifier()); System.out.println(alert.getSender()); System.out.println(alert.getSent()); System.out.println(alert.getStatus()); //... for (Info info : alert.getInfo()) { System.out.println(info.getEvent()); //... } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |