'RSS'에 해당되는 글 3건
- 2008.10.22 PHP로 사용자 정의 가능한 RSS 피드 수집기 구현하기 (한글)
- 2008.10.20 RSS Specifications
- 2008.10.20 Ecommerce RSS Module Specification (ERSS) : RSS 2.0
PHP로 사용자 정의 가능한 RSS 피드 수집기 구현하기 (한글)Ajax와 웹 2.0 응용 프로그램에서 RSS의 진가를 경험해 보자 |
난이도 : 고급 Senthil Nathan, 선임 소프트웨어 엔지니어, IBM 2008 년 3 월 18 일 RSS(Rich Site Summary, RDF Site Summary 또는 Really Simple Syndication)는 1990년대 중반에 생겨났습니다. 지금까지 다양한 변종이 나타났다 사라졌으며, 여러 단체와 개인이 소유권 논쟁을 벌였습니다. 그럼에도 불구하고 RSS는 한 웹 사이트에 담긴 정보를 여러 사람에게 배포하는 메커니즘으로 꾸준하게 각광을 받아왔고, 이러한 RSS의 인기를 발판으로 피드 구독기(feed reader) 혹은 피드 수집기(feed aggregator)라는 새로운 웹 소프트웨어가 생겨났습니다. 상업적으로 판매되는 피드 수집기도 여럿 있지만, 자신의 피드 수집기를 직접 구현해 자신의 웹 응용 프로그램에 통합하기가 그리 어렵지 않습니다. 이 기사에서는 사용자 정의 가능한 RSS 피드 수집기를 구현해 봅니다. 완전히 돌아가는 PHP 코드를 제공하고, RSS 피드 수집기 수정을 위한 서버측 PHP 함수 사용법도 소개합니다. 또한 완전히 돌아가는 RSS 피드 수집기 코드도 제공하므로 곧바로 내려 받아 사용할 수도 있습니다. 웹 응용 프로그램이 급속하게 성장한 배경에는 Ajax나 웹 2.0과 같은 기술도 한 몫을 했지만 웹 응용 프로그램에 담긴 정보 자체의 가치 역시 중요하고 핵심적인 역할을 수행했다. 정보 제공자에게는 효과적으로 정보를 게시하는/배포하는 방법이, 정보 소비자에게는 효과적으로 정보를 구독하는/읽는 방법이 필요했다. 여기서 강력한 기능과 단순성 덕택에 웹 1.0 시대의 산물이던 RSS가 웹 2.0 시대와 이후 미래에도 중요한 위치를 차지하게 되었다. RSS가 제공하는 우아하고 보편적인 형식을 사용하면 정보 제공자가 주기적으로 사이트에 가한 변경을 인코딩하여 배포하기 쉽다. 정보 제공자는 RSS 형식으로 변환한 정보를 전체 웹이나 (사내 사이트처럼) 제한적인 웹에다 게시하면 된다. 정보 제공자 반대편 끝에는 정보 소비자가 있다. 흔히 정보 소비자는 이 사이트 저 사이트를 돌아다니며 필요한 정보를 찾기에 급급하여 차분히 정보를 소화하지 못한다. 이 때 RSS 피드로 특정 범주에 속하는 정보를 한 덩어리로 받으면 소비자가 이 페이지 저 페이지를 뒤지고 돌아다닐 필요가 없어진다. 게다가 RSS 피드는 해당 범주에서 여러 정보 제공자가 제공하는 정보를 소비자를 위해 요약해 주기도 한다. 앞서 언급했지만, RSS는 두 부분으로 나누어진다. 하나는 배포(Syndication)이고, 다른 하나는 피드 수집(Feed Aggregation)이다. 정보 소비자에게는 피드 수집 기능이 중요하며, 여기서는 이 부분에 초점을 맞춘다. 이 기사는 정보 소비자 입장에서 사용자 정의 가능한 RSS 피드 수집기를 개발하는 세부 방법을 설명한다.
웹으로 정보를 제공하는 방식이 널리 퍼지면서 정보 제공자와 정보 소비자 모두가 여러 가지 난관에 직면하게 되었다. 정보 제공자 입장에서 주요 난관은 혼잡한 경쟁 속에서 돋보이는 내용으로 정보 소비자를 가능한 많이 끌어들이는 능력이다. 반대로, 정보 소비자 입장에서 주요 난관은 온갖 정보 제공자가 제공하는 수많은 범주에서 필요한 정보를 재빨리 뽑아내는 능력이다. 정보 소비자는 또한 찾으려는 정보를 가리고 주의를 흐트리는 그래픽 애니매이션이나 플래시 광고 등 부수 정보도 가려내야 한다. 웹이 우리 생활에 이미 깊숙히 침투했기 때문에 개발자들은 소비자가 정보를 신속하게 그리고 꼭 필요한 내용만 가져오는 방법에 초점을 맞추어야 한다. 정보 제공자들은 웹 브라우저에서 휴대형 모바일 장비에 이르기까지 다양한 소비자 매체로 동적 정보를 제공하도록 점차 요구받고 있다. 이 장 초반에서 설명했듯이, RSS는 정보 배포와 수집에 따르는 많은 문제를 해결해 준다. RSS에 익숙하지 않다면 참고자료 절에 열거한 RSS 관련 기사를 읽어보기 바란다. RSS는 다양한 방식으로 (그리고 예기치 못한 방식으로) 인터넷에 커다란 잠재력을 안겨주었다. 말할 필요도 없이, 최근 몇몇 주요 소프트웨어 업체 경영진은 자기네 핵심 인터넷 사업을 이끌어나갈 원동력으로 RSS를 추가했다(자세한 내용이 궁금하다면 유명한 Web 2.0 Journal과 AjaxWorld Magazine 창립 편집장인 Dion Hinchcliffe가 쓴 명쾌하고도 간결한 기사를 읽어보기 바란다. 기사 링크는 참고자료 절에 있다). Hinchcliffe는 그림 1을 통해 RSS가 웹 2.0 정보 생태계를 활성화하는 모습을 보여준다. 위키, 블로그, 뉴스 서비스, 수집 서비스, 매시업 서비스, 검색 엔진 등 주요한 웹 2.0 구성요소는 모두 RSS로 연결되어 웹 2.0의 사회적 컴퓨팅이라는 비전을 실현한다. 그림 1. Hinchcliffe가 보는 관점: 웹 2.0에서 RSS가 수행하는 역할 현재 사용 중인 RSS 버전은 여러 가지다. RSS 버전 0.91, 0.92, 2.0은 특정한 XML 형식으로 RSS 피드를 기술한다. RSS 버전 1.0은 나머지 버전과 XML 형식이 약간 다르다. RSS 피드 수집기를 개발할 때는 이러한 사소한 차이점을 염두에 두어야 한다. RSS 역사가 궁금하다면 참고자료 절에 있는 기사를 읽어본다. 지금까지 RSS 형식이 중요하고 유용하다는 사실을 이해했으니, 이제 사용자 정의 가능한 RSS 피드 수집기를 개발해 보자. 개발 언어로는 PHP를 사용한다. PHP는 다양한 웹/XML 함수를 내장하므로 개발 속력이 높아진다는 장점이 있다. 게다가 PHP로 작성한 코드는 (젠드 프레임워크를 포함하는) 젠드 코어와 같은 PHP 서버에서 문제 없이 돌아간다. 피드 수집기를 개발하려면, 개발 시스템에 PHP를 설치하고 cURL(Client URL)과 XML 패키지를 구성해야 한다. 젠드 코어 PHP 서버를 권장하는데, 무료인데다 설치와 구성이 쉽다. RSS 형식에 대한 기본 규칙을 간단히 살펴보자. 지금까지 애플, 마이크로소프트(Microsoft®), 넷스케이프, 유저랜드, RSS-DEV 작업 그룹 등 다양한 회사와 그룹이 RSS에 기여했다. 그 덕택에 RSS 형식도 여러 가지 버전으로 나뉘었다. 가장 주목할 만한 내용으로 (RSS-DEV가 개발한) RSS 버전 1.0은 나머지 버전(역호환 형식을 공유하는 0.91, 0.92, 2.0 버전)과 다소 차이가 있다. Listing 1은 RSS 버전 1.0 형식을 개략적으로 보여준다. 여기서 루트 요소는 Listing 1. RSS 버전 1.0 기본 형식
Listing 2는 RSS 버전 0.91, 0.92, 2.0 형식을 개략적으로 보여준다. 여기서 루트 요소는 Listing 2. RSS 버전 0.91과 2.0 형식
구체적인 RSS 명세는 참고자료에 있는 관련 기사를 살펴본다. 다음 절부터는 우리 RSS 피드 수집기에 필요한 컴포넌트를 설명한다. 이 기사에서 설명하는 RSS 기능은 다음 컴포넌트로 이루어진다. 앞으로 설명할 순서대로 열거했다.
위와 같이 간단한 컴포넌트 네 개를 결합하면, 응용 프로그램과 다양한 방식으로 통합하기 쉬우면서도 강력한 기능을 제공하는 RSS 피드 수집기가 만들어진다. 이어지는 절에서 각 컴포넌트를 구현하는 PHP 코드를 소개한다. 그림 2는 기능적 컴포넌트를 전체적으로 보여준다. 그림 2. RSS 기능적 컴포넌트 개요 그림 2에서 다음과 같은 사실을 이해할 수 있다.
편의상 피드 소스 입력 컴포넌트와 피드 결과 출력 컴포넌트를 피드 수집기 컴포넌트로 통합한다. (다운로드 절에서 완전히 문서화된 PHP 소스 파일을 모두 받을 수 있다.) 다운로드한 파일을 푼 후에는 원하는 RSS 피드 소스를 지정하고 실행하면 된다. 앞서 설명했듯이, 프로그램을 실행하려면 PHP를 설치하고 XML/cURL 라이브러리를 구성해야 한다(RSS 피드 수집기 코드를 사용하는 다양한 방법은 결론 절을 참조한다). 이제 각 컴포넌트에 대한 내부 동작 원리를 상세히 살펴보자. 피드 리더 컴포넌트는 피드 소스와 네트워크 통신을 수행하고 피드 소스에서 가져온 XML 기반 RSS 피드를 구문 분석한다. 간단하나 강력한 PHP 기본 기능 세 가지를 사용한다.
cURL은 HTTP, FTP, Telnet 등 다양한 프로토콜로 PHP 프로그램과 원격 서버를 연결해 주는 오픈 소스 라이브러리다. HTTP POST, HTTP GET, HTTP PUT 등과 같은 작업을 수행하는 다양한 껍데기(Wrapper) 함수를 제공한다. cURL 함수를 사용하려면 PHP 환경에서 libcurl 패키지를 활성화해야 한다. 젠드 코어 서버는 관리 프로그램에서 마우스 클릭 한 번으로 cURL을 활성화할 수 있다. SimpleXML은 또 다른 PHP 확장 기능이다. 이름이 드러내듯이, XML 문서를 읽거나 쓰기에 편리한 기능을 제공한다. PHP 버전 5 이상에서는 이 기능이 기본으로 활성화되어 있다. 배열은 PHP가 제공하는 기본 기능으로, 배열을 사용하면 집합이라는 자료 구조를 다루기가 매우 쉬워진다. 여기서는 RSS 피드 항목 결과를 수집할 때 PHP 배열을 사용한다. 피드 리더 컴포넌트를 구현한 PHP 소스 코드는
이어지는 문단에서 각 함수에 들어가는 코드를 상세히 설명한다. 게다가 논리 구조에 대한 이해를 돕고자 원시 코드 자체에도 주석을 충분히 달았다. Listing 3에서 보듯이,
이 함수에 대한 논리를 뜯어보면 perform_curl_operation 함수를 호출하여 cURL 네트워크 작업을 수행하는데, Listing 3. get_rss_feeds 함수
Listing 4에서 보듯이, Listing 4. perform_curl_operation 함수
Listing 5에서 보듯이, 가장 먼저, Listing 5. parse_rss_feed_xml 함수
여기까지 피드 리더 컴포넌트가 수행하는 주요 작업을 모두 둘러보았다. 다음으로 피드 소스 입력 컴포넌트를 살펴보자. 피드 소스 입력 컴포넌트는 이 시스템에서 가장 간단한 컴포넌트다. 단순히 사용자가 지정하는 피드 소스 목록을 읽어들이면 된다. 컴포넌트에 속하는 함수는 하나 뿐인데, 프로그램을 시작하면 피드 수집기가 가장 먼저 이 함수를 호출한다. 기사 초반에 언급했듯이, 피드 소스 정보는 프로그램 자료 구조나 데이터베이스 테이블이나 파일 등 어떤 형태로 지정해도 괜찮다. 여기서는 피드 소스 정보를 XML 파일로 입력 받는다고 가정한다. 함수 논리를 살펴보면 함수 입력 인수로 넘어온 이름을 사용해 단순히 파일 내용을 읽는다. 그리고 XML 파일 내용을 읽어 호출자에게 문자열을 반환한다. 앞서 언급했듯이, 이 컴포넌트는 피드 수집기 컴포넌트와 함께 rss_feed_aggregator.php 파일에 들어 있다. Listing 6은 피드 소스 입력 파일 내용을 읽어들이는 간단한 함수다. Listing 6. get_list_of_rss_feed_sources 함수
피드 소스 입력 파일은 피드 제공자 이름, 피드 제공자 URL, 피드 제공자로부터 가져올 사용자 지정 최대 RSS 피드 항목 수를 포함한다. 각 정보는 해당 XML 요소 안에 들어 있다. Listing 7은 피드 소스 입력 XML 파일 형식을 보여준다. Listing 7. 피드 소스 입력 XML 파일 형식
피드 수집기 컴포넌트는 이 기사의 목적에 부합하도록, 즉 사용자 정의 가능한 RSS 피드 수집 기능을 수행하도록 피드 리더 컴포넌트를 감싸는 껍데기 컴포넌트다. 이 컴포넌트는 앞서 설명한 SimpleXML PHP 확장 기능을 사용하며, 여러 RSS 피드를 수집하는 간단한 논리도 맞춤식으로 구현한다. 소스 파일은 rss_feed_aggregator.php다. Listing 8에서 보듯이, 피드 수집기 컴포넌트는 Listing 8. aggregate_rss_feeds 함수
피드 결과 출력 컴포넌트는 RSS 피드 결과를 저장한다. 이 컴포넌트 역시 함수 하나로 이루어져 있으며, 피드 수집기는 RSS 피드 내용으로부터 모든 피드 항목을 추출한 후 이 함수를 호출한다. 기사 앞 부분에서 설명했듯이, RSS 피드 결과는 브라우저나 다른 응용 프로그램으로 보내도 무방하고, 아니면 프로그램 자료 구조나 데이터베이스 테이블이나 파일에 저장해도 무방하다. 여기서는 가져온 피드 결과를 피드 제공자별로 각각 다른 파일에 저장한다. 모든 결과 파일은 feed_results라는 디렉터리 아래 저장되는데, 이 디렉터리는 피드 수집기 프로그램이 실행되는 디렉터리 아래 자동으로 생성된다. Listing 9에서 보듯이, 피드 결과를 출력하는 함수인 a[0] = RSS 피드 제공자 이름 a[2], a[3], a[4]라는 세 배열에서 색인이 같은 요소 값을 모으면 RSS XML 내용에서 특정 피드 항목에 대한 관련 정보가 모두 드러난다. 예를 들어, rss_feed_title_array[0], rss_feed_url_array[0], rss_feed_description_array[0]을 합치면 RSS XML 내용에서 첫 번째 피드 항목에 대한 정보가 완성된다. 가장 먼저, store_rss_feed_results 함수는 feed_results 하위 디렉터리를 생성한다. 물론, 디렉터리가 존재하지 않는 경우에 한해서다. 다음으로, 주어진 RSS 피드 제공자에 고유한 파일 이름을 생성한다. 그런 다음, 루프를 돌면서 결과 배열에서 RSS 피드 항목 정보를 하나씩 꺼내서 파일에 쓴다. 지금쯤이면 익숙하겠지만, 각 RSS 피드 항목은 피드 제목, 피드 전체 이야기가 담긴 URL, 간단한 설명을 포함한다. 이러한 피드 항목 정보를 토대로 정보 소비자는 선택한 범주에 속하는 피드 제목과 설명을 짧은 시간 내에 훑어볼 수 있다. 그러다 관심 가는 항목이 있으면 URL을 따라가 자세한 정보를 확인하면 된다. RSS 피드 수집기는 정보 소비자에게 이러한 장점을 제공한다. Listing 9. store_rss_feed_results 함수
이상으로 프로그램 컴포넌트를 기능적으로 모두 살펴보았다. 컴포넌트가 서로 연계하여 동작하는 방식을 이해했으리라 믿는다. 다음으로 RSS 피드 수집기를 직접 실행해 보자. 다운로드 절에서 zip 파일을 다운로드 받을 수 있다. Zip 파일에는 다음 소스 파일이 들어 있다.
먼저, 파일 압축을 푼다. 프로그램을 실행하려면 젠드 코어와 같은 PHP 환경에서 cURL과 SimpleXML을 활성화해야 한다는 사실에 주의한다. 제공하는 파일 중 rss_feed_sources.xml 파일은 RSS 피드 소스 22개를 포함하는 예제 XML 파일이다. 이 예제 파일은 비즈니스와 재정 범주/채널에 속하는 피드 소스를 포함한다. 원한다면 직접 XML 파일을 정의해도 좋다. RSS 피드 수집기를 실행하려면 다음 명령을 수행한다. (명령 뒷부분 마지막 인수는 옵션이다.)
앞서 설명했듯이, 명령행 인수를 주지 않으면 응용 프로그램은 기본 피드 소스 입력 XML 파일인 rss_feed_sources.xml 파일을 사용한다. 이 기본 피드 소스 입력 XML 파일을 사용하여 문제 없이 실행했다고 가정하면 그림 3과 같은 결과를 얻게 된다. 그림 3. RSS 피드 수집기를 실행한 결과 RSS 피드 수집기를 실행한 디렉터리 내에는 feed_results라는 하위 디렉터리가 생긴다. 또한 feed_results 하위 디렉터리 내에 존재하는 파일은 (사용자가 지정하는 피드 소스 입력 XML 파일에 포함된) 각 RSS 피드 제공자에게서 가져온 RSS 피드 항목을 포함한다. RSS는 나온 지 꽤나 오래 되었다. 그러나 근래에 이르러서야 웹, 블로그, 매시업, 소셜 네트워킹 포탈, 기타 정보 수집 서비스 등 웹 2.0 기술이 도래하면서 커다란 인기를 끌고 있다. 이 기사는 RSS 형식이 제공하는 단순성을 한 눈에 보여준다. 이러한 단순성 덕택에 RSS는 새로운 웹 기술들이 서로 정보를 교환하고 통합하기에 아주 적합한 수단이다. 웹은 정보가 핵심이므로 RSS는 앞으로도 웹에서 정보를 배포하고 퍼트리는 방식에 긍정적이고도 커다란 영향력을 발휘하리라 생각한다. 이 기사는 PHP로 피드 수집기를 개발하는 방법을 상세히 설명하며, 완전히 돌아가는 PHP 코드도 제공한다. 여기서 제공하는 소스 코드는 여러 가지 방식으로 활용할 수 있겠다. 단독형 도구로 사용해도 좋고, 기존 PHP 서버측 프로그램에서 사용하는 공유 라이브러리로 사용해도 좋고, 기업 SOA(Service Oriented Architecture)에 들어가는 SOAP/REST 웹 서비스 함수로 사용해도 좋겠다. 웹에는 단순하고도 멋진 기술이 많다. RSS는 단순히 이러한 기술 중 하나일 뿐이다. 악의나 농담은 없다!
|
"Ecommerce RSS" Module Specification (ERSS) v1.0
Purpose
The ecommerce namespace is an RSS module that extends the capabilities of RSS 2.0 to allow for more robust ecommerce syndication through standardization.
Change Notes
13 / October / 2006 ? Created.
1 / November / 2006 ? Moderate node and attribute additions for better syndication.
- Added <ecommerce:shipping> element for item shipping details.
- Added <ecommerce:condition> element for identification of item condition.
- Added <ecommerce:auction> element for establishing item as an auction.
- Added upc attribute to <ecommerce:sku> element for univeral product code.
- Added model attribute to <ecommerce:manufacturer> element for manufacturer number identification.
- Removed <ecommerce:productId> element due to its ambiguity.
Namespace Declaration
The namespace for the ecommerce RSS module is defined to be: http://shopping.discovery.com/erss
For example:
<rss version="2.0" xmlns:ecommerce="http://shopping.discovery.com/erss">
Principal Node Elements
<ecommerce:listPrice>_____</ecommerce:listPrice>
<ecommerce:listPrice> is a sub-element of <item>. It is the value or current price of the item. The value is typically a number expressed in the local currency without a dollar sign. It has one optional attribute.
<ecommerce:listPrice currency="USD">1,200.00</ecommerce:listPrice>
- currency specifies the local unit of currency, conforming to the ISO 4217 specification; if not present, default "USD". It is an optional attribute.
<ecommerce:SKU>_____</ecommerce:SKU>
<ecommerce:SKU> is a sub-element of <item>. A SKU or stock keeping unit is an identifier that is used by merchants to permit the systematic tracking of products and services offered to customers. (It can be pronounced as either "skew" or "ess-kay-you".) Usage of the SKU system is rooted in the drill down method, pertaining to data management. SKUs are assigned and serialized at the merchant level. Each SKU is attached to an item, variant, product line, bundle, service, fee or attachment. The value is typically a string of alphanumeric characters that may include dashes. It has one optional attribute.
<ecommerce:SKU UPC="0-543698-986745-1">986745</ecommerce:SKU>
- UPC or universal product code is one of a wide variety of bar code languages called symbologies which encodes twelve decimal digits. It is an optional attribute.
Optional Node Elements
<ecommerce:auction />
<ecommerce:auction> is a sub-element of <item> and is self terminating. It identifies the item as an auction rather then a set item of fixed price. It has two required and two optional attributes.
<ecommerce:auction bids="0" endDate="Sat, 07 Sep 2002 00:00:01 GMT" buyNowPrice="49.50" currency="USD" />
- bids specifies the number of bids the item has recieved. It is a required attribute.
- endDate specifies the date the auction ends. RFC 822 specification. It is a required attribute.
- buyNowPrice specifies the value or buy now price of the item. The value is typically a number expressed in the local currency without a dollar sign. It is an optional attribute.
- currency specifies the local unit of currency, conforming to the ISO 4217 specification; if not present, default "USD". It is an optional attribute.
<ecommerce:condition>_____</ecommerce:condition>
<ecommerce:condition> is a sub-element of <item>. The value indicates the condition of the item and can be expressed as "new", "used" or "refurbished".
<ecommerce:condition>new</ecommerce:condition>
<ecommerce:manufacturer>_____</ecommerce:manufacturer>
<ecommerce:manufacturer> is a sub-element of <item>. It is the company that manufactured or fabricated the item. It has one optional attribute.
<ecommerce:manufacturer model="55HD-LCOS/19.5">Panasonic</ecommerce:manufacturer>
- model specifies the identification assigned to the item by the manfacturer. It is a optional attribute.
<ecommerce:mass />
<ecommerce:mass> is a sub-element of <item> and is self terminating. It has two required attributes.
<ecommerce:mass unit="ounces" weight="4" />
- unit specifies the local unit of measurment. It is a required attribute.
- weight specifies the weight of the item. It is a required attribute.
<ecommerce:offerPrice>_____</ecommerce:offerPrice>
<ecommerce:offerPrice> is a sub-element of <item>. It is the value or offer price of the item. The value is typically a number expressed in the local currency without a dollar sign. It has one optional attribute.
<ecommerce:offerPrice currency="USD">899.95</ecommerce:offerPrice>
- currency specifies the local unit of currency, conforming to the ISO 4217 specification; if not present, default "USD". It is an optional attribute.
<ecommerce:promoText>_____</ecommerce:promoText>
<ecommerce:promoText> is a sub-element of <item>. Promo text is used to supplement the <description> node with descriptive promotional text about the item. The value is typically a sentence in length. It has one optional attribute.
<ecommerce:promoText type="plain">On sale now for only 24 hours!</ecommerce:promoText>
- type specifies the type of text embedded. Possible values are either "plain" or "html". Default value is "plain". All html must be entity-encoded. It is an optional attribute.
<ecommerce:rating />
<ecommerce:rating> is a sub-element of <item> and is self terminating. It has two required attributes.
<ecommerce:rating possible="5" scored="3" />
- possible specifies the highest possible score or rating for the item. It is a required attribute.
- scored specifies the current score or rating of the item. It is a required attribute.
<ecommerce:shipping>_____</ecommerce:shipping>
<ecommerce:shipping> is a sub-element of <item>. Offers details about shipping of the item.
<ecommerce:shipping>Ground, 2nd day and next day air available.</ecommerce:shipping>
<ecommerce:size />
<ecommerce:size> is a sub-element of <item> and is self terminating. It has one required and three optional attributes.
<ecommerce:size unit="inches" width="5.25" height="7.75" depth="0.75" />
- unit specifies the local unit of measurment. It is a required attribute.
- width specifies the width of the item. It is an optional attribute.
- height specifies the height of the item. It is an optional attribute.
- depth specifies the depth of the item. It is an optional attribute.
<ecommerce:stockAvailability>_____</ecommerce:stockAvailability>
<ecommerce:stockAvailability> is a sub-element of <item>. The current availability of a item. The value can be expressed as "available" or "out of stock". It has one optional attribute.
<ecommerce:stockAvailability quanity="1342">available</ecommerce:stockAvailability>
- quanity specifies the amount of items that are available. Possible values are whole integers starting from "0". It is an optional attribute.
Examples
- A basic / minimal ERSS feed.
<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:ecommerce="http://shopping.discovery.com/erss"> <channel> <title>Discovery Channel Store</title> <description>Find educational toys and other unique gift ideas at the Discovery Channel Store online.</description> <link>http://shopping.discovery.com</link> <pubDate>Wed, 18 Oct 2006 01:00:36 GMT</pubDate> <item> <title>Ice Age Columbus: Who Were the First Americans?</title> <description>Chart the epic journey of Stone Age hunters from their homeland in France to their ...</description> <link>http://shopping.discovery.com/servlet/Jumpzone?product=0-54369-9867454-17&ti=000454</link> <ecommerce:listPrice>19.95</ecommerce:listPrice> <ecommerce:SKU UPC="0-543698-986745-1">986745</ecommerce:SKU> <category>DVD</category> <pubDate>Tue, 17 Oct 2006 15:49:36 GMT</pubDate> </item> ... </channel> </rss>
- An expanded ERSS + MRSS feed.
<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:ecommerce="http://shopping.discovery.com/erss" xmlns:media="http://search.yahoo.com/mrss"> <channel> <title>Discovery Channel Store</title> <description>Find educational toys and other unique gift ideas at the Discovery Channel Store online.</description> <link>http://shopping.discovery.com</link> <pubDate>Wed, 18 Oct 2006 01:00:36 GMT</pubDate> <item> <title>Ice Age Columbus: Who Were the First Americans?</title> <description>Chart the epic journey of Stone Age hunters from their homeland in France to their ...</description> <ecommerce:promoText>On sale NOW!</ecommerce:promoText> <link>http://shopping.discovery.com/servlet/Jumpzone?product=0-54369-9867454-17&ti=000454</link> <media:thumnail url="http://shopping.discovery.com/images/products/small/54369.gif" width="100" height="100" /> <ecommerce:listPrice>19.95</ecommerce:listPrice> <ecommerce:offerPrice>15.95</ecommerce:offerPrice> <ecommerce:rating possible="5" scored="3" /> <ecommerce:SKU UPC="0-543698-986745-1">986745</ecommerce:SKU> <ecommerce:stockAvailability quanity="245">available</ecommerce:stockAvailability> <ecommerce:mass unit="ounces" weight="4" /> <ecommerce:size unit="inches" width="5.25" height="7.75" depth="0.75" /> <ecommerce:manufacturer>Sony</ecommerce:manufacturer> <category>DVD</category> <pubDate>Tue, 17 Oct 2006 15:49:36 GMT</pubDate> </item> ... </channel> </rss>
- A search api ERSS + MRSS + OpenSearch feed.
<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:ecommerce="http://shopping.discovery.com/erss" xmlns:media="http://search.yahoo.com/mrss" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"> <channel> <title>Discovery Channel Store :: Search :: term term ...</title> <description>Find educational toys and other unique gift ideas at the Discovery Channel Store online.</description> <link>http://shopping.discovery.com</link> <opensearch:totalResults>25408</opensearch:totalResults> <opensearch:startIndex>1</opensearch:startIndex> <opensearch:itemsPerPage>10</opensearch:itemsPerPage> <opensearch:Query role="request" searchTerms="term+term+..." /> <pubDate>Wed, 18 Oct 2006 01:00:36 GMT</pubDate> <item> <title>Ice Age Columbus: Who Were the First Americans?</title> <description>Chart the epic journey of Stone Age hunters from their homeland in France to their ...</description> <ecommerce:promoText>On sale NOW!</ecommerce:promoText> <link>http://shopping.discovery.com/servlet/Jumpzone?product=0-54369-9867454-17&ti=000454</link> <media:thumnail url="http://shopping.discovery.com/images/products/small/54369.gif" width="100" height="100" /> <ecommerce:listPrice>19.95</ecommerce:listPrice> <ecommerce:offerPrice>15.95</ecommerce:offerPrice> <ecommerce:rating possible="5" scored="3" /> <ecommerce:SKU UPC="0-543698-986745-1">986745</ecommerce:SKU> <ecommerce:stockAvailability quanity="245">available</ecommerce:stockAvailability> <ecommerce:mass unit="ounces" weight="4" /> <ecommerce:size unit="inches" width="5.25" height="7.75" depth="0.75" /> <ecommerce:manufacturer>Sony</ecommerce:manufacturer> <category>DVD</category> <pubDate>Tue, 17 Oct 2006 15:49:36 GMT</pubDate> </item> ... </channel> </rss>
- A search api ERSS + MRSS + OpenSearch auction feed.
<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:ecommerce="http://shopping.discovery.com/erss" xmlns:media="http://search.yahoo.com/mrss" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"> <channel> <title>Discovery Channel Store :: Search :: term term ...</title> <description>Find educational toys and other unique gift ideas at the Discovery Channel Store online.</description> <link>http://shopping.discovery.com</link> <opensearch:totalResults>25408</opensearch:totalResults> <opensearch:startIndex>1</opensearch:startIndex> <opensearch:itemsPerPage>10</opensearch:itemsPerPage> <opensearch:Query role="request" searchTerms="term+term+..." /> <pubDate>Wed, 18 Oct 2006 01:00:36 GMT</pubDate> <item> <title>Ice Age Columbus: Who Were the First Americans?</title> <description>Chart the epic journey of Stone Age hunters from their homeland in France to their ...</description> <ecommerce:promoText>On sale NOW!</ecommerce:promoText> <link>http://shopping.discovery.com/servlet/Jumpzone?product=0-54369-9867454-17&ti=000454</link> <media:thumnail url="http://shopping.discovery.com/images/products/small/54369.gif" width="100" height="100" /> <ecommerce:auction bids="5" endDate="Tue, 24 Oct 2006 15:49:36 GMT" buyNowPrice="14.99" /> <ecommerce:listPrice>5.35</ecommerce:listPrice> <ecommerce:SKU UPC="0-543698-986745-1">986745</ecommerce:SKU> <ecommerce:mass unit="ounces" weight="4" /> <ecommerce:size unit="inches" width="5.25" height="7.75" depth="0.75" /> <ecommerce:manufacturer>Sony</ecommerce:manufacturer> <category>DVD</category> <pubDate>Tue, 17 Oct 2006 15:49:36 GMT</pubDate> </item> ... </channel> </rss>
Acknowledgements
Thank you to everyone who has contributed to this specification, and to all those that sent suggestions and corrections.
The base RSS version 2.0 Specification can be found within the Harvard Law Blogs.
The YAHOO! MRSS Module @ http://search.yahoo.com/mrss.
The A9.com OpenSearch Module @ http://www.opensearch.org.