酒店列表 XML 参考文档

酒店列表是一个或多个 XML 文件,其中列出了您要提供定价信息的所有酒店。酒店列表文件本身不包含价格信息。

酒店列表的根元素是 <listings> 元素,其中包含描述房源的 <listing> 元素。

您可以在初始实现过程中创建酒店列表,然后在常规维护期间向列表中添加酒店或从中移除酒店。

确保您的文件符合语法指南。 例如,使用 UTF-8 编码,并通过在 XML 标记中添加 encoding 属性来指定此编码架构。

创建酒店列表后,您可以使用 Hotel Center 手动将其上传到 Google将其托管在服务器上

查找并修复数据问题

如需查找和解决酒店列表中的数据问题,请参阅以下文章:

清单要求

若要投放 Google 酒店广告,酒店列表中的房源必须符合以下要求:

  • 设有可供房客付费入住的房间
  • 有面向公众的固定的实体地点
  • 固定墙壁和管道
  • 最低入住天数不超过 7 天

不符合条件的房源的常见示例包括游轮和公寓,因为它们通常不符合 Listing requirements 条件。

小木屋和其他配有固定墙壁、管道和空调(包括木炉或丙烷加热器)的露营场所均符合条件。 不符合条件的户外住宿场所包括:

  • 可供房客入住帐篷的露营地
  • 房客可以自带房车的房车营地

<listings>

<listings> 是酒店列表的根元素,它包含一个 <language> 元素和至少一个 <listing>

<listings> 元素会显示在酒店列表 XML 层次结构中的以下位置:

+ <listings>
    + <language>
    + <datum>
    + <listing>

语法

<listings> 元素使用以下语法:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="xsi"
    xsi:noNamespaceSchemaLocation="schema_xsd">
  <language> language_code</language>
  <datum> datum_code </datum>
  <listing> listing</listing>
  ...
</listings>

属性

<listings> 元素具有以下属性:

特性 是否必需? 说明
xmlns:xsi 必需 设置为 http://www.w3.org/2001/XMLSchema-instance
xsi:noNamespaceSchemaLocation 必需 设置为 http://www.gstatic.com/localfeed/local_feed.xsd

子元素

<listings> 元素具有以下子元素:

子元素 是否必需? 类型 说明
<language> Required string 编写 Feed 所用的语言。将此元素的值设置为 两个字母的语言代码。例如,en 表示英语。
<datum> Optional enum 此元素为 Feed 中提供的纬度/经度坐标指定测地基准或参考模型。如果未提供基准值,则此元素的默认值为 WGS84,大多数新型 GPS 设备都会使用该值。东京基准数据仅适用于日本境内的地址。

此元素的有效值包括:

  • WGS84
  • wgs84
  • TOKYO
  • tokyo
注意:如需使用默认值 WGS84,请勿在酒店列表中添加 <datum> 元素。
<listing> Required <listing> 用于描述 Feed 中每家酒店的一个或多个条目。请注意,列表中的每个酒店都必须有您网站专属的 ID,并且此 ID 绝不能重复使用。

示例

结构化地址

以下示例展示了包含结构化地址的部分酒店列表:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <!-- The value of <id> must be unique to your site for all time. Do NOT reuse IDs. -->
    <id>123abc</id>
    <name>Belgrave House</name>
    <address format="simple">
      <component name="addr1">6 Acacia Ave</component>
      <component name="addr2">Floor 5</component>
      <component name="city">London</component>
      <component name="province">Greater London</component>
      <component name="postal_code">SW1W 9TQ</component>
    </address>
    <country>GB</country>
    <latitude>35.070374</latitude>
    <longitude>-106.213648</longitude>
    <phone type="main">123-456-7890</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
  </listing>
  ...
</listings>

自由格式地址

以下示例展示了包含自由格式地址的部分酒店列表:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <!-- The value of <id> must be unique to your site for all time. Do NOT reuse IDs. -->
    <id>123abc</id>
    <name>Belgrave House</name>
    <address>6 Elm Ave Unit 3, Boston, MA, 02472</address>
    <country>US</country>
    <latitude>35.070374</latitude>
    <longitude>-106.213648</longitude>
    <phone type="main">123-456-7890</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
  </listing>
  ...
</listings>

可选内容

以下示例展示了部分酒店列表,其中的商家信息包含可选的 <content>

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <id>123456</id>
    <name>My Apartment</name>
    <address format="simple">
      <component name="addr1">1 Sandstone Building</component>
      <component name="city">Los Angeles</component>
      <component name="postal_code">90210</component>
      <component name="province">CA</component>
    </address>
    <country>US</country>
    <latitude>40.730610</latitude>
    <longitude>-73.935242</longitude>
    <phone type="main">12345678</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
    <content>
      <text type="description">
        <link>https://examplelisting.com/listings/12345</link>
        <title>3 bedrooms with ocean views</title>
        <body>Stay in this newly renovated 3BR house with ocean views.</body>
        <date month="7" day="23" year="2023"/>
      </text>
      <review type="editorial">
        <link>https://example.com/reviews/42</link>
        <title>A little piece of heaven</title>
        <author>EXAMPLE.COM</author>
        <rating>8</rating>
        <body>This place is really good.</body>
      </review>
      <review type="user">
        <link>https://exampleperson.org/reviews/82</link>
        <author>Susan von Trapp</author>
        <rating>6</rating>
        <body>Not a bad place, but I prefer to be closer to the beach.</body>
        <date day="6" month="7" year="2023"/>
        <servicedate day="16" month="6" year="2023"/>
      </review>
      <attributes>
        <website>https://hotel.example.com</website>
        <client_attr name="rating">8.2</client_attr>
        <client_attr name="num_reviews">14</client_attr>
      </attributes>
      <image type="photo" url="https://image_url">
        <link>https://image_url</link>
        <title>Main hotel picture</title>
      </image>
    </content>
  </listing>
  ...
</listings>

<listing>

酒店列表 <listings> 元素中的酒店定义。

<listing> 元素会显示在酒店列表 Feed XML 层次结构中的以下位置:

+ <listings>
    + <language>
    + <listing>

语法

<listing> 元素使用以下语法:

<?xml version="1.0" encoding="UTF-8"?>
<listings ... >
  <listing>
    <!-- Specify <listing>'s child elements in the order shown below. -->
    <id>hotel_ID</id>
    <name>hotel_name</name>
    <address>
      <component name="addr1">street_address_1</component>
      <component name="addr2">street_address_2</component>
      <component name="city">city_name</component>
      <component name="province">province_name</component>
      <component name="postal_code">postal_code</component>
    </address>
    <!-- You can also define an address freeform, although this is not recommended: -->
    <!-- <address>freeform_address</address> -->

    <country>country_code</country>
    <latitude>hotel_latitude</latitude>
    <longitude>hotel_longitude</longitude>
    <phone type="[fax|main|mobile|tdd|tollfree]">phone_number</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
    <content>content</content>
  </listing>
</listings>

属性

<listing> 元素没有属性。

子元素

<listing> 元素具有以下子元素:

子元素 是否必需? 类型 说明
<id> Required string 酒店的唯一标识符。

注意:您的网站在任何时候都必须是唯一的。请不要重复使用 ID,因为这可能会导致在尝试解决房源匹配问题时出现问题。

<name> Required string 酒店的名称,例如:
<name>Belgrave House</name>
<address> Required Object or string

酒店的实际位置。

此元素接受单个属性 format,您必须将该属性设置为 simple

您必须至少提供酒店的街道地址、城市、州/省级行政区或区域,以及邮政编码。使用 <component> 子元素描述地址的以下各个部分:

  • addr1:酒店的主要街道地址。
  • addr2:次要街道地址(如有必要)。
  • addr3:街道地址的第三部分(如有必要)。
  • city:酒店所在城市的名称。
  • province:酒店所在的州、地区或省的名称。
  • postal_code:酒店的邮政编码。

例如:

<address format="simple">
  <component name="addr1">6 Acacia Ave</component>
  <component name="addr2">Floor 5</component>
  <component name="city">London</component>
  <component name="province">Greater London</component>
  <component name="postal_code">SW1W 9TQ</component>
</address>

或者,您也可以提供“自由格式”地址,但我们不建议这样做。例如:

<address>6 Elm Ave Unit 3, Boston, MA, 02472</address>

请注意,邮政信箱或其他仅用于邮寄的地址不属于完整的实际地址。

<country> Required string 此商家信息所在的国家/地区。该值必须是两个字母的国家/地区代码。 例如,美国为“US”,加拿大为“CA”。例如:
<country>US</country>
<latitude> Required* float 与商家信息中所列位置对应的纬度,例如:
<latitude>37.423738</latitude>

此值可使用 Google Maps API 等 GeoCoding 工具生成。

<longitude> Required* float 与商家信息中所列位置对应的经度,例如:
<longitude>-122.090101</longitude>

此值可使用 Google Maps API 等 GeoCoding 工具生成。

<location_precision> Optional integer 对房源经纬度进行了混淆处理后,发送的房源位置信息的精确度(以米为单位)。零 (0) 表示不进行混淆处理,且是确切位置。注意 :此元素仅适用于民宿。
<phone> Required* string

酒店的一个或多个联系电话号码。如果商家信息是分店,请提供分店位置的具体电话号码(而不是总部的电话号码)。

type 属性可以是下列选项之一:

  • fax:传真电话号码。
  • main:主要语音电话号码。
  • mobile:手机号码。
  • tdd:失聪电话号码对应的电信设备 (TDD)。
  • tollfree:免费电话号码。

例如:

<!-- Singapore (country code +65) -->
<phone type="main">+65 6722-2323</phone>
<!-- U.S. (country code +1) -->
<phone type="fax">+1 408-555-1111</phone>

您至少应提供 main 类型。

<category> Optional string 房源的类型,例如酒店。合作伙伴可以使用任何内部类别来描述其房源,例如“商务酒店”、“度假村”、“汽车旅馆”等。
<content> Optional <content> 用于商家信息的可选详情,例如房源的说明、评分和功能。

* 必须提供电话号码或纬度/经度。我们建议您同时定义这两者。

示例

结构化地址

以下示例展示了包含结构化地址的部分酒店列表:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <!-- The value of <id> must be unique to your site for all time. Do NOT reuse IDs. -->
    <id>123abc</id>
    <name>Belgrave House</name>
    <address format="simple">
      <component name="addr1">6 Acacia Ave</component>
      <component name="addr2">Floor 5</component>
      <component name="city">London</component>
      <component name="province">Greater London</component>
      <component name="postal_code">SW1W 9TQ</component>
    </address>
    <country>GB</country>
    <latitude>35.070374</latitude>
    <longitude>-106.213648</longitude>
    <phone type="main">123-456-7890</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
  </listing>
  ...
</listings>

自由格式地址

以下示例展示了包含自由格式地址的部分酒店列表:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <!-- The value of <id> must be unique to your site for all time. Do NOT reuse IDs. -->
    <id>123abc</id>
    <name>Belgrave House</name>
    <address>6 Elm Ave Unit 3, Boston, MA, 02472</address>
    <country>US</country>
    <latitude>35.070374</latitude>
    <longitude>-106.213648</longitude>
    <phone type="main">123-456-7890</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
  </listing>
  ...
</listings>

可选内容

以下示例展示了部分酒店列表,其中的商家信息包含可选的 <content>

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <id>123456</id>
    <name>My Apartment</name>
    <address format="simple">
      <component name="addr1">1 Sandstone Building</component>
      <component name="city">Los Angeles</component>
      <component name="postal_code">90210</component>
      <component name="province">CA</component>
    </address>
    <country>US</country>
    <latitude>40.730610</latitude>
    <longitude>-73.935242</longitude>
    <phone type="main">12345678</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
    <content>
      <text type="description">
        <link>https://examplelisting.com/listings/12345</link>
        <title>3 bedrooms with ocean views</title>
        <body>Stay in this newly renovated 3BR house with ocean views.</body>
        <date month="7" day="23" year="2023"/>
      </text>
      <review type="editorial">
        <link>https://example.com/reviews/42</link>
        <title>A little piece of heaven</title>
        <author>EXAMPLE.COM</author>
        <rating>8</rating>
        <body>This place is really good.</body>
      </review>
      <review type="user">
        <link>https://exampleperson.org/reviews/82</link>
        <author>Susan von Trapp</author>
        <rating>6</rating>
        <body>Not a bad place, but I prefer to be closer to the beach.</body>
        <date day="6" month="7" year="2023"/>
        <servicedate day="16" month="6" year="2023"/>
      </review>
      <attributes>
        <website>https://hotel.example.com</website>
        <client_attr name="rating">8.2</client_attr>
        <client_attr name="num_reviews">14</client_attr>
      </attributes>
      <image type="photo" url="https://image_url">
        <link>https://image_url</link>
        <title>Main hotel picture</title>
      </image>
    </content>
  </listing>
  ...
</listings>

<content>

添加商家信息的相关信息,例如评分和评价、酒店设施及其他详细信息。<content> 元素是可选字段;在 <content> 中,所有子元素都是可选的。

<content> 元素会显示在酒店列表 Feed XML 层次结构中的以下位置:

+ <listings>
    + <language>
    + <listing>
        + <content>

语法

<content> 元素使用以下语法:

<?xml version="1.0" encoding="UTF-8"?>
<listings ... >
  <listing>
    <content>
      <!-- Specify <text>'s child elements in the order shown below. -->
      <text type="description">
        <link>listing_link</link>
        <title>listing_title</title>
        <author>listing_author</author>
        <body>listing_description</body>
        <date month="MM" day="DD" year="YYYY"/>
      </text>
      <!-- 0 or more reviews: -->
      <review type="[editorial|user]">
        ...
      </review>
      <!-- 0 or more attributes: -->
      <attributes>
        <website>https://hotel.example.com</website>
        <client_attr name="alternate_hotel_id">alternate_hotel_id</client_attr>
        <client_attr name="custom_0">custom_attribute_0</client_attr>
        <client_attr name="custom_1">custom_attribute_1</client_attr>
        <client_attr name="custom_2">custom_attribute_2</client_attr>
        <client_attr name="custom_3">custom_attribute_3</client_attr>
        <client_attr name="custom_4">custom_attribute_4</client_attr>
        <client_attr name="hotel_brand">hotel_brand</client_attr>
        <client_attr name="num_reviews">number_of_reviews</client_attr>
        <client_attr name="rating">aggregate_rating</client_attr>
      </attributes>
      <!-- a picture of the hotel or property-->
      <image type="photo" url="https://image_url">
        <link>https://image_url</link>
        <title>Main Hotel Picture</title>
      </image>
    </content>
  </listing>
  ...
</listings>

属性

<content> 元素没有属性。

子元素

<content> 元素具有以下子元素:

子元素 是否必需? 类型 说明
<text type="description"> Optional Object

与提供商的商家信息相关联的网页。 具有以下子元素:

  • <link>:指向说明的链接。在此元素中添加“http://”或
    “https://”(可选)。
  • <title>:说明的标题(可选)。
  • <author>:说明的作者(可选)。
  • <body>:说明的正文(必需)。
  • <date>:说明的日期(可选)。
  • 注意:这些元素必须按上述顺序显示。

<review type="[editorial|user]"> Optional <review>

包含商家信息的用户评价或编辑评价。您的商家信息可以包含任意数量的评价(任一类型)。

您无需在 <listing> 元素中包含某个资源的所有评价;此元素旨在添加能够体现此商家信息的功能或质量的精选评价。

<attributes> Optional Object

包含 0 个或多个 <client_attr> 子元素,这些子元素提供关于属性的详细信息。子元素使用以下语法:

<client_attr name="attribute_name">attribute_value<client_attr>

如需查看子元素的列表和说明,请参阅 <attributes>

所有 <client_attr> 元素都是可选的。

如果有 <website> 子元素,它必须放置在任何 <client_attr> 元素之前。

<image> Optional Object 重复的标记,包含详细的映像信息。

示例

以下示例展示了包含 <content> 元素的部分酒店列表:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <id>123456</id>
    <name>My Apartment</name>
    <address format="simple">
      <component name="addr1">1 Sandstone Building</component>
      <component name="city">Los Angeles</component>
      <component name="postal_code">90210</component>
      <component name="province">CA</component>
    </address>
    <country>US</country>
    <latitude>40.730610</latitude>
    <longitude>-73.935242</longitude>
    <phone type="main">12345678</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
    <content>
      <text type="description">
        <link>https://examplelisting.com/listings/12345</link>
        <title>3 bedrooms with ocean views</title>
        <body>Stay in this newly renovated 3BR house with ocean views.</body>
        <date month="7" day="23" year="2023"/>
      </text>
      <review type="editorial">
        <link>https://example.com/reviews/42</link>
        <title>A little piece of heaven</title>
        <author>EXAMPLE.COM</author>
        <rating>8</rating>
        <body>This place is really good.</body>
      </review>
      <review type="user">
        <link>https://exampleperson.org/reviews/82</link>
        <author>Susan von Trapp</author>
        <rating>6</rating>
        <body>Not a bad place, but I prefer to be closer to the beach.</body>
        <date day="6" month="7" year="2023"/>
        <servicedate day="16" month="6" year="2023"/>
      </review>
      <attributes>
        <website>https://hotel.example.com</website>
        <client_attr name="rating">8.2</client_attr>
        <client_attr name="num_reviews">14</client_attr>
      </attributes>
      <image type="photo" url="https://image_url">
        <link>https://image_url</link>
        <title>Main hotel picture</title>
      </image>
    </content>
  </listing>
  ...
</listings>

<review>

包含用户评价或编辑评价。您无需在 <listing> 元素中包含某个商家信息的所有评价;此元素旨在添加表示此商家信息功能或质量的选定评价。

<review> 元素会显示在酒店列表 Feed XML 层次结构中的以下位置:

+ <listings>
    + <language>
    + <listing>
        + <content>
            + <review>

语法

<review> 元素使用以下语法:

<?xml version="1.0" encoding="UTF-8"?>
<listings ... >
  <listing>
    <content>
      ...
      <!-- Specify <review>'s child elements in the order shown below. -->
      <review type="editorial">
        <link>review_link</link>
        <title>review_title</title> <!-- Title is for reviews of type "editorial" only -->
        <author>review_author</author>
        <rating>review_rating</rating>
        <body>review_text</body>
        <date>review_date</date>
        <servicedate>review_servicedate</servicedate>
      </review>
      <review type="user">
        <link>review_link</link>
        <author>review_author</author>
        <date month="MM" day="DD" year="YYYY"/>  <!-- Date is for reviews of type "user" only -->
        <servicedate month="MM" day="DD" year="YYYY"/>  <!-- Service Date is for reviews of type "user" only -->
        <rating>review_rating</rating>
        <body>review_text</body>
      </review>
    </content>
  </listing>
</listings>

属性

<review> 元素具有以下属性:

特性 是否必需? 说明
type Required 评价的类型。设置为以下值之一:
  • editorial:由网站或其他审核机构提供的审核。
  • user:最终用户的评价。

子元素

<review> 元素具有以下子元素:

子元素 是否必需? 类型 说明
<link> Optional string 指向评价的链接。在此元素中添加“http://”或“https://”。
<title> Optional string (仅限编辑评价)评价的标题。
<author> Optional string 评价的作者,例如“苏珊·冯·特拉普”。如果评价未获认证,这也可以是显示评价的网站或发布内容的名称。
<rating> Optional string 一个介于 0 到 10(含)之间的浮点数,表示评价的得分。例如,"8.9"。
<body> Optional string 评价的文字。此元素不应包含 HTML。
<date month="MM" day="DD" year="YYYY"/> Optional Object (仅限用户评价)评价日期,您可以使用此元素的以下属性指定该日期:
  • day:一个月中的某天;例如“7”。
  • month:月份,其中 1 = 1 月 ... 12 = 12 月。
  • year:四位数年份;例如“2023”。

例如,2023 年 6 月 7 日写作如下:

<date month="6" day="7" year="2023"/>
<servicedate month="MM" day="DD" year="YYYY"/> Optional Object (仅限用户评价)评价者访问所评价商家信息的日期。其格式与上面的 <date> 相同。

例如,2023 年 6 月 7 日写作如下:

<servicedate month="6" day="7" year="2023"/>

至少填写了 <servicedate> 月份和年份的评价可能不会显示。日期不是必填项。

请注意,仅当评价的 typeeditorial 时,<title> 才是 <review> 的有效子元素;仅当 typeuser 时,<date> 才有效。

示例

以下示例展示了部分酒店列表,其中的商家信息包含一条编辑和用户评价:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <id>123456</id>
    <name>My Apartment</name>
    <address format="simple">
      <component name="addr1">1 Sandstone Building</component>
      <component name="city">Los Angeles</component>
      <component name="postal_code">90210</component>
      <component name="province">CA</component>
    </address>
    <country>US</country>
    <latitude>40.730610</latitude>
    <longitude>-73.935242</longitude>
    <phone type="main">12345678</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
    <content>
      <text type="description">
        <link>https://examplelisting.com/listings/12345</link>
        <title>3 bedrooms with ocean views</title>
        <body>Stay in this newly renovated 3BR house with ocean views.</body>
        <date month="7" day="23" year="2023"/>
      </text>
      <review type="editorial">
        <link>https://example.com/reviews/42</link>
        <title>A little piece of heaven</title>
        <author>EXAMPLE.COM</author>
        <rating>8</rating>
        <body>This place is really good.</body>
      </review>
      <review type="user">
        <link>https://exampleperson.org/reviews/82</link>
        <author>Susan von Trapp</author>
        <rating>6</rating>
        <body>Not a bad place, but I prefer to be closer to the beach.</body>
        <date day="6" month="7" year="2023"/>
        <servicedate day="16" month="6" year="2023"/>
      </review>
      <attributes>
        <website>https://hotel.example.com</website>
        <client_attr name="rating">8.2</client_attr>
        <client_attr name="num_reviews">14</client_attr>
      </attributes>
      <image type="photo" url="https://image_url">
        <link>https://image_url</link>
        <title>Main hotel picture</title>
      </image>
    </content>
  </listing>
  ...
</listings>

<attributes>

<attributes> 标记可用于描述酒店设施,以及对酒店的评分和评价进行分类。

+ <listings>
    + <language>
    + <listing>
        + <content>
            + <review>
            + <attributes>

子元素

子元素 是否必需? 说明
<website> Optional 酒店的主要网站。如果存在,则它必须位于第一个 <client_attr> 元素之前。示例
<website>https://hotel.example.com</website>
<client_attr name="attribute_name"> Optional 房源的其他特征或“属性”,可以使用支持的 attribute_name 民宿的 attribute_name 指定。

attribute_name 占位符的值

下表列出了 <client_attr name="attribute_name"> 元素中 attribute_name 的有效值。

attribute_name 的值 说明 有效的内容值
alternate_hotel_id 房源的备用标识符。如果您需要一个房源标识符用于 Feed 信息,而需要另一个房源标识符用于预订引擎,则使用单独的 ID 会非常有用。 任意字符串值
custom_[0-4] 任何字符串类型的自定义属性。这些信息不会向用户显示。 任意字符串值
hotel_brand 此酒店所属品牌,例如,“Marriott”或“Hilton”。此名称不会向用户显示,但可用于对酒店进行分组。 任意字符串值
lodging Lodging proto 中所有可用字段的编码表示法。 编码 Lodging proto 的 Base64 编码字符串
num_reviews 商家信息的评价数。 任何非负整数。
rating 表示总体房源评分的浮点数。 此数字通常介于 0-5、0-10 或 0-100 之间,但您可以使用任何能代表您的分级制度的范围。

民宿的 attribute_name 占位符值

请参阅民宿专用属性和 XML 示例

<image>

+ <listings>
    + <language>
    + <listing>
        + <content>
            + <review>
            + <attributes>
            + <image>

图片用于在房源 ID 中显示房源。使用的所有图片都必须遵守以下准则:

  • 建议的图片宽高比为 4:3。
  • 图片网址必须可供 Googlebot 图片抓取工具访问。
  • 如果您的网站在根级目录包含 robots.txt,请确认它是否包含以下两个选项之一:

    1. 允许 Googlebot 抓取工具抓取您网站的内容(包括图片)。

      • User-agent: Googlebot
      • Allow: /
    2. 允许 Googlebot 图片抓取工具抓取您网站上的图片。

      • User-agent: Googlebot-Image
      • Allow: /
  • 不得提供图片或网站的屏幕截图。图片必须是真实的原创图片或照片。

属性

  • 如果图片是广告,则为 "ad"
  • 如果图片是餐馆菜单,则为 "menu"
  • 如果图片是商家照片,则为 "photo"
属性名称 是否必需? 格式 说明
type Required Text

图片必须为以下项之一:

url Required Text 完整尺寸图片的网址。使用 url 属性指定要在该网页上使用的图片。
width Required A non-negative integer 图片的宽度,以像素为单位(建议大于 720 像素)
height Required A non-negative integer 图片的高度,以像素为单位(建议大于 720 像素)

子元素

子元素 是否必需? 说明
<link> 已请求,但对于本地照片商家信息而言是必需的。 此标记包含您网站上相关图片所在网页的有效最新网址。它不包含图片本身的网址。 示例
<link><http://www.example.com/magic_pizza/></link>
<title> 已请求 此标记包含图片的标题。示例
<title>"Luxury Apartment"</title>
<author> 不需要提供 内容作者的姓名。该值可以是用户名或格式为“Firstname Lastname”的全名。
<date> 必需

此标签标识内容项的创建日期。您必须输入年、月、日,如以下示例所示:

<date month="6" day="7" year="2023"/>

示例

以下示例显示了包含图片标记的部分酒店列表:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <content>
      <review>
      </review>
      <attributes>
      </attributes>
      <image type="photo" url="https://image_url" width="400" height="300">
        <link>https://image_url</link>
        <title>Apartment at Sandstone</title>
        <author>Jessica Landlord</author>
        <date month="6" day="7" year="2023"/>
      </image>
    </content>
  </listing>
  ...
</listings>

语法准则

创建基于 XML 的酒店列表时,请遵循以下准则:

  • 使用 Google 的 XSD 架构验证您的酒店列表 XML 文件。

  • 请使用 UTF-8 编码。您可以通过在 XML 标记中添加 encoding 属性来指定此编码架构,如以下示例所示。

  • 您可以在 Feed 中的 CDATA 部分指定数据值。如果您使用 CDATA 部分,请勿对特殊字符进行转义。

  • 对不在 CDATA 部分(包括网址)的数据值使用转义码。您可以使用实体代码或字符代码来表示这些特殊字符。下表列出了您可以使用的常见实体代码和字符代码:

    基于字符, 实体 字符代码
    和号 (&) &amp;
    英文单引号 (') &apos;
    英文双引号 (") &quot; &#34;
    大于 (>) &gt; &#62;
    小于 (<) &lt; &#60;
  • 省略不包含数据的 XML 元素。例如,如果您没有酒店的经纬度信息,则不应添加空的 <latitude/><longitude/> 元素。

  • 在任何情况下(即使对 XML 元素进行了转义),都不要在 XML 元素中使用 HTML。

  • 要在上传之前验证 Feed,您可以使用本地 Feed XSD http://www.gstatic.com/localfeed/local_feed.xsd。

  • 如需在 Feed 中使用注释,请将注释封装在 <!----> 标记中,如以下示例所示:

    <!-- This is a comment -->
    
  • 请务必关闭用户 <review> 中的 <date> 元素。例如:

    <date day="2" month="12" year="2017"/>