提醒

如需定义当前事件的基本信息,请使用 <alert> 实体。

如果某个活动同时占据多个正在进行的位置,最好将该活动拆分为多个 alert 对象。例如,如果一场森林火灾跨越多个州,您可以将提醒拆分为多个提醒,每个州一个。这样,您就可以向每个州提供具体紧急情况信息,并更准确地更新火灾情况。

如果事件发生快速变化(例如飓风从东向西移动),我们建议您定期更新提醒。请勿从 Feed 中移除现有提醒。而是发出引用之前提醒的新提醒。

属性

表 1 介绍了 <alert> 实体的属性值:

表 1. <alert> 实体属性

元素名称 可选性 类型 说明
xmlns:cap 必需 string

xmlns 属性必须将 CAP URN 作为命名空间进行引用。

示例:

<cap:alert xmlns:cap="urn:oasis:names:tc:emergency:cap:1.2"/>

元素

表 2 介绍了 <alert> 实体的子元素值:

表 2. <alert> 实体元素

元素名称 可选性 类型 CAP 和 Google 备注和要求
<identifier> 必需 string 提供代表该事件的提醒的 ID。<identifier> 元素的值在所有事件中都必须是唯一的。
<sender> 必需 string <sender> 元素用于标识提醒的发起者。不得包含空格、英文逗号或受限字符。
<sent> 必需 dateTime

如果 <area> 块中引用的位置位于单个时区内,请使用 <sent> 元素指定该时区的时间。在适用情况下,请考虑夏令时。

如果消息内容适用于多个时区,请使用世界协调时间 (UTC) 而非本地时间。

<status> 必需 AlertStatus

Google 仅发布 <status> 元素值为 Actual 的公开提醒。

<msgType> 必需 AlertMsgType

UPDATECANCEL <msgType> 必须包含至少一个 <references> 元素。CAP 标准指定了以下内容:

  • 用于更新之前提醒的任何提醒消息都会使用 UPDATE,并将 <references> 元素值设置为未达到 <expires> 日期的所有之前消息。
  • UPDATECANCEL <msgType> 元素必须应用于未过期的提醒。 因此,在发出 UPDATECANCEL <msgType> 时,必须引用所有相关消息和未过期的提醒。

如需了解详情,请参阅事件更改或到期

<source> 可选 string <source> 元素表示提醒的特定来源。例如运营商或特定设备。
<scope> 必需 AlertScope

<scope> 元素表示提醒消息的预期分发方式。

<restriction> 基于条件 string 如果 <scope> 元素值为 Restricted,则必须提供 <restriction> 元素。此元素用于描述限制分发受限提醒消息的规则。
<addresses> 基于条件 string 如果 <scope> 元素值为 Private,则必须提供 <addresses> 元素。此元素列出了提醒消息的预期收件人。您可以添加多个以空格分隔的地址,但必须将包含空格的地址括在双引号中。
<code> 可选 string

<code> 元素表示对提醒消息的特殊处理。

<note> 基于条件 string

如果提醒包含以下任一元素值,则必须包含 <note> 元素:

  • <status>Exercise></status>
  • <msgType>Error></msgType>
<references> 基于条件 string

如果 <msgType> 元素值为 UPDATECANCEL,则必须提供 <references> 元素。

当您的系统重新发布其他发布商的 CAP 内容时,请添加完整的 CAP 提醒。如需将修改的内容与原始来源相关联,请使用 <references> 标记。

如果您引用多条消息,请使用空格作为分隔符。

<incidents> 可选 string <incidents> 元素用于汇总多个消息,这些消息涉及同一事故的不同方面。
<info>

必填*

info 必须至少存在一个 <info> 元素。多个 <info> 块必须具有相同的 <category><event> 元素值。

* Google 要求使用带有粗体红色 REQUIRED 选项性的元素,但这些元素在 CAP 标准中是可选的。

示例

<alert xmlns="urn:oasis:names:tc:emergency:cap:1.1">
    <identifier>AL20110412020900TornadoWarning</identifier>
    <sender>w-nws.webmaster@noaa.gov</sender>
    <sent>2011-04-11T21:18:07-05:00</sent>
    <status>Actual</status>
    <msgType>Alert</msgType>
    <scope>Public</scope>
    <info>
        <language>en-US</language>
        <category>Met</category>
        <event>Tornado Warning</event>
        <urgency>Immediate</urgency>
        <severity>Extreme</severity>
        <certainty>Observed</certainty>
        <effective>2011-04-11T21:09:00-05:00</effective>
        <expires>2011-04-11T21:30:00-05:00</expires>
        <headline>Tornado Warning issued April 11 at
        9:30PM CDT by NWS Birmingham</headline>
        <description>Tornado is observed near Cleburne.</description>
        <instruction>
          Don't wait to see or hear the tornado.
          For your protection, move to an interior room on the lowest floor
          of your home or business.</instruction>
        <area>
            <areaDesc>Cleburne</areaDesc>
            <polygon>33.61,-85.58 33.65,-85.58 33.72,-85.58
            33.81,-85.36 33.7,-85.34 33.7,-85.33 33.68,-85.33
            33.61,-85.58</polygon>
        </area>
    </info>
</alert>