3.2 Feed Elements
The first section of the SData feed contains standard Atom feed elements:
<?xml version="1.0" encoding="UTF-8" ?> <feed xmlns:sdata="http://schemas.sage.com/sdata/2008/1" xmlns:http="http://schemas.sage.com/sdata/http/2008/1" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:sle="http://www.microsoft.com/schemas/rss/core/2005" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2005/Atom"> <title>Sage App | Sales Orders</title> <id>http://www.example.com/sdata/myApp/myContract/-/salesOrders</id> <updated>2008-03-31T13:46:45Z</updated> <author> <name>myApp</name> </author>
The first line <?xml … ?> is the standard processing instruction for XML documents. This line is OPTIONAL in SData because the content type and character encoding should also be passed via the Content-Type HTTP header. This optional element will be omitted in most examples.
It is important to note that SData imposes UTF-8 encoding for all XML content. For more information, see the Localization section.
The Atom feed comes next. Its elements should be set as follows:
Element | Value | Compliance |
---|---|---|
title | A friendly title for the feed (localized). It is good practice to include the application name in the title. It gives context when the feed is displayed in a browser or a feed reader. | MUST |
id | Feed URL. | MUST |
updated | The time the feed content was last modified. Otherwise the time the feed was produced. | MUST |
author | The author of the feed. It should have at least a <name> child element. According to the Atom standard, the name should be a person's name, which is difficult to fulfill in the SData context. So, SData providers can fill the name with the application name. | SHOULD |
The <author> element is not very meaningful in the SData context but the Atom specification requires that it be present. So, SData providers SHOULD include it because some Atom processors may require it. On the other hand, SData providers and consumers MUST NOT generate an error if this element is missing in a feed or entry that they receive. Atom also requires that feeds and entries have a <summary> element but the Atom specification explicilty states that Atom processors must not fail if the summary is missing. So, SData does not impose that it be present.
SData providers MUST return feeds in Atom format by default and MUST follow the above rules.