使用图像解析Atom Feed [英] Parsing an Atom Feed with images

查看:119
本文介绍了使用图像解析Atom Feed的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请有人帮忙!我知道我忽略了一些东西,但是有任何人有任何使用webmatrix或java在Razor中显示联盟原子饲料的经验。如果我只能看到一个例子,我相信我可以学到这一点,但我找不到运气。以下是他们在网站上的所有信息。



HomeAway会员XML供稿常见问题

加盟XML数据Feed常见问题

入门

HomeAway提供的源是XML原子源。 XML(可扩展标记语言)是一组用于以电子方式编码文档

的规则。 XML通常用于通过Internet交换数据。因此,为了访问数据,您必须解析

提要。

以下是访问和显示xml提要的基本步骤:

第1步:获取XML Feed

步骤2:从Feed中提取或解析数据

步骤3:存储数据

步骤4:显示数据

有许多不同的方法可以从Feed中提取或解析数据。已经开发并使用了各种用于访问XML的API,

和一些已经标准化的。

拉解析器的示例包括Java编程语言中的StAX,PHP中的SimpleXML和.NET

框架中的System.Xml.XmlReader。其他受欢迎的包括:

FeedAPI - http://drupal.org/project/feedapi

SimplePie - http://simplepie.org/

PHP Universal Feed Parser -

http://www.ajaxray.com/blog/2008/05/02/php-universal-feed-parser-lightweight-php-class-for -parsing-rss-and-atom-feeds /

访问数据

访问Atom提要的URL将是这样的:

https://partner.homeaway.com/aggregator/homeaway/partners/search?partnerId=cj_all&format=cjAtom&affiliateID=1。这将是

Feed的第一页。

要访问其余页面,请按照下一个链接查看Feed:< link rel =next

href =https://partner.homeaway.com/aggregator/homeaway/partners/search?partnerId=cj_all&format = cjAtom&affiliateID = 1&page = 2/>。最后一个

页面没有下一个链接。因此,代码可以在文档遍历时从文档中提取信息。

您应该每天处理一次Feed并缓存数据。在给定日期收到的数据应该替换前一天的任何数据。

例如,您可能在某一天列出1,2和3,在第二天,1,2 ,4。在这种情况下,您不应再存储或使用清单3.此外,

列表数据可能会随着所有者更新其列表而更改,因此应在您的系统中更新清单1和清单2。 br $>
XML Feed数据

Feed中提供的数据包括以下内容:

度假租赁名称

描述物业

物业ID

HomeAway.com上市物品的网址

CJ追踪网址

图片网址

地区(国家,州,城镇,邮编)

价格

货币

期间类型(每晚 - 每周 - 每月)

物业类型(公寓,住宅等)

#卧室

人们睡觉的数量

浴室数量

提示 - 您可以右键点击Feed和查看来源查看d上面的ata字段!

数据格式

Feed是一个Atom提要。下面是一个Atom提要的开头和一个条目的示例:

列出属性

列表元素(在内容元素中找到的唯一元素)是主要数据宾语。它具有以下属性:

systemid,propertyid,unitid - 这三个组合构成了列表的唯一标识符

url - homeaway.com上列出的url

lastmodified - 这是所有者上次修改列表的日期/时间

thumbnailurl - 这是缩略图的位置

imageurl - 这是一个较大图像的位置(与thumbnailurl相同的图像)此图像将适合400x300px框架

列出元素

Feed中的每个列表元素将具有以下元素

标题 - 与条目中的标题相同。这是所有者定义的列表标题

描述 - 与条目中的摘要相同

区域 - 这些是HomeAway区域(按顺序)房源位置

汇率 - 按时间段列出的房价列表

rentalbasis - 房价如何适用 - 目前的租赁基准是:房产,人,房间>
汇率 - 价格范围的下限 - 可能是一个小数。

汇率 - 价格范围的较高端

currencyunit - USD

期间类型 - 每日,每周,每月

数据属性类型 - 房产类型 - 房屋,公寓,小屋等

卧室 - 卧室数量

睡觉 - 单位睡觉的人数

半浴室 - 半浴室数量

全浴室 - 完整浴室数量

city - 该物业所在的城市

州 - 该物业所属的州装箱

country - 该物业所在的国家

邮政编码 - 邮政编码

Please someone help! I know I am overlooking something, but has anyone had any experience displaying an affiliate atom feed for homwaway in Razor using webmatrix or java. If I could only see an example I’m sure I could learn this, but I am having no luck at all finding one. Below is all the info they have on their website.

HomeAway Affiliate XML Feeds FAQ
Affiliate XML Data Feed FAQ
Getting started
The feeds that HomeAway are providing are XML atom feeds. XML (Extensible Markup Language) is a set of rules for encoding documents
electronically. It is common for XML to be used in interchanging data over the Internet. Therefore, in order to access the data you must parse the
feed.
Here are the basic steps for accessing and displaying xml feeds:
Step 1: Get the XML Feed
Step 2: Extract or Parse data from the feed
Step 3: Store data
Step 4: Display data
There are many different ways to extract or parse the data from the feed. A variety of APIs for accessing XML have been developed and used,
and some have been standardized.
Examples of pull parsers include StAX in the Java programming language, SimpleXML in PHP and System.Xml.XmlReader in the .NET
Framework. Other popular ones include the following:
FeedAPI - http://drupal.org/project/feedapi
SimplePie - http://simplepie.org/
PHP Universal Feed Parser -
http://www.ajaxray.com/blog/2008/05/02/php-universal-feed-parser-lightweight-php-class-for-parsing-rss-and-atom-feeds/
Accessing the data
The URL for accessing the Atom feed will be something like this:
https://partner.homeaway.com/aggregator/homeaway/partners/search?partnerId=cj_all&format=cjAtom&affiliateID=1. This will be the first page of
the feed.
To access the remaining pages, "walk" the feed by following the next links: <link rel="next"
href="https://partner.homeaway.com/aggregator/homeaway/partners/search?partnerId= cj_all&format=cjAtom&affiliateID=1&page=2"/>. The last
page will not have a next link. The code can thus extract information from the document as it traverses it.
You should walk the feed once a day and cache the data. The data received on a given day should replace any of the data from the day before.
For example, you may have listing 1, 2 and 3 one day, and on the next day, 1, 2, 4. In this case, you should no longer store or use listing 3. Also,
listing data may change as owners update their listings, so listings 1 and 2 should be updated in your system.
XML Feed Data
The data provided in the feeds includes the following:
Vacation Rental Name
Description of the Property
Property ID
URL of the listing at HomeAway.com
CJ Tracking URL
Image URL
Region (Country, State, Town, Zip)
Price
Currency
Period Type (Nightly – Weekly – Monthly)
Property Type (Condo, House, etc)
# of Bedrooms
# of People it Sleeps
# of Bathrooms
Hint – You can right click on the feed and ‘view source’ to see the data fields above!
Data Format
The feed is an Atom feed. Here is an example of the beginning of an Atom feed and one entry:
Listing Attributes
The listing element (the only element found in the content element) is the main data object. It has the following attributes:
systemid, propertyid, unitid - These three combined make up the unique identifier of the listing
url - the url of the listing on homeaway.com
lastmodified - The is the date/time of when the listing was last modified by the owner
thumbnailurl - This is the location of the thumbnail image
imageurl - This is the location of a larger image (same image as thumbnailurl)This image will fit into a 400x300px frame
Listing Elements
Each listing element in the feed will have the following elements
headline - same as title found in the entry. This is the headline of the listing as defined by the owner
description – same as the summary found in the entry
regions - These are the HomeAway regions (in order) of the location of the property
rates - list of rates by time period
rentalbasis - how the rate applies - the current rental bases are: property, person, room
rate from - the lower end of the price range - may be a fractional number.
rate to – the higher end of the price range
currencyunit – USD
periodtype – daily, weekly, monthly
data propertytype – the type of property – house, condo, cottage, etc.
bedrooms – number of bedrooms
sleeps – the number of people the unit sleeps
halfbathrooms – the number of half bathrooms
fullbathrooms – the number of full bathrooms
city – the city the property is located
state – the state the property is located
country – the country the property is located
postalcode – the zip code

推荐答案

这篇关于使用图像解析Atom Feed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆