Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.


Folders and files

Last commit message
Last commit date

Latest commit


Common Alerting Protocol Library Build Status

Copyright 2014 Google Inc.


The CAP Library is a collection of code and tools to work with public alerting messages in the [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] ( to validate the correctness of CAP messages.


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/, for an example.

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

To learn more about Google protocol buffers, see and


###Install ant You can download and install Apache Ant from

###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