A PSFeed object is used for managing RSS and Atom feeds. Each feed object represents
a single feed. Feed objects can either be created for subscription or parsing. To subscribe to
a feed, use initWithURL: and then add the newly returned feed object to a client. To use Publication
Subscription to simply parse a feed, download the feed with NSURL and then use initWithData:URL:.
Many of the feed's attributes are defined by the RSS 2.0 and Atom 1.0 specs. Any
attributes defined by the specifications (or nonstandard extensions) that do not appear
in this API can be retrieved using the XMLRepresentation method.
Since the values of the RSS and Atom attributes are derived from data received
from the server, they may be missing or incorrect. If you have the opportunity, use
attributes generated by the Publication Subscription framework, as it is more reliable.
For example, using updatedDate to find entries that have been modified
since a certain time would be unreliable. Use receivedDate instead. It
is not recommended that you subclass PSFeed.
An array containing a sort descriptor for sorting the feed's entries.
Return Value
An enumerator containing each of the feed's entries, sorted by the given
sort descriptors.
Discussion
This method allows the entries to be loaded into memory one at a time, which
can make it more efficient than the regular entries method. (However, you
also need to wrap your enumeration loop in an autorelease pool
and drain the pool at the end of the loop. Otherwise, prior entries will not
be deallocated until sometime after the loop finishes.)
If sortDescriptors is empty or nil, the entries will not be sorted.
The namespace of the extension XML elements; pass nil to receive
all extension XML elements.
Return Value
An array of NSXMLElement objects containing the appropriate extension XML elements.
Discussion
Pass nil for nameSpace to get all extension XML elements,
regardless of their namespace. This works at the feed-level only. You can use
the same method on an entry to retrieve extension XML elements at that level.
When using the nameSpace parameter, make sure to pass a full namespace, such as
http://www.itunes.com/dtds/podcast-1.0.dtd, instead of the namespace prefix.
A data object containing the feed. This object can be obtained by using NSURL
or NSURLConnection to download the feed in its entirety.
aURL
The URL of the feed.
Return Value
A feed parsed from the specified data.
Discussion
This method does not cause any network activity. The feed is parsed directly from the
provided XML data. The URL parameter is required only to resolve relative URLs, and
for future reference if this object is later subscribed to.
See the discussion under the initWithURL: method for more information about
temporary feeds.
This method does not cause any network activity. The feed's entries and metadata
will not be available until the feed is added to a client (via the
addFeedWithURL: method of PSClient) or its update method is called, and the feed has been
downloaded and parsed.
Temporary feeds are not associated with any PSClient, and their contents will
not be stored persistently. If desired, this feed can later be made persistent and
'subscribed to' by calling addFeed: on a PSClient object.
Temporary feeds are not automatically updated on a schedule. Instead, you must
call "update" whenever you want to check for updates.
If any immediate problem is encountered, this method returns NO and sets the error parameter.
However, refreshing is an asynchronous operation, and errors are more likely to show up later.
These can be accessed via the feed's latestError property after it sends a notification
that it's ended refreshing.
To check on the status of the refresh, register for the PSFeedRefreshingNotification notification
and then check the isRefreshing property.
The password is stored in the user's default keychain, associated with this feed's
URL.
There is intentionally no corresponding getPassword method, because only PubSub
itself needs to access the password.
This method is optional. If no password is found in the keychain when the feed
is being updated, Publication Subscription will prompt the user for one, and
add it to the keychain. However, your application's UI may want to let the user
enter the password at the same time as he enters the user name.
This method attempts to communicate with the PubSubAgent process and causes the agent
to launch if it is not already running. If PubSubAgent cannot be contacted, an exception
will be thrown with the name PSException. To avoid problems, you should
always be prepared to catch an exception thrown by this method.
A boolean value to determine whether or not the resulting NSXMLElement object will
contain the entry and article elements.
Return Value
The raw feed.
Discussion
The raw feed data is parsed into a DOM tree, and the root element ( or )
is returned. No other processing is performed.
Setting the withEntries flag to NO causes the or elements to be
stripped out; other nonstandard child elements are kept, however.
Traditionally, the alternate URL corresponds to the homepage associated with the feed. The URL is parsed from the element in Atom and the element in RSS.
The date is stored in the feed and set by the software that creates it. Therefore, it is associated with the feed's server, not the machine your application is running on. The returned date corresponds to the element in Atom and the element in RSS.
Icons should have an aspect ratio of 1:1 and be suitable for presentation at a small size. The URL corresponds to the element in Atom. There is no RSS equivalent.
This identifier can be used as a key to map between PSFeed objects and your application's own data model objects.
This identifier is generated internally by the Publication Subscription framework. You should not make any assumptions about its format or size, as they may change.
Although Atom defines a mandatory element, it cannot be used for this purpose since the RSS equivalent () is optional. Thus, Publication Subscription uses its own mechanism for uniquely identifying feeds. Clients can manually parse the XMLRepresentation if they need the Atom element or RSS element.
Feeds and HTML pages can contain both "link" tags (that define explicit links to
other URLs) and the purposes of those links. This is often used for
"autodiscovery", where a web page contains a link to its feed.
Even though Atom states that logos should have an aspect ratio of 2:1, RSS prefers a default size of 88 x 31 pixels. The returned URL corresponds to the element in Atom and the element in RSS.
If this property returns a value of NO, this may be because the feed has finished refreshing or because the feed
has not started refreshing. To get more accurate output, register for the PSFeedRefreshingNotification notification
and then call this method.
The client's settings are used whenever a feed's settings are undefined.
This property attempts to communicate with the PubSubAgent process and causes the agent
to launch if it is not already running. If PubSubAgent cannot be contacted, an exception
will be thrown with the name PSException. To avoid problems, you should
always be prepared to catch an exception thrown by this property.