Skip to content
Common Alerting Protocol Library
HTML Java Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
java Fix langauge bug. Sep 23, 2019
.gitignore Export Google-internal library externally, fix tests Oct 26, 2014
.travis.yml Update AE version Mar 15, 2015
LICENSE Rename to LICENSE to keep it plaintext Oct 3, 2014 Fix typo in Oct 22, 2014
build.xml Reorganize java code and resources under the java/ tree. Mar 19, 2011

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
You can’t perform that action at this time.