提醒

如需定义当前事件的基本信息,请使用 <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> 个实体元素

元素名称 可选 类型 上限和 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 要求具有可选和红色必需元素的元素,但这些元素在 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>