PSLink

Framework:
/System/Library/Frameworks/PubSub.framework
Inherits from:
Declared In:
See Also:

Overview

A PSLink object represents an explicitly declared link from a feed or HTML document to a document at another URL. These links are declared by means of elements in the source document.

Links serve several purposes, the most common of which is "autodiscovery": a way to automatically locate the feeds associated with a particular web page. If a PSFeed object parses a document that turns out to be an HTML page instead of an Atom or RSS feed, the feed object's feedFormat will be PSUnknownFormat, but its links method will return an array of PSLink objects representing all of the tags found in the HTML. Most HTML pages that belong to a website that serves feeds will contain links of type PSLinkToAtom or PSLinkToRSS. If you find these, you can use their URLs to initialize a new PSFeed object which will parse the actual feed. It is not recommended that you subclass PSLink.



Methods

+linksInXML:baseURL:

Returns an array of links objects, one for each link found in an XML tree.


linksInXML:baseURL:


Returns an array of links objects, one for each link found in an XML tree.

+ (NSArray*) linksInXML: (NSXMLElement*)root baseURL: (NSURL*)baseURL; 
Parameters
root

The root element of the parsed XMLDocument.

baseURL

An optional absolute URL, used to interpret relative URLs in links. If provided, the URL accessors of all returned PSLink objects will always return absolute URLs.

Return Value

An array of PSLink objects, one for each link found in the XML tree.

Discussion

Use this method if you have retrieved an XML (or HTML) document without creating a PSFeed object and want to examine it for links. If you just want to find the links from a PSFeed object, call its links method instead.

Availability
Introduced in Mac OS X v10.5.

Properties

linkKind

The format of the linked-to document. (read-only)

MIMEType

The MIME type of the linked-to document. (read-only)

relations

The set of relations declared by the element. (read-only)

title

The human-readable title of the link, if it exists. (read-only)

URL

The URL linked to. (read-only)


linkKind


The format of the linked-to document. (read-only)

@property (
    readonly) PSLinkKind linkKind; 
Discussion

The type of a link is derived by looking at the relations, title, and MIME type, as defined by the relevant specifications.

Availability
Introduced in Mac OS X v10.5.

MIMEType


The MIME type of the linked-to document. (read-only)

@property (
    readonly) NSString *MIMEType; 
Discussion

In HTML and Atom documents, this is the value of the type attribute. Links in RSS documents have no MIME type.

Availability
Introduced in Mac OS X v10.5.

relations


The set of relations declared by the element. (read-only)

@property (
    readonly) NSSet *relations; 
Discussion

This value is derived from the rel attribute, as defined by the HTML and Atom specifications. The value of the attribute is split into words at whitespace boundaries, and the individual words lowercased to facilitate case-insensitive comparison.

The default value of this method, if no rel attribute exists, is a set containing the string alternate.

Availability
Introduced in Mac OS X v10.5.

title


The human-readable title of the link, if it exists. (read-only)

@property (
    readonly) NSString *title; 
Discussion

In HTML and Atom documents, this is the value of the title attribute. Links in RSS documents have no title.

Availability
Introduced in Mac OS X v10.5.

URL


The URL linked to. (read-only)

@property (
    readonly) NSURL *URL; 
Discussion

In HTML and Atom documents, this is the value of the href attribute. In RSS documents, it is the content of the element.

Availability
Introduced in Mac OS X v10.5.

 

Last Updated: 2009-08-12