How to do it...

The overall structure should be familiar to anyone who has seen HTML. Apart from the first two lines, which define the version and formatting of the XML, the information is structured with opening and closing tags; consider the following example:

 <link>http://www.bbc.co.uk/news/world-latin-america-38118739</link>

The name of the opening tag defines the contents of this element of XML; in this case, it is a link. Then follows the content of the element, and the end of the content is defined by a closing tag that has a / before its name.

In addition to this simple example, an XML element can have attributes that describe extra information about the content of the element:

 <guid isPermaLink="true">http://www.bbc.co.uk/news/world-latin-america-38118739 ...

Get Swift 4 Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.