Giter Club home page Giter Club logo

cap-library's Introduction

Common Alerting Protocol Library Build Status

Copyright 2014 Google Inc.

http://github.com/google/cap-library/

===========

The CAP Library is a collection of code and tools to work with public alerting messages in the [Common Alerting Protocol] (http://en.wikipedia.org/wiki/Common_Alerting_Protocol) format.

Namely, a well-tested and easy-to-use Java library that supports

  • creation and parsing of feeds in the CAP format,
  • validating of feeds against common CAP profiles.

Moreover, it includes a simple [web application] (http://cap-validator.appspot.com/) to validate the correctness of CAP messages.

About

The CAP Library is designed to support CAP versions 1.0, 1.1, and 1.2. There are classes that can parse XML CAP messages as well as easily create new messages and write them to XML, JSON, (soon) ASN.1, and (soon) KML.

The main data structures are auto-generated from a Google protocol buffer implementation of the CAP spec in proto/cap.proto. Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data - think XML, but smaller, faster, and simpler.

The generated classes offer a clean API for creating and manipulating alert objects. The alert data structures are immutable; they provide only getters. New alerts are constructed via Builder classes. See javatests/com/google/publicalerts/cap/TestUtil.java, for an example.

javatests/com/google/publicalerts/cap/EndToEndTest.java provides a good overview of how to get started using the library.

To learn more about Google protocol buffers, see http://code.google.com/apis/protocolbuffers/ and http://code.google.com/apis/protocolbuffers/docs/reference/java-generated.html

Development

###Install ant You can download and install Apache Ant from http://ant.apache.org/.

###Run all tests

» APPENGINE_JAVA_SDK=/path/to/appengine-sdk ant test

###Compile the library into a jar

» cd java
» ant jar

###Compile and run the validator

» cd validator
» APPENGINE_JAVA_SDK=/path/to/appengine-sdk ant runserver

cap-library's People

Contributors

danielbrukhis avatar preethi-jayaram avatar shakusa avatar sschiavoni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cap-library's Issues

Check for weird formatting in <headline> and <description>

Original issue 34 created by [email protected] on 2012-10-03T17:58:23.000Z:

We want to check for formatting issues in text that will affect readability.

Examples include

  1. Text that's ALL CAPS
  2. <b>Text that includes html tags</b>
  3. Weird character combinations that are invalid, like '&&'

What is the expected output? What do you see instead?

Throw a warning near that line.

What version of the product are you using? On what operating system?

Please provide any additional information below.

Check that event code is valid, if event type is SAME

Original issue 33 created by [email protected] on 2012-10-03T06:58:02.000Z:

What steps will reproduce the problem?

  1. In the block below - the validator won't throw and error or warning if the <value> tag is not in the list of the <valueName> tag

<eventCode>
<valueName>SAME</valueName>
<value>WXR</value>
</eventCode>

What is the expected output? What do you see instead?
Throw a warning if <valueName>SAME</valueName>, but <value> isn't a SAME code

What version of the product are you using? On what operating system?

Please provide any additional information below.

Correctly alert character-escape issues

Original issue 47 created by [email protected] on 2013-12-11T21:09:36.000Z:

What steps will reproduce the problem?
0 See alert below, line 25 did not escape &

What is the expected output? What do you see instead?

  • There should be an error at line, saying "inproper escape of & character"
  • However, right now the error is only an unhelpful
    "1XML: <?xml version="1.0" encoding="UTF-8"?>
    Invalid XML: Error on line 1: Content is not allowed in prolog."

Example CAP:
<?xml version="1.0" encoding="UTF-8"?>
<alert xmlns="urn:oasis:names:tc:emergency:cap:1.2">
<identifier>CWB-EQ102152</identifier>
<sender>[email protected]</sender>
<sent>2013-11-16T03:45:35+08:00</sent>
<status>Actual</status>
<msgType>Alert</msgType>
<source>CWB</source>
<scope>Public</scope>
<info>
<language>zh-TW</language>
<category>Geo</category>
<event>地震</event>
<urgency>Past</urgency>
<severity>Minor</severity>
<certainty>Observed</certainty>
<eventCode>
<valueName>profile:CAP-TWP:Event:1.0</valueName>
<value>earthquake</value>
</eventCode>
<expires>2013-11-16T11:45:35+08:00</expires>
<senderName>**氣象局</senderName>
<headline>地震報告</headline>
<description>11/16-03:39臺灣東部海域發生規模5.2有感地震,最大震度花蓮縣花蓮市、宜蘭縣南澳、彰化縣彰化市、雲林縣斗六市、臺中市大肚2級。</description>
<web>http://scweb.cwb.gov.tw/GraphicContent.aspx?ItemId=49&amp;fileString=2013111603391752152&lt;/web>
<parameter>
<valueName>alert_title</valueName>
<value>地震報告</value>
</parameter>
<parameter>
<valueName>alert_color</valueName>
<value>綠色</value>
</parameter>
<parameter>
<valueName>EventID</valueName>
<value>102152</value>
</parameter>
<parameter>
<valueName>EventOriginTime</valueName>
<value>2013-11-16T03:39:17+08:00</value>
</parameter>
<parameter>
<valueName>EventLatLon</valueName>
<value>23.919,122.443 0.000</value>
</parameter>
<parameter>
<valueName>EventLocationName</valueName>
<value>臺灣東部海域</value>
</parameter>
<parameter>
<valueName>EventDepth</valueName>
<value>16.9公里</value>
</parameter>
<parameter>
<valueName>EventMagnitudeDescription</valueName>
<value>M5.2</value>
</parameter>
<parameter>
<valueName>EventPublisher</valueName>
<value>**氣象局</value>
</parameter>
<parameter>
<valueName>LocalMaxIntensity</valueName>
<value>2級;"花蓮縣";Taiwan_Geocode_100;10015;;;"CAP-EQ:1.0"</value>
</parameter>
<parameter>
<valueName>LocalMaxIntensity</valueName>
<value>2級;"宜蘭縣";Taiwan_Geocode_100;10002;;;"CAP-EQ:1.0"</value>
</parameter>
<parameter>
<valueName>LocalMaxIntensity</valueName>
<value>2級;"彰化縣";Taiwan_Geocode_100;10007;;;"CAP-EQ:1.0"</value>
</parameter>
<parameter>
<valueName>LocalMaxIntensity</valueName>
<value>2級;"雲林縣";Taiwan_Geocode_100;10009;;;"CAP-EQ:1.0"</value>
</parameter>
<parameter>
<valueName>LocalMaxIntensity</valueName>
<value>2級;"臺中市";Taiwan_Geocode_100;66;;;"CAP-EQ:1.0"</value>
</parameter>
<parameter>
<valueName>LocalMaxIntensity</valueName>
<value>1級;"南投縣";Taiwan_Geocode_100;10008;;;"CAP-EQ:1.0"</value>
</parameter>
<parameter>
<valueName>LocalMaxIntensity</valueName>
<value>1級;"臺東縣";Taiwan_Geocode_100;10014;;;"CAP-EQ:1.0"</value>
</parameter>
<parameter>
<valueName>LocalMaxIntensity</valueName>
<value>1級;"新北市";Taiwan_Geocode_100;65;;;"CAP-EQ:1.0"</value>
</parameter>
<parameter>
<valueName>LocalMaxIntensity</valueName>
<value>1級;"苗栗縣";Taiwan_Geocode_100;10005;;;"CAP-EQ:1.0"</value>
</parameter>
<parameter>
<valueName>LocalMaxIntensity</valueName>
<value>1級;"嘉義市";Taiwan_Geocode_100;10020;;;"CAP-EQ:1.0"</value>
</parameter>
<parameter>
<valueName>LocalMaxIntensity</valueName>
<value>1級;"臺北市";Taiwan_Geocode_100;63;;;"CAP-EQ:1.0"</value>
</parameter>
<parameter>
<valueName>LocalMaxIntensity</valueName>
<value>1級;"嘉義縣";Taiwan_Geocode_100;10010;;;"CAP-EQ:1.0"</value>
</parameter>
<parameter>
<valueName>LocalMaxIntensity</valueName>
<value>1級;"新竹縣";Taiwan_Geocode_100;10004;;;"CAP-EQ:1.0"</value>
</parameter>
<parameter>
<valueName>LocalMaxIntensity</valueName>
<value>1級;"臺南市";Taiwan_Geocode_100;67;;;"CAP-EQ:1.0"</value>
</parameter>
<resource>
<resourceDesc>等震度圖</resourceDesc>
<mimeType>image/gif</mimeType>
<uri>http://scweb.cwb.gov.tw/webdata/drawTrace/plotContour/2013/2013152.gif&lt;/uri>
</resource>
<resource>
<resourceDesc>地震報告圖</resourceDesc>
<mimeType>image/gif</mimeType>
<uri>http://scweb.cwb.gov.tw/webdata/OLDEQ/201311/2013111603391752152.gif&lt;/uri>
</resource>
<area>
<areaDesc>花蓮縣政府東方 84.1 公里 (位於臺灣東部海域)</areaDesc>
<circle>23.919,122.443 0.000</circle>
</area>
<area>
<areaDesc>最大震度2級地區</areaDesc>
<geocode>
<valueName>Taiwan_Geocode_100</valueName>
<value>10015</value>
</geocode>
<geocode>
<valueName>Taiwan_Geocode_100</valueName>
<value>10002</value>
</geocode>
<geocode>
<valueName>Taiwan_Geocode_100</valueName>
<value>10007</value>
</geocode>
<geocode>
<valueName>Taiwan_Geocode_100</valueName>
<value>10009</value>
</geocode>
<geocode>
<valueName>Taiwan_Geocode_100</valueName>
<value>66</value>
</geocode>
</area>
<area>
<areaDesc>最大震度1級地區</areaDesc>
<geocode>
<valueName>Taiwan_Geocode_100</valueName>
<value>10008</value>
</geocode>
<geocode>
<valueName>Taiwan_Geocode_100</valueName>
<value>10014</value>
</geocode>
<geocode>
<valueName>Taiwan_Geocode_100</valueName>
<value>65</value>
</geocode>
<geocode>
<valueName>Taiwan_Geocode_100</valueName>
<value>10005</value>
</geocode>
<geocode>
<valueName>Taiwan_Geocode_100</valueName>
<value>10020</value>
</geocode>
<geocode>
<valueName>Taiwan_Geocode_100</valueName>
<value>63</value>
</geocode>
<geocode>
<valueName>Taiwan_Geocode_100</valueName>
<value>10010</value>
</geocode>
<geocode>
<valueName>Taiwan_Geocode_100</valueName>
<value>10004</value>
</geocode>
<geocode>
<valueName>Taiwan_Geocode_100</valueName>
<value>67</value>
</geocode>
</area>
</info>
</alert>

Correctly place polygon errors next to the error line

Original issue 43 created by [email protected] on 2013-10-22T04:39:02.000Z:

What steps will reproduce the problem?

  1. Copy and paste the full feed below into the validator.

What is the expected output? What do you see instead?
The error should be next to line 213 instead of 93.

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="../lib/RFS_EDXL_simple.xsl" type="text/xsl"?>
<edxlde:EDXLDistribution xmlns:edxlde="urn:oasis:names:tc:emergency:EDXL:DE:1.0">
<edxlde:distributionID>RFSUniqueID:2013-10-22T04:11:15-00:00</edxlde:distributionID>
<edxlde:senderID>[email protected]</edxlde:senderID>
<edxlde:dateTimeSent>2013-10-22T04:11:15-00:00</edxlde:dateTimeSent>
<edxlde:distributionStatus>Actual</edxlde:distributionStatus>
<edxlde:distributionType>Report</edxlde:distributionType>
<edxlde:combinedConfidentiality>UNCLASSIFIED AND NOT SENSITIVE</edxlde:combinedConfidentiality>
<edxlde:language>en-AU</edxlde:language>
<edxlde:targetArea>
<edxlde:subdivision>AU-NSW</edxlde:subdivision>
</edxlde:targetArea>
<edxlde:contentObject>
<edxlde:contentDescription>Information on Vine St Schofields</edxlde:contentDescription>
<edxlde:xmlContent>
<edxlde:embeddedXMLContent>
<cap:alert xmlns:cap="urn:oasis:names:tc:emergency:cap:1.2">
<cap:identifier>2013-10-22T03:31:00-00:00:81152</cap:identifier>
<cap:sender>[email protected]</cap:sender>
<cap:sent>2013-10-22T03:31:00-00:00</cap:sent>
<cap:status>Actual</cap:status>
<cap:msgType>Alert</cap:msgType>
<cap:scope>Public</cap:scope>
<cap:code>urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0</cap:code>
<cap:incidents>81152</cap:incidents>
<cap:info>
<cap:language>en-AU</cap:language>
<cap:category>Fire</cap:category>
<cap:event>Fire</cap:event>
<cap:responseType>Monitor</cap:responseType>
<cap:urgency>Expected</cap:urgency>
<cap:severity>Moderate</cap:severity>
<cap:certainty>Observed</cap:certainty>
<cap:eventCode>
<cap:valueName>urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0:AUeventLIST:1.0</cap:valueName>
<cap:value>fire</cap:value>
</cap:eventCode>
<cap:effective>2013-10-22T03:31:00-00:00</cap:effective>
<cap:expires>2013-10-23T03:31:00-00:00</cap:expires>
<cap:senderName>NSW Rural Fire Service</cap:senderName>
<cap:headline>Vine St Schofields</cap:headline>
<cap:description>ALERT LEVEL: Advice
LOCATION: 78-80 Vine St Schofields
COUNCIL AREA: Blacktown
STATUS: Out of Control
TYPE: Scrub fire
SIZE: 0
RESPONSIBLE AGENCY: Rural Fire Service
UPDATED: 22 Oct 2013 14:31
</cap:description>
<cap:instruction>A fire has started. There is no immediate danger. Stay up to date in case the situation changes.</cap:instruction>
<cap:web>http://www.rfs.nsw.gov.au/dsp_content.cfm?cat_id=683&lt;/cap:web>
<cap:contact>[email protected]</cap:contact>
<cap:parameter>
<cap:valueName>FuelType</cap:valueName>
<cap:value>Forest</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>Location</cap:valueName>
<cap:value>78-80 Vine St Schofields</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>FireDangerClass</cap:valueName>
<cap:value>1</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>Status</cap:valueName>
<cap:value>Out of Control</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>Fireground</cap:valueName>
<cap:value>0 ha</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>AllocatedResources</cap:valueName>
<cap:value />
</cap:parameter>
<cap:parameter>
<cap:valueName>ControlAuthority</cap:valueName>
<cap:value>Rural Fire Service</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>AlertLevel</cap:valueName>
<cap:value>Advice</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>CouncilArea</cap:valueName>
<cap:value>Blacktown</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>IncidentName</cap:valueName>
<cap:value>Vine St Schofields</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>Evacuation</cap:valueName>
<cap:value />
</cap:parameter>
<cap:resource>
<cap:resourceDesc>map</cap:resourceDesc>
<cap:mimeType>text/html</cap:mimeType>
<cap:uri>http://www.rfs.nsw.gov.au/dsp_content.cfm?CAT_ID=683&lt;/cap:uri>
</cap:resource>
<cap:area>
<cap:areaDesc>78-80 Vine St Schofields, Blacktown</cap:areaDesc>
<cap:circle>-33.6998,150.8482 0.0</cap:circle>
<cap:geocode>
<cap:valueName>urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0:ISO3166-2</cap:valueName>
<cap:value>AU-NSW</cap:value>
</cap:geocode>
</cap:area>
</cap:info>
</cap:alert>
</edxlde:embeddedXMLContent>
</edxlde:xmlContent>
</edxlde:contentObject>
<edxlde:contentObject>
<edxlde:contentDescription>Information on Webbs Creek</edxlde:contentDescription>
<edxlde:xmlContent>
<edxlde:embeddedXMLContent>
<cap:alert xmlns:cap="urn:oasis:names:tc:emergency:cap:1.2">
<cap:identifier>2013-10-22T03:30:00-00:00:80315</cap:identifier>
<cap:sender>[email protected]</cap:sender>
<cap:sent>2013-10-22T03:30:00-00:00</cap:sent>
<cap:status>Actual</cap:status>
<cap:msgType>Alert</cap:msgType>
<cap:scope>Public</cap:scope>
<cap:code>urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0</cap:code>
<cap:incidents>80315</cap:incidents>
<cap:info>
<cap:language>en-AU</cap:language>
<cap:category>Fire</cap:category>
<cap:event>Bushfire</cap:event>
<cap:responseType>Monitor</cap:responseType>
<cap:urgency>Expected</cap:urgency>
<cap:severity>Moderate</cap:severity>
<cap:certainty>Observed</cap:certainty>
<cap:eventCode>
<cap:valueName>urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0:AUeventLIST:1.0</cap:valueName>
<cap:value>bushFire</cap:value>
</cap:eventCode>
<cap:effective>2013-10-22T03:30:00-00:00</cap:effective>
<cap:expires>2013-10-23T03:30:00-00:00</cap:expires>
<cap:senderName>NSW Rural Fire Service</cap:senderName>
<cap:headline>Webbs Creek</cap:headline>
<cap:description>ALERT LEVEL: Advice
LOCATION: 192 webbs creek road
COUNCIL AREA: Hawkesbury
STATUS: Under Control
TYPE: Bush fire
SIZE: 315
RESPONSIBLE AGENCY: Rural Fire Service
UPDATED: 22 Oct 2013 14:30
</cap:description>
<cap:instruction>A fire has started. There is no immediate danger. Stay up to date in case the situation changes.</cap:instruction>
<cap:web>http://www.rfs.nsw.gov.au/dsp_content.cfm?cat_id=683&lt;/cap:web>
<cap:contact>[email protected]</cap:contact>
<cap:parameter>
<cap:valueName>FuelType</cap:valueName>
<cap:value>Forest</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>Location</cap:valueName>
<cap:value>192 webbs creek road</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>FireDangerClass</cap:valueName>
<cap:value>1</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>Status</cap:valueName>
<cap:value>Under Control</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>Fireground</cap:valueName>
<cap:value>315 ha</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>AllocatedResources</cap:valueName>
<cap:value />
</cap:parameter>
<cap:parameter>
<cap:valueName>ControlAuthority</cap:valueName>
<cap:value>Rural Fire Service</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>AlertLevel</cap:valueName>
<cap:value>Advice</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>CouncilArea</cap:valueName>
<cap:value>Hawkesbury</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>IncidentName</cap:valueName>
<cap:value>Webbs Creek</cap:value>
</cap:parameter>
<cap:parameter>
<cap:valueName>Evacuation</cap:valueName>
<cap:value />
</cap:parameter>
<cap:resource>
<cap:resourceDesc>map</cap:resourceDesc>
<cap:mimeType>text/html</cap:mimeType>
<cap:uri>http://www.rfs.nsw.gov.au/dsp_content.cfm?CAT_ID=683&lt;/cap:uri>
</cap:resource>
<cap:area>
<cap:areaDesc>192 webbs creek road, Hawkesbury</cap:areaDesc>
<cap:polygon xmlns:georss="http://www.georss.org/georss&quot;&gt;-33.3986,150.9842 -33.3982,150.9842 -33.3976,150.9847 -33.3975,150.9854 -33.3978,150.9852 -33.3985,150.9844 -33.3986,150.9842</cap:polygon>
<cap:polygon xmlns:georss="http://www.georss.org/georss&quot;&gt;-33.3947,150.9598 -33.3949,150.9604 -33.3953,150.9619 -33.3947,150.9631 -33.3923,150.9649 -33.3936,150.9662 -33.394,150.9672 -33.3919,150.9687 -33.391,150.9676 -33.3901,150.969 -33.3896,150.9692 -33.3893,150.9693 -33.3892,150.9694 -33.389,150.9695 -33.3882,150.9689 -33.3885,150.9703 -33.3886,150.9705 -33.3884,150.9705 -33.3884,150.9713 -33.3887,150.9716 -33.3888,150.9722 -33.389,150.9725 -33.3891,150.973 -33.3893,150.9731 -33.3895,150.9732 -33.3902,150.9735 -33.3916,150.9739 -33.3917,150.9739 -33.3926,150.9748 -33.393,150.9757 -33.3939,150.9765 -33.395,150.9767 -33.396,150.9769 -33.3963,150.9767 -33.3965,150.9768 -33.3973,150.9759 -33.3982,150.975 -33.3989,150.9737 -33.3991,150.9735 -33.3991,150.9734 -33.3998,150.972 -33.4001,150.9711 -33.4008,150.9701 -33.4021,150.9674 -33.4029,150.9659 -33.4029,150.9658 -33.4041,150.9652 -33.404,150.9648 -33.4042,150.9647 -33.4041,150.9637 -33.4045,150.9629 -33.4053,150.9637 -33.4063,150.9632 -33.407,150.9623 -33.4074,150.9614 -33.4076,150.9589 -33.4082,150.9594 -33.4092,150.9603 -33.4099,150.9606 -33.4095,150.9596 -33.4094,150.9591 -33.4089,150.9578 -33.4089,150.9573 -33.4088,150.9572 -33.4088,150.957 -33.408,150.9555 -33.408,150.955 -33.408,150.9549 -33.4091,150.9535 -33.4098,150.9528 -33.4099,150.9526 -33.4099,150.9525 -33.4099,150.9524 -33.4088,150.9524 -33.4083,150.9525 -33.4082,150.9525 -33.4065,150.9529 -33.4059,150.9527 -33.4048,150.9519 -33.4047,150.9519 -33.4042,150.9519 -33.4031,150.9518 -33.403,150.952 -33.4028,150.952 -33.4026,150.9526 -33.4025,150.9528 -33.4031,150.9534 -33.403,150.9541 -33.403,150.9537 -33.4028,150.9531 -33.4024,150.9529 -33.4018,150.9559 -33.4015,150.9568 -33.4007,150.9569 -33.4002,150.9574 -33.4002,150.9575 -33.3996,150.9582 -33.3989,150.959 -33.3986,150.9592 -33.3981,150.9588 -33.3973,150.9589 -33.3961,150.9594 -33.3959,150.9595 -33.3952,150.9604 -33.3952,150.9603 -33.3947,150.9597 -33.3948,150.9599 -33.3947,150.9598</cap:polygon>
<cap:polygon xmlns:georss="http://www.georss.org/georss&quot;&gt;-33.4031,150.9548 -33.4034,150.9551 -33.4042,150.9552 -33.4044,150.9551 -33.4045,150.9553 -33.4036,150.9555 -33.4032,150.9551 -33.4031,150.9548</cap:polygon>
<cap:polygon xmlns:georss="http://www.georss.org/georss&quot;&gt;-33.3843,150.9615 -33.3835,150.9628 -33.3838,150.9633 -33.3848,150.9629 -33.3842,150.9619 -33.3843,150.9615 -33.3843,150.9619 -33.3845,150.9623 -33.3852,150.9633 -33.3862,150.9647 -33.387,150.9661 -33.3879,150.9669 -33.3885,150.9683 -33.3889,150.9688 -33.3897,150.9684 -33.3905,150.9674 -33.3912,150.9659 -33.3923,150.9643 -33.3933,150.9633 -33.3947,150.9625 -33.3949,150.962 -33.3946,150.9606 -33.3938,150.959 -33.3934,150.9575 -33.3929,150.9565 -33.3919,150.956 -33.3905,150.9571 -33.3896,150.9579 -33.3892,150.9587 -33.388,150.9585 -33.387,150.9588 -33.3862,150.9594 -33.3851,150.9599 -33.3849,150.9602 -33.3846,150.9608 -33.3843,150.9614 -33.3843,150.9615</cap:polygon>
<cap:polygon xmlns:georss="http://www.georss.org/georss&quot;&gt;-33.394,150.9584 -33.3942,150.9589 -33.3948,150.9571</cap:polygon>
<cap:circle>-33.3864,150.9434 0.0</cap:circle>
<cap:geocode>
<cap:valueName>urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0:ISO3166-2</cap:valueName>
<cap:value>AU-NSW</cap:value>
</cap:geocode>
</cap:area>
</cap:info>
</cap:alert>
</edxlde:embeddedXMLContent>
</edxlde:xmlContent>
</edxlde:contentObject>
</edxlde:EDXLDistribution>

Place warning message in correct place

Original issue 31 created by [email protected] on 2012-10-01T20:16:09.000Z:

What steps will reproduce the problem?

  1. empty <instruction>
  2. empty <contact>
    3.

What is the expected output? What do you see instead?

Warning should be placed next to the line we’re expecting the <instruction> tag, not under the parent <info> tag

Validation error on recommended RSS author tag

Original issue 48 created by [email protected] on 2014-01-13T14:50:29.000Z:

From Eliot Christian:

I've noticed that the CAP validator throws an error on the e-mail
format that is recommended in RSS feeds: address (name)
http://cyber.law.harvard.edu/rss/rss.html#ltauthorgtSubelementOfLtitemgt

The attached is an example RSS feed, and you will see I get errors on every
"author" element.

I used to use just the e-mail address without a name, but I have
encountered many cases wherein lots of people use the same,
organizational e-mail address. Only the name part distinguishes to
whom a particular e-mail message is actually directed.

Validator: Support input from file

Original issue 13 created by [email protected] on 2011-03-31T16:40:17.000Z:

From Simon:

Would there be any possibility of you adding a file browse dialog in the future so that we could just select a file containing a CAP message instead of have to copy and paste the contents? Its not a big problem, but would aid usability.

Throw warning if areas are complex

Original issue 45 created by [email protected] on 2013-10-23T22:41:14.000Z:

What steps will reproduce the problem?

  1. having multiple shapes in an <area> - throw a warning
  2. having multiple geocode names (not just geocodes - throw a warning

What is the expected output? What do you see instead?

  • Throw warning for the above cases.

Please use labels and text to provide additional information.

Better validation for <resource> media

Original issue 32 created by [email protected] on 2012-10-03T06:53:06.000Z:

What steps will reproduce the problem?

  • The validator doesn't validate that the audio/jpg files linked in the <uri> or < derefUri> tags actually exist.

What is the expected output? What do you see instead?

  • The validator should display a warning

What version of the product are you using? On what operating system?

Please provide any additional information below.

Atom feed creator

Original issue 3 created by [email protected] on 2011-02-26T19:49:03.000Z:

Make it easy to build a valid Atom feed of CAP messages using best practices. Should support both "fat" feeds (whose <content> elements contain the full CAP message) and "thin" feeds which link to external CAP messages.

German characters mangled by CAP Validator

Original issue 19 created by [email protected] on 2011-04-26T13:46:39.000Z:

We checked your validator and found a small problem:
The CAP text is ok, if we insert a CAP document (UTF-8 or ISO 8859-1) into the validator (see _before.png). After pressing the "Valide"-button, German characters are incorrect (see _after.png).

If you have some ideas to solve this problem (e.g. upload the correct CAP document as file?), please inform us.

<references> must happen before <info>?

We got "automated error message from Google" which indicated <references> returned by our cap service has invalid content.

Error details: cvc-complex-type.2.4.a: Invalid content was found starting with element 'references'. One of '{"urn:oasis:names:tc:emergency:cap:1.2":info, WC["http://www.w3.org/2000/09/xmldsig#"]}' is expected.

After some random copy-pastes I found that <references> must happen before <info> otherwise the validator will not happy. Is this in CAP spec or it's just a bug?

Thanks.

Patch for /java/src/com/google/publicalerts/cap/profile/ca/CanadianProfile.java

Original issue 28 created by josiahpeters on 2012-05-02T16:56:56.000Z:

I noticed that the validator wasn't validating a message that I considered to be valid.

My message had a geocode value of:
<geocode>
<valueName>profile:CAP-CP:Location:0.4</valueName>
<value>2435027</value>
</geocode>

Which according to the spec should be valid? Looking at the validator code I'm suspecting that my change might solve that, however I did not check out the entire repo to build and run the test cases. Hopefully this helps.

Joey Peters
[email protected]

Support UTF8 strings as input

Original issue 18 created by [email protected] on 2011-04-25T20:54:44.000Z:

What steps will reproduce the problem?

  1. Take an example of a valid CAP
  2. Replace event with "東北地方太平洋沖地震"
  3. Click on validate

What is the expected output? What do you see instead?
We expect to see the same string. Instead the characters are replaced by ??

What version of the product are you using? On what operating system?
Ubuntu:Chrome and Firefox
MaxOs: Chrome

Please provide any additional information below.

Add more examples to the front page

Original issue 42 created by [email protected] on 2013-08-02T23:36:44.000Z:

It'd be nice to add more examples to the front page.

  1. Update alert
  2. Cancel alert
  3. Tsunami alert

What is the expected output? What do you see instead?

Please use labels and text to provide additional information.

addresses tag should be optional

Original issue 9 created by [email protected] on 2011-03-28T14:17:12.000Z:

As reported by Gary Ham:

I did find an issue, however. Starting with CAP 1.2, <addresses> is allowed as an optional tag in a Public CAP message. IPAWS-OPEN uses <addresses> for CAP 1.1 messages as well. Since the schema does not enforce the non-use of addresses, we did not try to get the Standards body to change 1.1. But the change was put into 1.2.
So, please change your validation to allow <addresses> of <scope> = “Public” for CAP 1.2. (If you would relax it for CAP 1.1 as well, we would appreciate that as well. J)

Confirmed for 1.2 (http://docs.oasis-open.org/emergency/cap/v1.2/CAP-v1.2-os.html)
addresses is
(1) Required when <scope> is “Private”, optional when <scope> is “Public” or “Restricted”.

For 1.1 (http://www.oasis-open.org/committees/download.php/14759/emergency-CAPv1.1.pdf)
addresses is
Used when <scope> value is "Private"

However, the schema does not enforce this, so it seems reasonable to relax the constraint.

This is a simple change here:
http://code.google.com/p/cap-library/source/browse/java/src/com/google/publicalerts/cap/CapValidator.java#&nbsp;111

Improve validation & warnings

Original issue 40 created by [email protected] on 2013-08-02T23:31:50.000Z:

What steps will reproduce the problem?

: Currently CAP Validator's Googley profile does not throw warnings for the following things (but should)

  1. If the geocode name or value are empty. For example
    <geocode>
    <valueName></valueName>
    <value></value>
    </geocode>
  2. When it's a test alert. It's valid and fine but sometimes partners send us test alerts that are invalid because they think it's OK
    <status>Test</status>

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Off-by-one tag in error message

Original issue 46 created by [email protected] on 2013-11-23T14:59:24.000Z:

When I try to publish this:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href='https://alerts.weather.gov/cap/capatomproduct.xsl' type='text/xsl'?>
<!--
This atom/xml feed is an index to active advisories, watches and warnings
issued by the National Weather Service. This index file is not the complete
Common Alerting Protocol (CAP) alert message. To obtain the complete CAP
alert, please follow the links for each entry in this index. Also note the
CAP message uses a style sheet to convey the information in a human readable
format. Please view the source of the CAP message to see the complete data
set. Not all information in the CAP message is contained in this index of
active alerts.
-->
<alert xmlns="urn:oasis:names:tc:emergency:cap:1.1">
<!-- http-date = Sat, 11 May 2013 05:53:00 GMT -->
<identifier>NOAA-NWS-ALERTS-TX124EFFF5E9C4.TornadoWarning.124EFFF607D8TX.BROTORBRO.fca75c3d7c443bae5eba79924b439163TEST2</identifier>
<sender>[email protected]</sender>
<sent>2013-05-19T18:53:00-05:00</sent>
<status>Actual</status>
<msgType>Alert</msgType>
<scope>Public</scope>
<note>Alert for Zapata (Texas) Issued by the National Weather Service</note>
<info>
<category>Met</category>
<event>Tornado Warning</event>
<urgency>Immediate</urgency>
<severity>Extreme</severity>
<certainty/>
<eventCode>
<valueName>SAME</valueName>
<value>TOR</value>
</eventCode>
<effective>2013-05-19T18:53:00-05:00</effective>
<expires>2013-05-19T18:30:00-05:00</expires>
<senderName>NWS Brownsville (Southern Texas)</senderName>
<headline>Tornado Warning issued May 11 at 12:53AM CDT until May 11 at 1:30AM CDT by NWS Brownsville</headline>
<description>THE NATIONAL WEATHER SERVICE IN BROWNSVILLE HAS ISSUED A

  • TORNADO WARNING FOR...
    CENTRAL ZAPATA COUNTY IN DEEP SOUTH TEXAS.
  • UNTIL 130 AM CDT
  • AT 1253 AM CDT...NATIONAL WEATHER SERVICE METEOROLOGISTS WERE
    TRACKING A TORNADO ON RADAR OVER BUSTAMANTE...MOVING EAST AT 15
    MPH.
  • LOCATIONS IN THE WARNING INCLUDE...
    BUSTAMANTE.
    ESCOBA.</description>
    <instruction>TAKE COVER NOW ON THE LOWEST FLOOR OF YOUR HOME OR BUSINESS IN AN
    INTERIOR ROOM OR CLOSET. DO NOT WAIT UNTIL YOU CAN SEE OR HEAR THE
    TORNADO. PUT AS MANY WALLS BETWEEN YOURSELF AND THIS STORM AS
    POSSIBLE. TRAILER HOMES ARE EASILY DESTROYED BY TORNADOES AND SHOULD
    BE ABANDONED IMMEDIATELY FOR STRONGER SHELTER.
    IF TRAVELING...FIND STURDY SHELTER IMMEDIATELY OR PULL OVER AND GET
    BELOW THE DASHBOARD IF DEBRIS IS SIGHTED.
    PLEASE REPORT TORNADOES OR FUNNEL CLOUDS...WINDS OF 58 MPH OR
    HIGHER...HAIL THE SIZE OF PENNIES OR LARGER...AND ANY WIND DAMAGE TO
    YOUR NATIONAL WEATHER SERVICE IN BROWNSVILLE BY CALLING 956-504-1432.</instruction>
    <parameter>
    <valueName>WMOHEADER</valueName>
    <value />
    </parameter>
    <parameter>
    <valueName>UGC</valueName>
    <value>TXC505</value>
    </parameter>
    <parameter>
    <valueName>TIME...MOT...LOC</valueName>
    <value>0553Z 273DEG 14KT 2703 9915</value>
    </parameter>
    <area>
    <areaDesc>Zapata</areaDesc>
    <polygon>27.08,-99.00 26.96,-99.04 26.98,-99.22 27.09,-99.22 27.08,-99.00</polygon>
    <geocode>
    <valueName>FIPS6</valueName>
    <value>048505</value>
    </geocode>
    <geocode>
    <valueName>UGC</valueName>
    <value>TXC505</value>
    </geocode>
    </area>
    </info>
    </alert>

the error says:
Publisher ID:Publish[com.google.publicalerts.ingest.server.publish.AlertParseException: [noaa]com.google.publicalerts.cap.CapException: CapExceptionreasons=[Invalid enum value <severity> = "". Must be one of [Observed, Likely, Possible, Unlikely, Unknown]]]

but the error is with the certainty field, not severity.

Validate multiple CAP events at once

Original issue 30 created by [email protected] on 2012-05-08T21:31:28.000Z:

I think the CAP schema only allows for one <event> tag right now. So there's no way in our validator to validate a series of <event>s. I'll have to copy and paste each event one by one.

Would be great if we can validate multiple events at once. There could be a few ways to do this

  1. tokenize the <event>s and validate one by one in code
  2. modify the schema to allow multiple occurrences of <event>
  3. allow uploading of multiple files

I'm not really wed to any of these suggestions, and am open to others as well. Maybe 3's the best way here since it doesn't modify the schema and hopefully is less work than 1.

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Throw warnings/recommendations for test data

Original issue 29 created by [email protected] on 2012-05-08T20:53:15.000Z:

Right now the validator doesn't check for test content in any values. (it checks for "unknown")

Ideally - I'd like to see a warning in the "recommendation" section if we see any of the words test/practice/demo/default in any of the tags <event>/<headline>/<description>/<instruction>

Maybe we don't have to check for "practice".

Here's one example set of tags we got from a cap event:

<event>Practice Demo</event>
<headline>Practice Demo</headline>
<description>This is Pierce County Emergency Management conducting a test of the Emergency Alert System. In the event of an emergency, this system would bring you important information. The following tones will conclude this test.�</description>
<instruction>This is Pierce County Emergency Management conducting a test of the Emergency Alert System. In the event of an emergency, this system would bring you important information. The following tones will conclude this test.�</instruction>

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Improve readability of output by adding newlines between each tag

Original issue 35 created by [email protected] on 2012-10-03T18:06:16.000Z:

What steps will reproduce the problem?

If you enter a CAP <alert> without any new lines, the output also wouldn't have any newlines. So for example, sometimes a CAP message is 1 long line. As a result, any errors and warnings will be difficult to identify in that jumble, because they're line-based.

What is the expected output? What do you see instead?

Add new lines in between <tags> for the output.

What version of the product are you using? On what operating system?

Please provide any additional information below.

Check for common mistake in <references>

Original issue 39 created by [email protected] on 2013-03-26T03:15:38.000Z:

What steps will reproduce the problem?

  1. fill in <references> to use the current alert's <identifier> and <sent>
    2.
    3.

What is the expected output? What do you see instead?
This should throw a warning and not validate

What version of the product are you using? On what operating system?

Please provide any additional information below.

CapXmlBuilder should not treat xmlns as an ordinary attribute

Original issue 38 created by ceharris414 on 2013-02-25T12:12:44.000Z:

The org.w3c.dom.Docment does not properly set the namespace URI on document elements when "xmlns" is treated as an ordinary attribute. Consequently, the Document returned by CapXmlBuilder.toXmlDocument(AlertOrBuilder) cannot be validated against its schema definition (using, for example, javax.xml.validation.Validator). The Document.createElementNS(String, String) method must be used to create elements in a particular namespace.

What steps will reproduce the problem?

  1. Construct an Alert or Alert.Builder, using Alert.Builder.setXmlns(String) to set the namespace; e.g. to the value "urn:oasis:names:tc:emergency:cap:1.2"
  2. Build a Document using CapXmlBuilder.toXmlDocument(AlertOrBuilder).
  3. Examine the namespace URI of any element in the Document; e.g. document.getDocumentElement().getNamespaceURI()

What is the expected output? What do you see instead?

The namespaceURI should be the value set by Alert.Builder.setXmlns; e.g. "urn:oasis:names:tc:emergency:cap:1.2"

Instead, the returned namespaceURI is null.

What version of the product are you using? On what operating system?

r3 on linux

Please provide any additional information below.

The CapXmlBuilder should use Document.createElementNS(String, String) instead of Document.createElement(String) when creating each element of the document. The first argument to createElementNS should be the namespace returned by AlertOrBuilder.getXmlns().

See the attached patch for an approach to solving this issue.

Invalid UTF-8 byte sequence in earthquake.cap

Original issue 25 created by farrel.lifson on 2011-07-25T20:27:52.000Z:

What steps will reproduce the problem?

  1. In a shell: iconv -f UTF-8 earthquake.cap -o /dev/null

What is the expected output? What do you see instead?

Expected: No output
Actual: 'iconv: illegal input sequence at position 3027'

What version of the product are you using? On what operating system?

iconv 2.13 on Archlinux

Please provide any additional information below.

There seems to be a U+0097 character here '(Este caso ha sido revisado por un sism�logo.)'

Validation does not enforce cases where "addresses" and "restriction" are required

Original issue 37 created by [email protected] on 2012-12-20T14:54:51.000Z:

From Eliot Christian:

The CAP standard data dictionary states that the "addresses" element
and the "restriction" element are each conditional. The "addresses"
element is required if the "scope" element contains "Private". The
"restriction" element is required if "scope" element is "Restricted".

The Google CAP validator does not enforce these validation rules as
I had expected. A result of "Valid" is returned when the "scope" is
"Public" or "Restricted" or "Private", even when there is not an
"addresses" element or there is not a "restriction" element. Yet,
if "scope" is "Public" or "Private" and the "restriction" element
is present, the validator reports "<restriction> should be used
only when <scope> is Restricted". Oddly, there is no corresponding
flagging on the "addresses" element only when scope is "Private".

My own impression is that the rules require that the "restriction"
element is present when the "scope" is "Restricted", and that the
"addresses" element is present when the "scope" is "Private". It
seems to me the data dictionary is silent regarding the validity
of a "restriction" element when the scope is not "Restricted",
and it is silent regarding the validity of having an "addresses"
element when the "scope" is not "Private".

Test failures likely due to xerces version differences

Original issue 17 created by [email protected] on 2011-04-15T02:48:18.000Z:

java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Server VM (build 19.1-b02, mixed mode)

It is probably my version of xerces - the only thing I could see right off was in my CLASSPATH
:/usr/share/tomcat6/webapps/axis2/WEB-INF/lib/xercesImpl-2.6.2.jar:

[junit] Tests run: 89, Failures: 9, Errors: 10, Time elapsed: 2.433 sec
[junit] Testcase: testAlert took 0.063 sec
[junit] FAILED
[junit] null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="urn...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="urn...>
[junit] junit.framework.ComparisonFailure: null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="urn...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="urn...>
[junit] at com.google.publicalerts.cap.CapXmlBuilderTest.testAlert(CapXmlBuilderTest.java:74)
[junit]
[junit] Testcase: testInfo took 0.005 sec
[junit] FAILED
[junit] null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="urn...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="urn...>
[junit] junit.framework.ComparisonFailure: null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="urn...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="urn...>
[junit] at com.google.publicalerts.cap.CapXmlBuilderTest.testInfo(CapXmlBuilderTest.java:153)
[junit]
[junit] Testcase: testArea took 0.004 sec
[junit] FAILED
[junit] null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="urn...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="urn...>
[junit] junit.framework.ComparisonFailure: null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="urn...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="urn...>
[junit] at com.google.publicalerts.cap.CapXmlBuilderTest.testArea(CapXmlBuilderTest.java:220)
[junit]
[junit] Testcase: testResource took 0.006 sec
[junit] FAILED
[junit] null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="urn...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="urn...>
[junit] junit.framework.ComparisonFailure: null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="urn...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="urn...>
[junit] at com.google.publicalerts.cap.CapXmlBuilderTest.testResource(CapXmlBuilderTest.java:260)
[junit]
[junit] Testcase: testCap10 took 0.003 sec
[junit] FAILED
[junit] null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="htt...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="htt...>
[junit] junit.framework.ComparisonFailure: null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="htt...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="htt...>
[junit] at com.google.publicalerts.cap.CapXmlBuilderTest.testCap10(CapXmlBuilderTest.java:297)
[junit]
[junit] Testcase: testCap11 took 0.009 sec
[junit] FAILED
[junit] null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="urn...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="urn...>
[junit] junit.framework.ComparisonFailure: null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="urn...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="urn...>
[junit] at com.google.publicalerts.cap.CapXmlBuilderTest.testCap11(CapXmlBuilderTest.java:329)
[junit]
[junit] Testcase: testCap12 took 0.016 sec
[junit] FAILED
[junit] null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="urn...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="urn...>
[junit] junit.framework.ComparisonFailure: null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="urn...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="urn...>
[junit] at com.google.publicalerts.cap.CapXmlBuilderTest.testCap12(CapXmlBuilderTest.java:350)
[junit]
[junit] Testcase: testEscaping took 0.003 sec
[junit] FAILED
[junit] null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="urn...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="urn...>
[junit] junit.framework.ComparisonFailure: null expected:<....0" encoding="UTF-8"[ standalone="no"]?>
[junit] <alert xmlns="urn...> but was:<....0" encoding="UTF-8"[]?>
[junit] <alert xmlns="urn...>
[junit] at com.google.publicalerts.cap.CapXmlBuilderTest.testEscaping(CapXmlBuilderTest.java:381)
[junit]
[junit] Testcase: testNoPrettyPrint took 0.003 sec
[junit] FAILED
[junit] null expected:<....0" encoding="UTF-8"[ standalone="no"?>]<alert xmlns="urn:oa...> but was:<....0" encoding="UTF-8"[?>
[junit] ]<alert xmlns="urn:oa...>
[junit] junit.framework.ComparisonFailure: null expected:<....0" encoding="UTF-8"[ standalone="no"?>]<alert xmlns="urn:oa...> but was:<....0" encoding="UTF-8"[?>
[junit] ]<alert xmlns="urn:oa...>
[junit] at com.google.publicalerts.cap.CapXmlBuilderTest.testNoPrettyPrint(CapXmlBuilderTest.java:367)
[junit]

[junit] Testcase: testEndToEnd took 0.119 sec
[junit] Caused an ERROR
[junit] java.io.IOException: Stream closed
[junit] java.lang.RuntimeException: java.io.IOException: Stream closed
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:187)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:157)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:142)
[junit] at com.google.publicalerts.cap.EndToEndTest.testEndToEnd(EndToEndTest.java:50)
[junit] Caused by: java.io.IOException: Stream closed
[junit] at java.io.StringReader.ensureOpen(StringReader.java:39)
[junit] at java.io.StringReader.reset(StringReader.java:170)
[junit] at com.google.publicalerts.cap.CapXmlParser.getXmlns(CapXmlParser.java:213)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:177)
[junit]
[junit] Testcase: testParseAlert took 0.149 sec
[junit] Caused an ERROR
[junit] java.io.IOException: Stream closed
[junit] java.lang.RuntimeException: java.io.IOException: Stream closed
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:187)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:157)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:142)
[junit] at com.google.publicalerts.cap.feed.CapFeedParser.parseAlert(CapFeedParser.java:345)
[junit] at com.google.publicalerts.cap.feed.CapFeedParserTest.testParseAlert(CapFeedParserTest.java:144)
[junit] Caused by: java.io.IOException: Stream closed
[junit] at java.io.StringReader.ensureOpen(StringReader.java:39)
[junit] at java.io.StringReader.reset(StringReader.java:170)
[junit] at com.google.publicalerts.cap.CapXmlParser.getXmlns(CapXmlParser.java:213)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:177)
[junit]
[junit] Testcase: testParseAlerts took 0.024 sec
[junit] Caused an ERROR
[junit] java.io.IOException: Stream closed
[junit] java.lang.RuntimeException: java.io.IOException: Stream closed
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:187)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:157)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:142)
[junit] at com.google.publicalerts.cap.feed.CapFeedParser.parseAlert(CapFeedParser.java:345)
[junit] at com.google.publicalerts.cap.feed.CapFeedParser.parseAlert(CapFeedParser.java:325)
[junit] at com.google.publicalerts.cap.feed.CapFeedParser.parseAlerts(CapFeedParser.java:302)
[junit] at com.google.publicalerts.cap.feed.CapFeedParserTest.testParseAlerts(CapFeedParserTest.java:134)
[junit] Caused by: java.io.IOException: Stream closed
[junit] at java.io.StringReader.ensureOpen(StringReader.java:39)
[junit] at java.io.StringReader.reset(StringReader.java:170)
[junit] at com.google.publicalerts.cap.CapXmlParser.getXmlns(CapXmlParser.java:213)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:177)
[junit]
[junit] Testcase: testParseAlert2 took 0.003 sec
[junit] Caused an ERROR
[junit] java.io.IOException: Stream closed
[junit] java.lang.RuntimeException: java.io.IOException: Stream closed
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:187)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:157)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:142)
[junit] at com.google.publicalerts.cap.feed.CapFeedParser.parseAlert(CapFeedParser.java:345)
[junit] at com.google.publicalerts.cap.feed.CapFeedParserTest.testParseAlert2(CapFeedParserTest.java:153)
[junit] Caused by: java.io.IOException: Stream closed
[junit] at java.io.StringReader.ensureOpen(StringReader.java:39)
[junit] at java.io.StringReader.reset(StringReader.java:170)
[junit] at com.google.publicalerts.cap.CapXmlParser.getXmlns(CapXmlParser.java:213)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:177)
[junit]
[junit] Testcase: testParseFrom took 0.003 sec
[junit] Caused an ERROR
[junit] java.io.IOException: Stream closed
[junit] java.lang.RuntimeException: java.io.IOException: Stream closed
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:187)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:157)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:142)
[junit] at com.google.publicalerts.cap.profile.CapProfileTestCase.runTestParseFrom(CapProfileTestCase.java:44)
[junit] at com.google.publicalerts.cap.profile.CanadianProfileTest.testParseFrom(CanadianProfileTest.java:46)
[junit] Caused by: java.io.IOException: Stream closed
[junit] at java.io.StringReader.ensureOpen(StringReader.java:39)
[junit] at java.io.StringReader.reset(StringReader.java:170)
[junit] at com.google.publicalerts.cap.CapXmlParser.getXmlns(CapXmlParser.java:213)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:177)
[junit]
[junit] Testcase: testCheckForErrors took 0.002 sec
[junit] Caused an ERROR
[junit] java.io.IOException: Stream closed
[junit] java.lang.RuntimeException: java.io.IOException: Stream closed
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:187)
[junit] at com.google.publicalerts.cap.profile.AbstractCapProfile.parseFrom(AbstractCapProfile.java:57)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:157)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:142)
[junit] at com.google.publicalerts.cap.profile.CapProfileTestCase.loadAlert(CapProfileTestCase.java:57)
[junit] at com.google.publicalerts.cap.profile.CanadianProfileTest.testCheckForErrors(CanadianProfileTest.java:50)
[junit] Caused by: java.io.IOException: Stream closed
[junit] at java.io.StringReader.ensureOpen(StringReader.java:39)
[junit] at java.io.StringReader.reset(StringReader.java:170)
[junit] at com.google.publicalerts.cap.CapXmlParser.getXmlns(CapXmlParser.java:213)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:177)
[junit]
[junit] Testcase: testCheckForRecommendations took 0.002 sec
[junit] Caused an ERROR
[junit] java.io.IOException: Stream closed
[junit] java.lang.RuntimeException: java.io.IOException: Stream closed
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:187)
[junit] at com.google.publicalerts.cap.profile.AbstractCapProfile.parseFrom(AbstractCapProfile.java:57)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:157)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:142)
[junit] at com.google.publicalerts.cap.profile.CapProfileTestCase.loadAlert(CapProfileTestCase.java:57)
[junit] at com.google.publicalerts.cap.profile.CanadianProfileTest.testCheckForRecommendations(CanadianProfileTest.java:81)
[junit] Caused by: java.io.IOException: Stream closed
[junit] at java.io.StringReader.ensureOpen(StringReader.java:39)
[junit] at java.io.StringReader.reset(StringReader.java:170)
[junit] at com.google.publicalerts.cap.CapXmlParser.getXmlns(CapXmlParser.java:213)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:177)
[junit]
[junit] Testcase: testParseFrom took 0.002 sec
[junit] Caused an ERROR
[junit] java.io.IOException: Stream closed
[junit] java.lang.RuntimeException: java.io.IOException: Stream closed
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:187)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:157)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:142)
[junit] at com.google.publicalerts.cap.profile.CapProfileTestCase.runTestParseFrom(CapProfileTestCase.java:44)
[junit] at com.google.publicalerts.cap.profile.Ipaws1ProfileTest.testParseFrom(Ipaws1ProfileTest.java:43)
[junit] Caused by: java.io.IOException: Stream closed
[junit] at java.io.StringReader.ensureOpen(StringReader.java:39)
[junit] at java.io.StringReader.reset(StringReader.java:170)
[junit] at com.google.publicalerts.cap.CapXmlParser.getXmlns(CapXmlParser.java:213)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:177)
[junit]
[junit] Testcase: testCheckForErrors took 0.001 sec
[junit] Caused an ERROR
[junit] java.io.IOException: Stream closed
[junit] java.lang.RuntimeException: java.io.IOException: Stream closed
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:187)
[junit] at com.google.publicalerts.cap.profile.AbstractCapProfile.parseFrom(AbstractCapProfile.java:57)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:157)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:142)
[junit] at com.google.publicalerts.cap.profile.CapProfileTestCase.loadAlert(CapProfileTestCase.java:57)
[junit] at com.google.publicalerts.cap.profile.Ipaws1ProfileTest.testCheckForErrors(Ipaws1ProfileTest.java:47)
[junit] Caused by: java.io.IOException: Stream closed
[junit] at java.io.StringReader.ensureOpen(StringReader.java:39)
[junit] at java.io.StringReader.reset(StringReader.java:170)
[junit] at com.google.publicalerts.cap.CapXmlParser.getXmlns(CapXmlParser.java:213)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:177)
[junit]
[junit] Testcase: testCheckForRecommendations took 0.002 sec
[junit] Caused an ERROR
[junit] java.io.IOException: Stream closed
[junit] java.lang.RuntimeException: java.io.IOException: Stream closed
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:187)
[junit] at com.google.publicalerts.cap.profile.AbstractCapProfile.parseFrom(AbstractCapProfile.java:57)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:157)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:142)
[junit] at com.google.publicalerts.cap.profile.CapProfileTestCase.loadAlert(CapProfileTestCase.java:57)
[junit] at com.google.publicalerts.cap.profile.Ipaws1ProfileTest.testCheckForRecommendations(Ipaws1ProfileTest.java:80)
[junit] Caused by: java.io.IOException: Stream closed
[junit] at java.io.StringReader.ensureOpen(StringReader.java:39)
[junit] at java.io.StringReader.reset(StringReader.java:170)
[junit] at com.google.publicalerts.cap.CapXmlParser.getXmlns(CapXmlParser.java:213)
[junit] at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:177)
[junit]
[junit] Test com.google.publicalerts.cap.AllTests FAILED

Little adjust on regex expression to validate date format

The comment in the class com.google.publicalert.cap.CapDateUtil says that the right format for the date is "2002-05-24T16:49:00:00-07:00", but regex expression only matches the date when the separator between the seconds and the miliseconds is a dot "2002-05-24T16:49:00.00-07:00".
Regex how is today : "[0-9]{4}-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5]0-9?([+|-])([01][0-9]:[0-5][0-9])"

Regex how should be : "[0-9]{4}-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5]0-9?([+|-])([01][0-9]:[0-5][0-9])"

CAP Validator throws error for valid polygons, code because of line-break in the tag

Original issue 44 created by [email protected] on 2013-10-22T23:55:32.000Z:

What steps will reproduce the problem?

  1. Try to validate this alert. It'll throw errors because <code> and <polygon> starts with a newline. Remove the newline and its' fine. We should ignore the newlines.

<alert xmlns="urn:oasis:names:tc:emergency:cap:1.2">
<identifier>628245</identifier>
<sender>[email protected]</sender>
<sent>2013-09-23T16:55:27+10:00</sent>
<status>Actual</status>
<msgType>Alert</msgType>
<source>CFA-Manual</source>
<scope>Public</scope>
<code>
urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0
</code>
<info>
<language>en-AU</language>
<category>Fire</category>
<event>Bushfire</event>
<responseType>Execute</responseType>
<urgency>Immediate</urgency>
<severity>Severe</severity>
<certainty>Observed</certainty>
<eventCode>
<valueName>
urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0:AUeventLIST:1.0
</valueName>
<value>bushFire</value>
</eventCode>
<effective>2013-09-23T16:55:00+10:00</effective>
<expires>2013-10-19T01:00:00+11:00</expires>
<senderName>Country Fire Authority</senderName>
<headline>Emergency Warning</headline>
<description>
Incident Information
</description>
<instruction>

</instruction>
<web>www.cfa.vic.gov.au</web>
<parameter>
<valueName>Event</valueName>
<value>fire</value>
</parameter>
<parameter>
<valueName>MessageAction</valueName>
<value>Emergency Warning</value>
</parameter>
<parameter>
<valueName>Size</valueName>
<value>large</value>
</parameter>
<parameter>
<valueName>SizeHectares</valueName>
<value>55454</value>
</parameter>
<parameter>
<valueName>Speed</valueName>
<value>slow</value>
</parameter>
<parameter>
<valueName>Location</valueName>
<value>DSE - 22 KM NW OF ORBOST</value>
</parameter>
<parameter>
<valueName>AuthorisedBy</valueName>
<value>test</value>
</parameter>
<area>
<areaDesc>Areas_Affected</areaDesc>
<polygon>
-37.701814521710354,148.45660535147374 -37.70181118770032,148.45663195662993 -37.70180460177421,148.45665757504224 -37.70179492609854,148.4566815759004 -37.7017823989194,148.45670336822357 -37.70176732869615,148.4567224154124 -37.7017500865063,148.45673824846196 -37.70173109690842,148.45675047751 -37.70171082748827,148.45675880143673 -37.70168977734543,148.45676301527953 -37.70166846480381,148.45676301527953 -37.701647414648924,148.45675880143673 -37.7016271452059,148.45675047751 -37.701608155576515,148.45673824846196 -37.70159091334965,148.4567224154124 -37.701575843087475,148.45670336822357 -37.70156331587131,148.4566815759004 -37.70155364016415,148.45665757504224 -37.70154705421515,148.45663195662993 -37.70154372019309,148.45660535147374 -37.70154372019309,148.45657841468093 -37.70154705421515,148.45655180952474 -37.70155364016415,148.4565261911124 -37.70156331587131,148.45650219025427 -37.701575843087475,148.4564803979311 -37.70159091334965,148.45646135074225 -37.701608155576515,148.45644551769269 -37.7016271452059,148.45643328864466 -37.701647414648924,148.4564249647179 -37.70166846480381,148.45642075087514 -37.70168977734543,148.45642075087514 -37.70171082748827,148.4564249647179 -37.70173109690842,148.45643328864466 -37.7017500865063,148.45644551769269 -37.70176732869615,148.45646135074225 -37.7017823989194,148.4564803979311 -37.70179492609854,148.45650219025427 -37.70180460177421,148.4565261911124 -37.70181118770032,148.45655180952474 -37.701814521710354,148.45657841468093 -37.701814521710354,148.45660535147374
</polygon>
<geocode>
<valueName>
urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0:postcode
</valueName>
<value/>
</geocode>
</area>
<area>
<areaDesc>Areas_Affected</areaDesc>
<polygon>
-37.7047,148.4633 -37.70362554588509,148.46452632745192 -37.70234808197172,148.46548225154552 -37.70096800663633,148.46617382637936 -37.699519297172614,148.46658402308586 -37.698037622663726,148.46670274126072 -37.69655946598003,148.46652705766846 -37.69512122553519,148.4660612982222 -37.6937583189101,148.46531693146525 -37.69250431042862,148.46431228617763 -37.69139008419932,148.46307210006051 -37.69044308303358,148.46162691061207 -37.689686632040676,148.46001230319277 -37.68913936362089,148.4582680347959 -37.688814758080056,148.45643705509826 -37.6887208112358,148.45456444889672 -37.688859837244955,148.45269632597075 -37.689228411535865,148.45087868570675 -37.689817455258975,148.4491562844404 -37.6906124591638,148.4475715334072 -37.691593841358184,148.4461634544371 -37.69273743009186,148.4449667191075 -37.694015059617016,148.44401079501392 -37.6953952643879,148.44331922018006 -37.69684405444077,148.4429090234736 -37.69832575280385,148.44279030529873 -37.699803874271744,148.442965988891 -37.70124202387796,148.44343174833725 -37.70260479293354,148.44417611509417 -37.70385863058087,148.4451807603818 -37.70497266943382,148.4464209464989 -37.705919485022726,148.44786613594738 -37.706675770403834,148.44948074336668 -37.70722290938813,148.45122501176354 -37.707547434339816,148.45305599146116 -37.70764135732989,148.4549285976627 -37.70750236653653,148.45679672058867 -37.707133883084225,148.4586143608527 -37.70654497693064,148.46033676211903 -37.70575014385995,148.46192151315222 -37.7047,148.4633
</polygon>
<geocode>
<valueName>
urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0:postcode
</valueName>
<value/>
</geocode>
</area>
<area>
<areaDesc>Orbost</areaDesc>
<circle>-37.70256500448905,148.45897299999686 0.0</circle>
<geocode>
<valueName>
urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0:postcode
</valueName>
<value/>
</geocode>
</area>
<area>
<areaDesc>Point_Of_Origin</areaDesc>
<circle>-37.62316913477013,148.21478065303333 0.0</circle>
<geocode>
<valueName>
urn:oasis:names:tc:emergency:cap:1.2:profile:CAP-AU:1.0:postcode
</valueName>
<value/>
</geocode>
</area>
</info>
</alert>

What is the expected output? What do you see instead?
Should validate.

Please use labels and text to provide additional information.

Rendering options for map visualization

Original issue 20 created by [email protected] on 2011-05-04T15:44:19.000Z:

The request is for a set of rendering options that color-code the alerts on the map visualization according to some parameters in the alerts themselves. I could imagine a <select> that includes fields like "Severity", "Certainty", "Urgency" and when changed, dynamically changes the visualization via javascript using a pre-defined list of colors. It could get fancier by allowing more fields and combination of fields, but not required.

From Simon:

I have had a request from some of our users who have been using your Common Alerting Protocol Validator to look at CAP alerts. They asked specifically if the colour of circles indicating area could reflect the <certainty> value. For instance, we have "Likely" and "Possible" values for fire detection and they would like to distinguish a difference.

I realize there are 5 possible values of <certainty> so it is not that simple. Also, there may be a wish to colour circles/polygons according to <severity> or <urgency> but the users haven't asked me for this.

IPAWS timezone offset errors should be recommendations

Original issue 24 created by [email protected] on 2011-06-14T14:59:58.000Z:

Suggesting timezone offset to be nonzero is not mentioned in the most recent profile doc:
http://docs.oasis-open.org/emergency/cap/v1.2/ipaws-profile/v1.0/cap-v1.2-ipaws-profile-v1.0.pdf

The timezone offset errors should be moved to recommendations here:
http://code.google.com/p/cap-library/source/browse/java/src/com/google/publicalerts/cap/profile/Ipaws1Profile.java

cap-library doesn't work on android

Original issue 15 created by [email protected] on 2011-04-11T01:20:22.000Z:

wondering if you can help me to get your Cap library running on Android.

It seems to be having a problem resolving the schema factory:

No schema factory available for http://www.iana.org/assignments/media-types/application/relax-ng-compact-syntax

here is the Schema Factory Android page:

http://developer.android.com/reference/javax/xml/validation/SchemaFactory.html

Thanks and regards, Eric

I am seeing the following exception when attempting to parse a cap feed:

I/EventMonitor: ( 717): <?xml version='1.0' encoding='ISO-8859-1'?> <rss version='2.0'> <channel> <title>Hawaii Local Storm Reports 30 day archive</title> <link>http://www.prh.noaa.gov/hnl/pages/ls
r.php</link> <description>Local Storm Reports issued in the last 30 days from the National Weather Service Forecast Office in Honolulu, Hawaii.</description> <language>en-us</language> <managingEdi
tor>[email protected]</managingEditor> <webMaster>[email protected]</webMaster> <lastBuildDate>Sun, 3 Apr 2011 13:42:35 +0000</lastBuildDate> <image> <url>http://weather.gov/images
/xml_logo.gif</url> <title>Hawaii Local Storm Reports 30 day archive</title> <link>http://www.prh.noaa.gov/hnl/pages/lsr.php&lt;/link> </image><item><title> NON-TSTM WND D - CORRECTED PRELIMINARY LO
CAL STORM REPORT...CORRECTED</title><link>http://www.prh.noaa.gov/data/HFO/LSRHFO.1103172036&lt;/link&gt;&lt;description&gt;1018 AM NON-TSTM WND DMG HONOLULU 21.31N 157.86W...</description><pub
Date>Thu, 17 Mar 2011 10:36:00 +1000</pubDate></item><item><title> NON-TSTM WND D PRELIMINARY LOCAL STORM REPORT</title><link>http://www.prh.noaa.gov/data/HFO/LSRHFO.1103171819&lt;/link&gt;&lt;description&gt;0807
AM NON-TSTM WND DMG HONOLULU 21.31N 157.86W...</description><pubDate>Thu, 17 Mar 2011 8:17:00 +1000</pubDate></item><item><title> TSTM WND DMG , HEAVY RAIN PRELIMINARY LOCAL STOR
M REPORT</title><link>http://www.prh.noaa.gov/data/HFO/LSRHFO.1103041822&lt;/link&gt;&lt;description&gt;0415 AM TSTM WND DMG 2 E WAIPAHU 21.39N 157.98W...</description><pubDate>Fri, 04 Mar 201
1 8:22:00 +1000</pubDate></item><item><title> HEAVY RAIN PRELIMINARY LOCAL STORM REPORT</title><link>http://www.prh.noaa.gov/data/HFO/LSRHFO.1103041642&lt;/link&gt;&lt;description&gt;0237 AM HEAVY RAIN
4 N KOLOA 21.96N 159.46W...</description><pubDate>Fri, 04 Mar 2011 2:42:00 +1000</pubDate></item> </channel> </rss>
W/CapFeedParser( 717): No schema factory available for http://www.iana.org/assignments/media-types/application/relax-ng-compact-syntax
W/CapFeedParser( 717): java.lang.IllegalArgumentException: http://www.iana.org/assignments/media-types/application/relax-ng-compact-syntax
W/CapFeedParser( 717): at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:192)
W/CapFeedParser( 717): at com.google.publicalerts.cap.feed.CapFeedParser.loadRelaxNgSchema(CapFeedParser.java:85)
W/CapFeedParser( 717): at com.google.publicalerts.cap.feed.CapFeedParser.<clinit>(CapFeedParser.java:78)
W/CapFeedParser( 717): at net.cs76.projects.mobilealert.model.EventMonitor.getAlerts(EventMonitor.java:72)
W/CapFeedParser( 717): at net.cs76.projects.mobilealert.WelcomeActivity$MonitorForEventsTask.doInBackground(WelcomeActivity.java:210)
W/CapFeedParser( 717): at net.cs76.projects.mobilealert.WelcomeActivity$MonitorForEventsTask.doInBackground(WelcomeActivity.java:1)
W/CapFeedParser( 717): at android.os.AsyncTask$2.call(AsyncTask.java:252)
W/CapFeedParser( 717): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
W/CapFeedParser( 717): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
W/CapFeedParser( 717): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
W/CapFeedParser( 717): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
W/CapFeedParser( 717): at java.lang.Thread.run(Thread.java:1020)
W/dalvikvm( 717): Exception Ljava/lang/IllegalArgumentException; thrown while initializing Lcom/google/publicalerts/cap/feed/CapFeedParser;
W/dalvikvm( 717): threadid=9: thread exiting with uncaught exception (group=0x40014760)
E/AndroidRuntime( 717): FATAL EXCEPTION: AsyncTask # 1
E/AndroidRuntime( 717): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime( 717): at android.os.AsyncTask$3.done(AsyncTask.java:266)
E/AndroidRuntime( 717): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
E/AndroidRuntime( 717): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
E/AndroidRuntime( 717): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
E/AndroidRuntime( 717): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
E/AndroidRuntime( 717): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
E/AndroidRuntime( 717): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
E/AndroidRuntime( 717): at java.lang.Thread.run(Thread.java:1020)
E/AndroidRuntime( 717): Caused by: java.lang.ExceptionInInitializerError
E/AndroidRuntime( 717): at net.cs76.projects.mobilealert.model.EventMonitor.getAlerts(EventMonitor.java:72)
E/AndroidRuntime( 717): at net.cs76.projects.mobilealert.WelcomeActivity$MonitorForEventsTask.doInBackground(WelcomeActivity.java:210)
E/AndroidRuntime( 717): at net.cs76.projects.mobilealert.WelcomeActivity$MonitorForEventsTask.doInBackground(WelcomeActivity.java:1)
E/AndroidRuntime( 717): at android.os.AsyncTask$2.call(AsyncTask.java:252)
E/AndroidRuntime( 717): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
E/AndroidRuntime( 717): ... 4 more
E/AndroidRuntime( 717): Caused by: java.lang.IllegalArgumentException: http://www.w3.org/2001/XMLSchema
E/AndroidRuntime( 717): at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:192)
E/AndroidRuntime( 717): at com.google.publicalerts.cap.feed.CapFeedParser.loadXsd(CapFeedParser.java:103)
E/AndroidRuntime( 717): at com.google.publicalerts.cap.feed.CapFeedParser.<clinit>(CapFeedParser.java:80)
E/AndroidRuntime( 717): ... 9 more
W/ActivityManager( 72): Force finishing activity net.cs76.projects.mobilealert/.WelcomeActivity
W/WindowManager( 72): Failure taking screenshot for (216x135) to layer 21010
I/TtsService( 454): Stopping

Validator doesn't work with Hebrew characters

Original issue 22 created by [email protected] on 2011-06-06T16:29:25.000Z:

Entering the following into the validator shows invalid characters in place of the hebrew letters.

<?xml version="1.0" encoding="utf-16"?>
<alert xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:oasis:names:tc:emergency:cap:1.2">
<identifier>1</identifier>
<sender>ח</sender>
<sent>2011-06-06T08:00:00+03:00</sent>
<status>Actual</status>
<msgType>Alert</msgType>
<scope>Public</scope>
<info>
<category>Other</category>
<event>הס</event>
<urgency>Past</urgency>
<severity>Minor</severity>
<certainty>Observed</certainty>
<area>
<areaDesc>תל</areaDesc>
<polygon />
</area>
</info>
</alert>

Low-level parser errors not being prettified for rss feeds

Original issue 7 created by [email protected] on 2011-03-03T19:43:15.000Z:

a couple examples below.

### change: add text node &quot;asdf&quot; to &lt;channel&gt;
### low-level error: cvc-complex-type.2.3
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;rss version=&quot;2.0&quot;&gt;
  &lt;channel&gt;
    &lt;title&gt;Amber Alert CAP Index&lt;/title&gt;
    &lt;description&gt;Amber Alert CAP Index&lt;/description&gt;
    &lt;link&gt;http://www.missingkids.com/&lt;/link&gt;
    &lt;pubDate&gt;Wed, 11 Jun 2003 22:39:00 PDT&lt;/pubDate&gt;
asdf
    &lt;item&gt;
      &lt;title&gt;AMBER ALERT&lt;/title&gt;
      &lt;description&gt;DATE/TIME: 06/11/03, 1915 HRS.  VICTIM(S): KHAYRI DOE JR. M/B BLK/BRO 3'0&quot;, 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).&lt;/description&gt;
      &lt;link&gt;http://cap-validator.appspot.com/examples/KAR0-0306112239-SW.cap&lt;/link&gt;
      &lt;guid&gt;KAR0-0306112239-SW&lt;/guid&gt;
      &lt;pubDate&gt;Wed, 11 Jun 2003 22:39:00 PDT&lt;/pubDate&gt;
    &lt;/item&gt;
  &lt;/channel&gt;
&lt;/rss&gt;

### change: add &quot;dddd&quot; to date
### low-level err: cvc-pattern-valid, cvc-type.3.1.3
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;rss version=&quot;2.0&quot;&gt;
  &lt;channel&gt;
    &lt;title&gt;Amber Alert CAP Index&lt;/title&gt;
    &lt;description&gt;Amber Alert CAP Index&lt;/description&gt;
    &lt;link&gt;http://www.missingkids.com/&lt;/link&gt;
    &lt;pubDate&gt;Wed, 11 Jun 2003 22:39:00 dddd PDT&lt;/pubDate&gt;
    &lt;item&gt;
      &lt;title&gt;AMBER ALERT&lt;/title&gt;
      &lt;description&gt;DATE/TIME: 06/11/03, 1915 HRS.  VICTIM(S): KHAYRI DOE JR. M/B BLK/BRO 3'0&quot;, 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).&lt;/description&gt;
      &lt;link&gt;http://cap-validator.appspot.com/examples/KAR0-0306112239-SW.cap&lt;/link&gt;
      &lt;guid&gt;KAR0-0306112239-SW&lt;/guid&gt;
      &lt;pubDate&gt;Wed, 11 Jun 2003 22:39:00 PDT&lt;/pubDate&gt;
    &lt;/item&gt;
  &lt;/channel&gt;
&lt;/rss&gt;

### change: added extra closing tag &quot;&gt;&quot; to first rss tag.
### low-level err: cvc-complex-type.2.3
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;rss version=&quot;2.0&quot;&gt;&gt;
  &lt;channel&gt;
    &lt;title&gt;Amber Alert CAP Index&lt;/title&gt;
    &lt;description&gt;Amber Alert CAP Index&lt;/description&gt;
    &lt;link&gt;http://www.missingkids.com/&lt;/link&gt;
    &lt;pubDate&gt;Wed, 11 Jun 2003 22:39:00 PDT&lt;/pubDate&gt;
    &lt;item&gt;
      &lt;title&gt;AMBER ALERT&lt;/title&gt;
      &lt;description&gt;DATE/TIME: 06/11/03, 1915 HRS.  VICTIM(S): KHAYRI DOE JR. M/B BLK/BRO 3'0&quot;, 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).&lt;/description&gt;
      &lt;link&gt;http://cap-validator.appspot.com/examples/KAR0-0306112239-SW.cap&lt;/link&gt;
      &lt;guid&gt;KAR0-0306112239-SW&lt;/guid&gt;
      &lt;pubDate&gt;Wed, 11 Jun 2003 22:39:00 PDT&lt;/pubDate&gt;
    &lt;/item&gt;
  &lt;/channel&gt;
&lt;/rss&gt;

Convert cap2kml.py to Java and add to cap-library

Original issue 36 created by [email protected] on 2012-10-05T19:24:03.000Z:

What steps will reproduce the problem?

The CAP to KML script is currently in Python:
http://code.google.com/p/alertfeed/source/browse/trunk/cap2kml.py?spec=svn2&amp;r=2

What is the expected output? What do you see instead?

We'd like to convert it to Java and add it to our CAP library
http://code.google.com/p/cap-library/

The CAP spec is here: http://docs.oasis-open.org/emergency/cap/v1.2/CAP-v1.2-os.html
The KML spec is here: https://developers.google.com/kml/documentation/

Reference issue: http://code.google.com/p/alertfeed/issues/detail?id=1

Empty <references> tag rejected - provide a better error message?

Original issue 10 created by [email protected] on 2011-03-28T20:08:06.000Z:

When CAP includes a completely empty <references></references> tag, the validator says:

Invalid <references>: "". Must be a space-separated list of sender,identifier,sent triplets.

The message could be changed to indicate that we don't permit empty data. Suggest something like:

Invalid <references>: "". Must be a non-empty, space-separated list of sender,identifier,sent triplets.

CapXMLParser throws SAX-Error while parsing alerts from NOAA

Original issue 27 created by eliteSchaf on 2012-02-19T16:44:03.000Z:

Every CAP v1.1 Message released by NOAA couldn't be parsed.
Following Code throws an exception:

URL url = new URL("http://alerts.weather.gov/cap/wwacapget.php?x=FL124C9A83022C.HighSurfAdvisory.124C9A85250CFL.TBWCFWTBW.d83d8b0c494fcc0bf8f67aafd571a291");
Alert alert = parser.parseFrom(new InputSource(url.openStream()));

Exception message:
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Unexpected End of File.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.google.publicalerts.cap.CapXmlParser.parseFrom(CapXmlParser.java:185)
at Main.main(Main.java:24)

Maven Support

Original issue 26 created by aaron.sutula on 2011-08-10T17:37:38.000Z:

It would be great if cap-library would include a maven pom.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.