警示

如要定義目前事件的基本資訊,請使用 <alert> 實體。

如果活動同時涉及多個進行中的地點,最好將事件分割成多個 alert 物件。舉例來說,如果森林火災橫跨多個州,您可以將快訊分成多個快訊,每種狀態各一則。這樣一來,您就能為各州提供特定緊急資訊,並更準確地更新火災發生狀況。

如果事件會快速變動 (例如從東到西的颶風),建議定期更新快訊。請勿將現有快訊從動態饋給中移除,請改為提出指向先前快訊的新快訊。

屬性

表 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> 元素。

當系統重新發布其他發布商的人機驗證 (Captcha) 內容時,請加入完整的 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>