SwiftSoup/Tests-macOS/corpus/GitHub.html

1699 lines
182 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="dns-prefetch" href="https://github.githubassets.com">
<link rel="dns-prefetch" href="https://avatars0.githubusercontent.com">
<link rel="dns-prefetch" href="https://avatars1.githubusercontent.com">
<link rel="dns-prefetch" href="https://avatars2.githubusercontent.com">
<link rel="dns-prefetch" href="https://avatars3.githubusercontent.com">
<link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com">
<link rel="dns-prefetch" href="https://user-images.githubusercontent.com/">
<link crossorigin="anonymous" media="all" integrity="sha512-RPWwIpqyjxv5EpuWKUKyeZeWz9QEzIbAWTiYOuxGieUq7+AMiZbsLeQMfEdyEIUoNjLagHK0BEm92BmXnvaH4Q==" rel="stylesheet" href="https://github.githubassets.com/assets/frameworks-40c1c9d8ff06284fb441108e6559f019.css" />
<link crossorigin="anonymous" media="all" integrity="sha512-FIEp4ofjNZOwIuaCNdkF6w53h1fjud2bVTkAOnOQOL3+uw98WLUVoh+QIC6gJ/fWDkIeNNwkc/+gyn8NUJiWZw==" rel="stylesheet" href="https://github.githubassets.com/assets/site-2a37b0558327c9981d25e3ed83ae9eec.css" />
<link crossorigin="anonymous" media="all" integrity="sha512-K0JRkCJvOIeaO/A3nL6b85UBOxVBCU9Kxbm+e8glZcfog2ina8C8V1B8z0wpeMwZFCLPzo7A5aMKdQIwQ7XyXQ==" rel="stylesheet" href="https://github.githubassets.com/assets/github-3a8466323664b20900b92b0008129619.css" />
<meta name="viewport" content="width=device-width">
<title>GitHub - scinfu/SwiftSoup: SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)</title>
<meta name="description" content="SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS) - scinfu/SwiftSoup">
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">
<link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
<meta property="fb:app_id" content="1401488693436528">
<meta property="og:image" content="https://avatars1.githubusercontent.com/u/201132?s=400&amp;v=4" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="scinfu/SwiftSoup" /><meta property="og:url" content="https://github.com/scinfu/SwiftSoup" /><meta property="og:description" content="SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS) - scinfu/SwiftSoup" />
<link rel="assets" href="https://github.githubassets.com/">
<meta name="pjax-timeout" content="1000">
<meta name="request-id" content="AB2C:0576:8B81A0:D75D37:5C75AFFC" data-pjax-transient>
<meta name="selected-link" value="repo_source" data-pjax-transient>
<meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU">
<meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA">
<meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc">
<meta name="octolytics-host" content="collector.githubapp.com" /><meta name="octolytics-app-id" content="github" /><meta name="octolytics-event-url" content="https://collector.githubapp.com/github-external/browser_event" /><meta name="octolytics-dimension-request_id" content="AB2C:0576:8B81A0:D75D37:5C75AFFC" /><meta name="octolytics-dimension-region_edge" content="sea" /><meta name="octolytics-dimension-region_render" content="iad" />
<meta name="analytics-location" content="/&lt;user-name&gt;/&lt;repo-name&gt;" data-pjax-transient="true" />
<meta name="google-analytics" content="UA-3769691-2">
<meta class="js-ga-set" name="dimension1" content="Logged Out">
<meta name="hostname" content="github.com">
<meta name="user-login" content="">
<meta name="expected-hostname" content="github.com">
<meta name="js-proxy-site-detection-payload" content="MDA0MzBiZjZhYzEyM2E3YTY2MzhlMWMxNWQxMDg3M2E1NTZmMzcxN2U3MmFjMzA0M2RlY2I0NDY4N2JlNTEyZnx7InJlbW90ZV9hZGRyZXNzIjoiNzMuOTcuMTM3LjMwIiwicmVxdWVzdF9pZCI6IkFCMkM6MDU3Njo4QjgxQTA6RDc1RDM3OjVDNzVBRkZDIiwidGltZXN0YW1wIjoxNTUxMjE2NjM5LCJob3N0IjoiZ2l0aHViLmNvbSJ9">
<meta name="enabled-features" content="UNIVERSE_BANNER,MARKETPLACE_SOCIAL_PROOF,MARKETPLACE_PLAN_RESTRICTION_EDITOR,MARKETPLACE_BROWSING_V2">
<meta name="html-safe-nonce" content="0968b02e278b215c141b72c6114dd176a9a54737">
<meta http-equiv="x-pjax-version" content="523196713fc34cc9c6f75bf01b85123d">
<link href="https://github.com/scinfu/SwiftSoup/commits/master.atom" rel="alternate" title="Recent Commits to SwiftSoup:master" type="application/atom+xml">
<meta name="go-import" content="github.com/scinfu/SwiftSoup git https://github.com/scinfu/SwiftSoup.git">
<meta name="octolytics-dimension-user_id" content="201132" /><meta name="octolytics-dimension-user_login" content="scinfu" /><meta name="octolytics-dimension-repository_id" content="74174143" /><meta name="octolytics-dimension-repository_nwo" content="scinfu/SwiftSoup" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="74174143" /><meta name="octolytics-dimension-repository_network_root_nwo" content="scinfu/SwiftSoup" /><meta name="octolytics-dimension-repository_explore_github_marketplace_ci_cta_shown" content="false" />
<link rel="canonical" href="https://github.com/scinfu/SwiftSoup" data-pjax-transient>
<meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
<meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
<link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000">
<link rel="icon" type="image/x-icon" class="js-site-favicon" href="https://github.githubassets.com/favicon.ico">
<meta name="theme-color" content="#1e2327">
<link rel="apple-touch-icon" href="https://github.githubassets.com/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://github.githubassets.com/apple-touch-icon-180x180.png">
<meta name="apple-mobile-web-app-title" content="GitHub">
<link rel="manifest" href="/manifest.json" crossOrigin="use-credentials">
</head>
<body class="logged-out env-production false">
<div class="position-relative js-header-wrapper ">
<a href="#start-of-content" tabindex="1" class="px-2 py-4 bg-blue text-white show-on-focus js-skip-to-content">Skip to content</a>
<div id="js-pjax-loader-bar" class="pjax-loader-bar"><div class="progress"></div></div>
<header class="Header header-logged-out position-relative f4 py-3" role="banner">
<div class="container-lg d-flex px-3">
<div class="d-flex flex-justify-between flex-items-center">
<a class="mr-4" href="https://github.com/" aria-label="Homepage" data-ga-click="(Logged out) Header, go to homepage, icon:logo-wordmark">
<svg height="32" class="octicon octicon-mark-github text-white" viewBox="0 0 16 16" version="1.1" width="32" aria-hidden="true"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
</a>
</div>
<div class="HeaderMenu HeaderMenu--logged-out d-flex flex-justify-between flex-items-center flex-auto">
<div class="d-none">
<button class="btn-link js-details-target" type="button" aria-label="Toggle navigation" aria-expanded="false">
<svg height="24" class="octicon octicon-x text-gray" viewBox="0 0 12 16" version="1.1" width="18" aria-hidden="true"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"/></svg>
</button>
</div>
<nav class="mt-0" aria-label="Global">
<ul class="d-flex list-style-none">
<li class=" mr-3 mr-lg-3 edge-item-fix position-relative flex-wrap flex-justify-between d-flex flex-items-center ">
<details class="HeaderMenu-details details-overlay details-reset width-full">
<summary class="HeaderMenu-summary HeaderMenu-link px-0 py-3 border-0 no-wrap d-inline-block">
Why GitHub?
<svg x="0px" y="0px" viewBox="0 0 14 8" xml:space="preserve" fill="none" class="icon-chevon-down-mktg position-relative">
<path d="M1,1l6.2,6L13,1"></path>
</svg>
</summary>
<div class="dropdown-menu flex-auto rounded-1 bg-white px-0 mt-0 p-4 left-n4 position-absolute">
<a href="/features" class="py-2 lh-condensed-ultra d-block link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Features">Features <span class="Bump-link-symbol float-right text-normal text-gray-light">&rarr;</span></a>
<ul class="list-style-none f5 pb-3">
<li class="edge-item-fix"><a href="/features/code-review/" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Code review">Code review</a></li>
<li class="edge-item-fix"><a href="/features/project-management/" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Project management">Project management</a></li>
<li class="edge-item-fix"><a href="/features/integrations" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Integrations">Integrations</a></li>
<li class="edge-item-fix"><a href="/features/actions" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Actions">Actions</a>
<li class="edge-item-fix"><a href="/features#team-management" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Team management">Team management</a></li>
<li class="edge-item-fix"><a href="/features#social-coding" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Social coding">Social coding</a></li>
<li class="edge-item-fix"><a href="/features#documentation" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Documentation">Documentation</a></li>
<li class="edge-item-fix"><a href="/features#code-hosting" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Code hosting">Code hosting</a></li>
</ul>
<ul class="list-style-none mb-0 border-lg-top pt-lg-3">
<li class="edge-item-fix"><a href="/case-studies" class="py-2 lh-condensed-ultra d-block no-underline link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Case studies">Case Studies <span class="Bump-link-symbol float-right text-normal text-gray-light">&rarr;</span></a></li>
<li class="edge-item-fix"><a href="/security" class="py-2 lh-condensed-ultra d-block no-underline link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Security">Security <span class="Bump-link-symbol float-right text-normal text-gray-light">&rarr;</span></a></li>
</ul>
</div>
</details>
</li>
<li class=" mr-3 mr-lg-3">
<a href="/enterprise" class="HeaderMenu-link no-underline py-3 d-block d-lg-inline-block" data-ga-click="(Logged out) Header, click, go to Enterprise">Enterprise</a>
</li>
<li class=" mr-3 mr-lg-3 edge-item-fix position-relative flex-wrap flex-justify-between d-flex flex-items-center ">
<details class="HeaderMenu-details details-overlay details-reset width-full">
<summary class="HeaderMenu-summary HeaderMenu-link px-0 py-3 border-0 no-wrap d-inline-block">
Explore
<svg x="0px" y="0px" viewBox="0 0 14 8" xml:space="preserve" fill="none" class="icon-chevon-down-mktg position-relative">
<path d="M1,1l6.2,6L13,1"></path>
</svg>
</summary>
<div class="dropdown-menu flex-auto rounded-1 bg-white px-0 pt-2 pb-0 mt-0 p-4 left-n4 position-absolute">
<ul class="list-style-none mb-3">
<li class="edge-item-fix"><a href="/explore" class="py-2 lh-condensed-ultra d-block link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Features">Explore GitHub <span class="Bump-link-symbol float-right text-normal text-gray-light">&rarr;</span></a></li>
</ul>
<h4 class="text-gray-light text-normal text-mono f5 mb-2 border-top pt-3">Learn &amp; contribute</h4>
<ul class="list-style-none mb-3">
<li class="edge-item-fix"><a href="/topics" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Topics">Topics</a></li>
<li class="edge-item-fix"><a href="/collections" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Collections">Collections</a></li>
<li class="edge-item-fix"><a href="/trending" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Trending">Trending</a></li>
<li class="edge-item-fix"><a href="https://lab.github.com/" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Learning lab">Learning Lab</a></li>
<li class="edge-item-fix"><a href="https://opensource.guide" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Open source guides">Open source guides</a></li>
</ul>
<h4 class="text-gray-light text-normal text-mono f5 mb-2 border-top pt-3">Connect with others</h4>
<ul class="list-style-none mb-0">
<li class="edge-item-fix"><a href="/events" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Events">Events</a></li>
<li class="edge-item-fix"><a href="https://github.community" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Community forum">Community forum</a></li>
<li class="edge-item-fix"><a href="https://education.github.com" class="py-2 pb-0 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to GitHub Education">GitHub Education</a></li>
</ul>
</div>
</details>
</li>
<li class=" mr-3 mr-lg-3">
<a href="/marketplace" class="HeaderMenu-link no-underline py-3 d-block d-lg-inline-block" data-ga-click="(Logged out) Header, go to Marketplace">Marketplace</a>
</li>
<li class=" mr-3 mr-lg-3 edge-item-fix position-relative flex-wrap flex-justify-between d-flex flex-items-center ">
<details class="HeaderMenu-details details-overlay details-reset width-full">
<summary class="HeaderMenu-summary HeaderMenu-link px-0 py-3 border-0 no-wrap d-inline-block">
Pricing
<svg x="0px" y="0px" viewBox="0 0 14 8" xml:space="preserve" fill="none" class="icon-chevon-down-mktg position-relative">
<path d="M1,1l6.2,6L13,1"></path>
</svg>
</summary>
<div class="dropdown-menu flex-auto rounded-1 bg-white px-0 pt-2 pb-4 mt-0 p-4 left-n4 position-absolute">
<a href="/pricing" class="pb-2 lh-condensed-ultra d-block link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Pricing">Plans <span class="Bump-link-symbol float-right text-normal text-gray-light">&rarr;</span></a>
<ul class="list-style-none mb-3">
<li class="edge-item-fix"><a href="/pricing#feature-comparison" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Compare features">Compare plans</a></li>
<li class="edge-item-fix"><a href="https://enterprise.github.com/contact" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Compare features">Contact Sales</a></li>
</ul>
<ul class="list-style-none mb-0 border-top pt-3">
<li class="edge-item-fix"><a href="/nonprofit" class="py-2 lh-condensed-ultra d-block no-underline link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Nonprofits">Nonprofit <span class="Bump-link-symbol float-right text-normal text-gray-light">&rarr;</span></a></li>
<li class="edge-item-fix"><a href="https://education.github.com" class="py-2 pb-0 lh-condensed-ultra d-block no-underline link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Education">Education <span class="Bump-link-symbol float-right text-normal text-gray-light">&rarr;</span></a></li>
</ul>
</div>
</details>
</li>
</ul>
</nav>
<div class="d-flex flex-items-center px-0 text-center text-left">
<div class="d-lg-flex mr-3">
<div class="header-search scoped-search site-scoped-search js-site-search position-relative js-jump-to"
role="combobox"
aria-owns="jump-to-results"
aria-label="Search or jump to"
aria-haspopup="listbox"
aria-expanded="false"
>
<div class="position-relative">
<!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-site-search-form" data-scope-type="Repository" data-scope-id="74174143" data-scoped-search-url="/scinfu/SwiftSoup/search" data-unscoped-search-url="/search" action="/scinfu/SwiftSoup/search" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="&#x2713;" />
<label class="form-control header-search-wrapper header-search-wrapper-jump-to position-relative d-flex flex-justify-between flex-items-center js-chromeless-input-container">
<input type="text"
class="form-control header-search-input jump-to-field js-jump-to-field js-site-search-focus js-site-search-field is-clearable"
data-hotkey="s,/"
name="q"
value=""
placeholder="Search"
data-unscoped-placeholder="Search GitHub"
data-scoped-placeholder="Search"
autocapitalize="off"
aria-autocomplete="list"
aria-controls="jump-to-results"
aria-label="Search"
data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations#csrf-token=uU5fHL/sP5GfDTlnGvgmSptr8MvxjNS82zbUII/70lxHuY89q/1L6nJhGNb+i0YibPmr9nucHQxUTvS1gx7J5Q=="
spellcheck="false"
autocomplete="off"
>
<input type="hidden" class="js-site-search-type-field" name="type" >
<img src="https://github.githubassets.com/images/search-key-slash.svg" alt="" class="mr-2 header-search-key-slash">
<div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container">
<ul class="d-none js-jump-to-suggestions-template-container">
<li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-suggestion" role="option">
<a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open p-2" href="">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none">
<svg height="16" width="16" class="octicon octicon-repo flex-shrink-0 js-jump-to-octicon-repo d-none" title="Repository" aria-label="Repository" viewBox="0 0 12 16" version="1.1" role="img"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"/></svg>
<svg height="16" width="16" class="octicon octicon-project flex-shrink-0 js-jump-to-octicon-project d-none" title="Project" aria-label="Project" viewBox="0 0 15 16" version="1.1" role="img"><path fill-rule="evenodd" d="M10 12h3V2h-3v10zm-4-2h3V2H6v8zm-4 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"/></svg>
<svg height="16" width="16" class="octicon octicon-search flex-shrink-0 js-jump-to-octicon-search d-none" title="Search" aria-label="Search" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M15.7 13.3l-3.81-3.83A5.93 5.93 0 0 0 13 6c0-3.31-2.69-6-6-6S1 2.69 1 6s2.69 6 6 6c1.3 0 2.48-.41 3.47-1.11l3.83 3.81c.19.2.45.3.7.3.25 0 .52-.09.7-.3a.996.996 0 0 0 0-1.41v.01zM7 10.7c-2.59 0-4.7-2.11-4.7-4.7 0-2.59 2.11-4.7 4.7-4.7 2.59 0 4.7 2.11 4.7 4.7 0 2.59-2.11 4.7-4.7 4.7z"/></svg>
</div>
<img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar d-none" alt="" aria-label="Team" src="" width="28" height="28">
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target">
</div>
<div class="border rounded-1 flex-shrink-0 bg-gray px-1 text-gray-light ml-1 f6 d-none js-jump-to-badge-search">
<span class="js-jump-to-badge-search-text-default d-none" aria-label="in this repository">
In this repository
</span>
<span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub">
All GitHub
</span>
<span aria-hidden="true" class="d-inline-block ml-1 v-align-middle"></span>
</div>
<div aria-hidden="true" class="border rounded-1 flex-shrink-0 bg-gray px-1 text-gray-light ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump">
Jump to
<span class="d-inline-block ml-1 v-align-middle"></span>
</div>
</a>
</li>
</ul>
<ul class="d-none js-jump-to-no-results-template-container">
<li class="d-flex flex-justify-center flex-items-center f5 d-none js-jump-to-suggestion p-2">
<span class="text-gray">No suggested jump to results</span>
</li>
</ul>
<ul id="jump-to-results" role="listbox" class="p-0 m-0 js-navigation-container jump-to-suggestions-results-container js-jump-to-suggestions-results-container">
<li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-scoped-search d-none" role="option">
<a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open p-2" href="">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none">
<svg height="16" width="16" class="octicon octicon-repo flex-shrink-0 js-jump-to-octicon-repo d-none" title="Repository" aria-label="Repository" viewBox="0 0 12 16" version="1.1" role="img"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"/></svg>
<svg height="16" width="16" class="octicon octicon-project flex-shrink-0 js-jump-to-octicon-project d-none" title="Project" aria-label="Project" viewBox="0 0 15 16" version="1.1" role="img"><path fill-rule="evenodd" d="M10 12h3V2h-3v10zm-4-2h3V2H6v8zm-4 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"/></svg>
<svg height="16" width="16" class="octicon octicon-search flex-shrink-0 js-jump-to-octicon-search d-none" title="Search" aria-label="Search" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M15.7 13.3l-3.81-3.83A5.93 5.93 0 0 0 13 6c0-3.31-2.69-6-6-6S1 2.69 1 6s2.69 6 6 6c1.3 0 2.48-.41 3.47-1.11l3.83 3.81c.19.2.45.3.7.3.25 0 .52-.09.7-.3a.996.996 0 0 0 0-1.41v.01zM7 10.7c-2.59 0-4.7-2.11-4.7-4.7 0-2.59 2.11-4.7 4.7-4.7 2.59 0 4.7 2.11 4.7 4.7 0 2.59-2.11 4.7-4.7 4.7z"/></svg>
</div>
<img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar d-none" alt="" aria-label="Team" src="" width="28" height="28">
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target">
</div>
<div class="border rounded-1 flex-shrink-0 bg-gray px-1 text-gray-light ml-1 f6 d-none js-jump-to-badge-search">
<span class="js-jump-to-badge-search-text-default d-none" aria-label="in this repository">
In this repository
</span>
<span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub">
All GitHub
</span>
<span aria-hidden="true" class="d-inline-block ml-1 v-align-middle"></span>
</div>
<div aria-hidden="true" class="border rounded-1 flex-shrink-0 bg-gray px-1 text-gray-light ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump">
Jump to
<span class="d-inline-block ml-1 v-align-middle"></span>
</div>
</a>
</li>
<li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-global-search d-none" role="option">
<a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open p-2" href="">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none">
<svg height="16" width="16" class="octicon octicon-repo flex-shrink-0 js-jump-to-octicon-repo d-none" title="Repository" aria-label="Repository" viewBox="0 0 12 16" version="1.1" role="img"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"/></svg>
<svg height="16" width="16" class="octicon octicon-project flex-shrink-0 js-jump-to-octicon-project d-none" title="Project" aria-label="Project" viewBox="0 0 15 16" version="1.1" role="img"><path fill-rule="evenodd" d="M10 12h3V2h-3v10zm-4-2h3V2H6v8zm-4 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"/></svg>
<svg height="16" width="16" class="octicon octicon-search flex-shrink-0 js-jump-to-octicon-search d-none" title="Search" aria-label="Search" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M15.7 13.3l-3.81-3.83A5.93 5.93 0 0 0 13 6c0-3.31-2.69-6-6-6S1 2.69 1 6s2.69 6 6 6c1.3 0 2.48-.41 3.47-1.11l3.83 3.81c.19.2.45.3.7.3.25 0 .52-.09.7-.3a.996.996 0 0 0 0-1.41v.01zM7 10.7c-2.59 0-4.7-2.11-4.7-4.7 0-2.59 2.11-4.7 4.7-4.7 2.59 0 4.7 2.11 4.7 4.7 0 2.59-2.11 4.7-4.7 4.7z"/></svg>
</div>
<img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar d-none" alt="" aria-label="Team" src="" width="28" height="28">
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target">
</div>
<div class="border rounded-1 flex-shrink-0 bg-gray px-1 text-gray-light ml-1 f6 d-none js-jump-to-badge-search">
<span class="js-jump-to-badge-search-text-default d-none" aria-label="in this repository">
In this repository
</span>
<span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub">
All GitHub
</span>
<span aria-hidden="true" class="d-inline-block ml-1 v-align-middle"></span>
</div>
<div aria-hidden="true" class="border rounded-1 flex-shrink-0 bg-gray px-1 text-gray-light ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump">
Jump to
<span class="d-inline-block ml-1 v-align-middle"></span>
</div>
</a>
</li>
</ul>
</div>
</label>
</form> </div>
</div>
</div>
<a class="HeaderMenu-link no-underline mr-3" href="/login?return_to=%2Fscinfu%2FSwiftSoup" data-ga-click="(Logged out) Header, clicked Sign in, text:sign-in">Sign&nbsp;in</a>
<a class="HeaderMenu-link d-inline-block no-underline border border-gray-dark rounded-1 px-2 py-1" href="/join" data-ga-click="(Logged out) Header, clicked Sign up, text:sign-up">Sign&nbsp;up</a>
</div>
</div>
</div>
</header>
</div>
<div id="start-of-content" class="show-on-focus"></div>
<div id="js-flash-container">
</div>
<div role="main" class="application-main " data-commit-hovercards-enabled>
<div itemscope itemtype="http://schema.org/SoftwareSourceCode" class="">
<div id="js-repo-pjax-container" data-pjax-container >
<div class="pagehead repohead instapaper_ignore readability-menu experiment-repo-nav ">
<div class="repohead-details-container clearfix container">
<ul class="pagehead-actions">
<li>
<a href="/login?return_to=%2Fscinfu%2FSwiftSoup"
class="btn btn-sm btn-with-count tooltipped tooltipped-s"
aria-label="You must be signed in to watch a repository" rel="nofollow">
<svg class="octicon octicon-eye v-align-text-bottom" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/></svg>
Watch
</a>
<a class="social-count" href="/scinfu/SwiftSoup/watchers"
aria-label="33 users are watching this repository">
33
</a>
</li>
<li>
<a href="/login?return_to=%2Fscinfu%2FSwiftSoup"
class="btn btn-sm btn-with-count tooltipped tooltipped-s"
aria-label="You must be signed in to star a repository" rel="nofollow">
<svg class="octicon octicon-star v-align-text-bottom" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74L14 6z"/></svg>
Star
</a>
<a class="social-count js-social-count" href="/scinfu/SwiftSoup/stargazers"
aria-label="1484 users starred this repository">
1,484
</a>
</li>
<li>
<a href="/login?return_to=%2Fscinfu%2FSwiftSoup"
class="btn btn-sm btn-with-count tooltipped tooltipped-s"
aria-label="You must be signed in to fork a repository" rel="nofollow">
<svg class="octicon octicon-repo-forked v-align-text-bottom" viewBox="0 0 10 16" version="1.1" width="10" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/></svg>
Fork
</a>
<a href="/scinfu/SwiftSoup/network/members" class="social-count"
aria-label="108 users forked this repository">
108
</a>
</li>
</ul>
<h1 class="public ">
<svg class="octicon octicon-repo" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"/></svg>
<span class="author" itemprop="author"><a class="url fn" rel="author" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=201132" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="/scinfu">scinfu</a></span><!--
--><span class="path-divider">/</span><!--
--><strong itemprop="name"><a data-pjax="#js-repo-pjax-container" href="/scinfu/SwiftSoup">SwiftSoup</a></strong>
</h1>
</div>
<nav class="reponav js-repo-nav js-sidenav-container-pjax container"
itemscope
itemtype="http://schema.org/BreadcrumbList"
aria-label="Repository"
data-pjax="#js-repo-pjax-container">
<span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement">
<a class="js-selected-navigation-item selected reponav-item" itemprop="url" data-hotkey="g c" aria-current="page" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches repo_packages /scinfu/SwiftSoup" href="/scinfu/SwiftSoup">
<svg class="octicon octicon-code" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M9.5 3L8 4.5 11.5 8 8 11.5 9.5 13 14 8 9.5 3zm-5 0L0 8l4.5 5L6 11.5 2.5 8 6 4.5 4.5 3z"/></svg>
<span itemprop="name">Code</span>
<meta itemprop="position" content="1">
</a> </span>
<span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement">
<a itemprop="url" data-hotkey="g i" class="js-selected-navigation-item reponav-item" data-selected-links="repo_issues repo_labels repo_milestones /scinfu/SwiftSoup/issues" href="/scinfu/SwiftSoup/issues">
<svg class="octicon octicon-issue-opened" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"/></svg>
<span itemprop="name">Issues</span>
<span class="Counter">7</span>
<meta itemprop="position" content="2">
</a> </span>
<span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement">
<a data-hotkey="g p" itemprop="url" class="js-selected-navigation-item reponav-item" data-selected-links="repo_pulls checks /scinfu/SwiftSoup/pulls" href="/scinfu/SwiftSoup/pulls">
<svg class="octicon octicon-git-pull-request" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/></svg>
<span itemprop="name">Pull requests</span>
<span class="Counter">1</span>
<meta itemprop="position" content="3">
</a> </span>
<a data-hotkey="g b" class="js-selected-navigation-item reponav-item" data-selected-links="repo_projects new_repo_project repo_project /scinfu/SwiftSoup/projects" href="/scinfu/SwiftSoup/projects">
<svg class="octicon octicon-project" viewBox="0 0 15 16" version="1.1" width="15" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M10 12h3V2h-3v10zm-4-2h3V2H6v8zm-4 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"/></svg>
Projects
<span class="Counter" >0</span>
</a>
<a class="js-selected-navigation-item reponav-item" data-selected-links="repo_graphs repo_contributors dependency_graph pulse alerts security people /scinfu/SwiftSoup/pulse" href="/scinfu/SwiftSoup/pulse">
<svg class="octicon octicon-graph" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M16 14v1H0V0h1v14h15zM5 13H3V8h2v5zm4 0H7V3h2v10zm4 0h-2V6h2v7z"/></svg>
Insights
</a>
</nav>
</div>
<div class="container new-discussion-timeline experiment-repo-nav ">
<div class="repository-content ">
<div class="signup-prompt-bg rounded-1">
<div class="signup-prompt p-4 text-center mb-4 rounded-1">
<div class="position-relative">
<!-- '"` --><!-- </textarea></xmp> --></option></form><form action="/site/dismiss_signup_prompt" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="&#x2713;" /><input type="hidden" name="authenticity_token" value="PYs2SqE8MPt2wriNgj5ATd9Uyx26GU9W+OySyVa+sJQ/VisuCxh3Czs2dLntONUDq4wL+IcAwQECMNFoIqpQmg==" />
<button type="submit" class="position-absolute top-0 right-0 btn-link link-gray" data-ga-click="(Logged out) Sign up prompt, clicked Dismiss, text:dismiss">
Dismiss
</button>
</form> <h3 class="pt-2">Join GitHub today</h3>
<p class="col-6 mx-auto">GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.</p>
<a class="btn btn-primary" href="/join?source=prompt-code" data-ga-click="(Logged out) Sign up prompt, clicked Sign up, text:sign-up">Sign up</a>
</div>
</div>
</div>
<div class="mb-3"> <div class="f4">
<span class="text-gray-dark mr-2" itemprop="about">
SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)
</span>
<span itemprop="url"><a rel="nofollow" href="http://www.scinfu.com/SwiftSoup/">http://www.scinfu.com/SwiftSoup/</a></span>
</div>
</div>
<div class="overall-summary overall-summary-bottomless">
<div class="stats-switcher-viewport js-stats-switcher-viewport">
<div class="stats-switcher-wrapper">
<ul class="numbers-summary">
<li class="commits">
<a data-pjax href="/scinfu/SwiftSoup/commits/master">
<svg class="octicon octicon-history" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8 13H6V6h5v2H8v5zM7 1C4.81 1 2.87 2.02 1.59 3.59L0 2v4h4L2.5 4.5C3.55 3.17 5.17 2.3 7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-.34.03-.67.09-1H.08C.03 7.33 0 7.66 0 8c0 3.86 3.14 7 7 7s7-3.14 7-7-3.14-7-7-7z"/></svg>
<span class="num text-emphasized">
312
</span>
commits
</a>
</li>
<li>
<a data-pjax href="/scinfu/SwiftSoup/branches">
<svg class="octicon octicon-git-branch" viewBox="0 0 10 16" version="1.1" width="10" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M10 5c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v.3c-.02.52-.23.98-.63 1.38-.4.4-.86.61-1.38.63-.83.02-1.48.16-2 .45V4.72a1.993 1.993 0 0 0-1-3.72C.88 1 0 1.89 0 3a2 2 0 0 0 1 1.72v6.56c-.59.35-1 .99-1 1.72 0 1.11.89 2 2 2 1.11 0 2-.89 2-2 0-.53-.2-1-.53-1.36.09-.06.48-.41.59-.47.25-.11.56-.17.94-.17 1.05-.05 1.95-.45 2.75-1.25S8.95 7.77 9 6.73h-.02C9.59 6.37 10 5.73 10 5zM2 1.8c.66 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2C1.35 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2zm0 12.41c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm6-8c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/></svg>
<span class="num text-emphasized">
6
</span>
branches
</a>
</li>
<li>
<a href="/scinfu/SwiftSoup/releases">
<svg class="octicon octicon-tag" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.73 1.73C7.26 1.26 6.62 1 5.96 1H3.5C2.13 1 1 2.13 1 3.5v2.47c0 .66.27 1.3.73 1.77l6.06 6.06c.39.39 1.02.39 1.41 0l4.59-4.59a.996.996 0 0 0 0-1.41L7.73 1.73zM2.38 7.09c-.31-.3-.47-.7-.47-1.13V3.5c0-.88.72-1.59 1.59-1.59h2.47c.42 0 .83.16 1.13.47l6.14 6.13-4.73 4.73-6.13-6.15zM3.01 3h2v2H3V3h.01z"/></svg>
<span class="num text-emphasized">
55
</span>
releases
</a>
</li>
<li>
<a href="/scinfu/SwiftSoup/graphs/contributors">
<svg class="octicon octicon-organization" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M16 12.999c0 .439-.45 1-1 1H7.995c-.539 0-.994-.447-.995-.999H1c-.54 0-1-.561-1-1 0-2.634 3-4 3-4s.229-.409 0-1c-.841-.621-1.058-.59-1-3 .058-2.419 1.367-3 2.5-3s2.442.58 2.5 3c.058 2.41-.159 2.379-1 3-.229.59 0 1 0 1s1.549.711 2.42 2.088C9.196 9.369 10 8.999 10 8.999s.229-.409 0-1c-.841-.62-1.058-.59-1-3 .058-2.419 1.367-3 2.5-3s2.437.581 2.495 3c.059 2.41-.158 2.38-1 3-.229.59 0 1 0 1s3.005 1.366 3.005 4z"/></svg>
<span class="num text-emphasized">
16
</span>
contributors
</a>
</li>
<li>
<a href="/scinfu/SwiftSoup/blob/master/LICENSE">
<svg class="octicon octicon-law" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7 4c-.83 0-1.5-.67-1.5-1.5S6.17 1 7 1s1.5.67 1.5 1.5S7.83 4 7 4zm7 6c0 1.11-.89 2-2 2h-1c-1.11 0-2-.89-2-2l2-4h-1c-.55 0-1-.45-1-1H8v8c.42 0 1 .45 1 1h1c.42 0 1 .45 1 1H3c0-.55.58-1 1-1h1c0-.55.58-1 1-1h.03L6 5H5c0 .55-.45 1-1 1H3l2 4c0 1.11-.89 2-2 2H2c-1.11 0-2-.89-2-2l2-4H1V5h3c0-.55.45-1 1-1h4c.55 0 1 .45 1 1h3v1h-1l2 4zM2.5 7L1 10h3L2.5 7zM13 10l-1.5-3-1.5 3h3z"/></svg>
MIT
</a>
</li>
</ul>
<div class="repository-lang-stats">
<ol class="repository-lang-stats-numbers">
<li>
<a href="/scinfu/SwiftSoup/search?l=swift" data-ga-click="Repository, language stats search click, location:repo overview">
<span class="color-block language-color" style="background-color:#ffac45;"></span>
<span class="lang">Swift</span>
<span class="percent">99.6%</span>
</a>
</li>
<li>
<span>
<span class="color-block language-color" style="background-color:#ededed;"></span>
<span class="lang">Other</span>
<span class="percent">0.4%</span>
</span>
</li>
</ol>
</div>
</div>
</div>
</div>
<button type="button" class="d-flex p-0 repository-lang-stats-graph js-toggle-lang-stats" title="Click for language details" data-ga-click="Repository, language bar stats toggle, location:repo overview">
<span class="language-color" aria-label="Swift 99.6%" style="width:99.6%; background-color:#ffac45;" itemprop="keywords">Swift</span>
<span class="language-color" aria-label="Other 0.4%" style="width:0.4%; background-color:#ededed;" itemprop="keywords">Other</span>
</button>
<div class="file-navigation in-mid-page d-flex flex-items-start">
<details class="details-reset details-overlay select-menu branch-select-menu float-left">
<summary class="btn btn-sm select-menu-button css-truncate"
data-hotkey="w"
title="Switch branches or tags">
<i>Branch:</i>
<span class="css-truncate-target">master</span>
</summary>
<details-menu class="select-menu-modal position-absolute" style="z-index: 99;" src="/scinfu/SwiftSoup/ref-list/master?source_action=disambiguate&amp;source_controller=files" preload>
<include-fragment class="select-menu-loading-overlay anim-pulse">
<svg height="32" class="octicon octicon-octoface" viewBox="0 0 16 16" version="1.1" width="32" aria-hidden="true"><path fill-rule="evenodd" d="M14.7 5.34c.13-.32.55-1.59-.13-3.31 0 0-1.05-.33-3.44 1.3-1-.28-2.07-.32-3.13-.32s-2.13.04-3.13.32c-2.39-1.64-3.44-1.3-3.44-1.3-.68 1.72-.26 2.99-.13 3.31C.49 6.21 0 7.33 0 8.69 0 13.84 3.33 15 7.98 15S16 13.84 16 8.69c0-1.36-.49-2.48-1.3-3.35zM8 14.02c-3.3 0-5.98-.15-5.98-3.35 0-.76.38-1.48 1.02-2.07 1.07-.98 2.9-.46 4.96-.46 2.07 0 3.88-.52 4.96.46.65.59 1.02 1.3 1.02 2.07 0 3.19-2.68 3.35-5.98 3.35zM5.49 9.01c-.66 0-1.2.8-1.2 1.78s.54 1.79 1.2 1.79c.66 0 1.2-.8 1.2-1.79s-.54-1.78-1.2-1.78zm5.02 0c-.66 0-1.2.79-1.2 1.78s.54 1.79 1.2 1.79c.66 0 1.2-.8 1.2-1.79s-.53-1.78-1.2-1.78z"/></svg>
</include-fragment>
</details-menu>
</details>
<button type="button" class="btn btn-sm disabled tooltipped tooltipped-n new-pull-request-btn" aria-label="You must be signed in to create a pull request">
New pull request
</button>
<div class="breadcrumb flex-auto">
</div>
<div class="BtnGroup">
<a href="/scinfu/SwiftSoup/find/master"
class="btn btn-sm empty-icon float-right BtnGroup-item"
data-pjax
data-hotkey="t"
data-ga-click="Repository, find file, location:repo overview">
Find file
</a>
</div>
<details class="get-repo-select-menu js-get-repo-select-menu position-relative details-overlay details-reset">
<summary class="btn btn-sm btn-primary">
Clone or download
<span class="dropdown-caret"></span>
</summary>
<div class="position-relative">
<div class="get-repo-modal dropdown-menu dropdown-menu-sw pb-0 js-toggler-container js-get-repo-modal">
<div class="get-repo-modal-options">
<div class="clone-options https-clone-options">
<h4 class="mb-1">
Clone with HTTPS
<a class="muted-link" href="https://help.github.com/articles/which-remote-url-should-i-use" target="_blank" title="Which remote URL should I use?">
<svg class="octicon octicon-question" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M6 10h2v2H6v-2zm4-3.5C10 8.64 8 9 8 9H6c0-.55.45-1 1-1h.5c.28 0 .5-.22.5-.5v-1c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5V7H4c0-1.5 1.5-3 3-3s3 1 3 2.5zM7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7z"/></svg>
</a>
</h4>
<p class="mb-2 get-repo-decription-text">
Use Git or checkout with SVN using the web URL.
</p>
<div class="input-group">
<input type="text" class="form-control input-monospace input-sm" data-autoselect value="https://github.com/scinfu/SwiftSoup.git" aria-label="Clone this repository at https://github.com/scinfu/SwiftSoup.git" readonly>
<div class="input-group-button">
<clipboard-copy value="https://github.com/scinfu/SwiftSoup.git" aria-label="Copy to clipboard" class="btn btn-sm">
<svg class="octicon octicon-clippy" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M2 13h4v1H2v-1zm5-6H2v1h5V7zm2 3V8l-3 3 3 3v-2h5v-2H9zM4.5 9H2v1h2.5V9zM2 12h2.5v-1H2v1zm9 1h1v2c-.02.28-.11.52-.3.7-.19.18-.42.28-.7.3H1c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c0-1.11.89-2 2-2 1.11 0 2 .89 2 2h3c.55 0 1 .45 1 1v5h-1V6H1v9h10v-2zM2 5h8c0-.55-.45-1-1-1H8c-.55 0-1-.45-1-1s-.45-1-1-1-1 .45-1 1-.45 1-1 1H3c-.55 0-1 .45-1 1z"/></svg>
</clipboard-copy>
</div>
</div>
</div>
<div class="mt-2">
<a href="https://desktop.github.com" class="btn btn-outline get-repo-btn tooltipped tooltipped-s tooltipped-multiline js-get-repo" data-open-app="mac" aria-label="Clone scinfu/SwiftSoup to your computer and use it in GitHub Desktop.">
Open in Desktop
</a>
<a href="/scinfu/SwiftSoup/archive/master.zip"
class="btn btn-outline get-repo-btn
"
rel="nofollow"
data-ga-click="Repository, download zip, location:repo overview">
Download ZIP
</a>
</div>
</div>
<div class="js-modal-download-mac py-2 px-3 d-none">
<h4 class="lh-condensed mb-3">Launching GitHub Desktop<span class="animated-ellipsis-container"><span class="animated-ellipsis">...</span></span></h4>
<p class="text-gray">If nothing happens, <a href="https://desktop.github.com/">download GitHub Desktop</a> and try again.</p>
<p><button class="btn-link js-get-repo-modal-download-back">Go back</button></p>
</div>
<div class="js-modal-download-windows py-2 px-3 d-none">
<h4 class="lh-condensed mb-3">Launching GitHub Desktop<span class="animated-ellipsis-container"><span class="animated-ellipsis">...</span></span></h4>
<p class="text-gray">If nothing happens, <a href="https://desktop.github.com/">download GitHub Desktop</a> and try again.</p>
<p><button class="btn-link js-get-repo-modal-download-back">Go back</button></p>
</div>
<div class="js-modal-download-xcode py-2 px-3 d-none">
<h4 class="lh-condensed mb-3">Launching Xcode<span class="animated-ellipsis-container"><span class="animated-ellipsis">...</span></span></h4>
<p class="text-gray">If nothing happens, <a href="https://developer.apple.com/xcode/">download Xcode</a> and try again.</p>
<p><button class="btn-link js-get-repo-modal-download-back">Go back</button></p>
</div>
<div class="js-modal-download-visual-studio py-2 px-3 d-none">
<h4 class="lh-condensed mb-3">Launching Visual Studio<span class="animated-ellipsis-container"><span class="animated-ellipsis">...</span></span></h4>
<p class="text-gray">If nothing happens, <a href="https://visualstudio.github.com/">download the GitHub extension for Visual Studio</a> and try again.</p>
<p><button class="btn-link js-get-repo-modal-download-back">Go back</button></p>
</div>
</div>
</div>
</details>
</div>
<div class="commit-tease js-details-container Details d-flex rounded-top-1" data-issue-and-pr-hovercards-enabled>
<div class="AvatarStack flex-self-start ">
<div class="AvatarStack-body" aria-label="scinfu">
<a class="avatar" data-skip-pjax="true" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=201132" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="/scinfu">
<img height="20" width="20" alt="@scinfu" src="https://avatars3.githubusercontent.com/u/201132?s=60&amp;v=4" />
</a> </div>
</div>
<div class="flex-auto f6 mr-3">
<a href="/scinfu/SwiftSoup/commits?author=scinfu"
class="commit-author tooltipped tooltipped-s user-mention"
aria-label="View all commits by scinfu">scinfu</a>
<a data-pjax="true" title='Merge pull request #102 from hactar/master
Fixes #101 - SwiftSoup builds in "release" mode on swift linux 4.2.' class="message" href="/scinfu/SwiftSoup/commit/11da8c685ddde2d519fad04a7daf8485bbbc773e">Merge pull request</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="369795797" data-permission-text="Issue title is private" data-url="https://github.com/scinfu/SwiftSoup/issues/102" data-hovercard-type="pull_request" data-hovercard-url="/scinfu/SwiftSoup/pull/102/hovercard" href="https://github.com/scinfu/SwiftSoup/pull/102">#102</a> <a data-pjax="true" title='Merge pull request #102 from hactar/master
Fixes #101 - SwiftSoup builds in "release" mode on swift linux 4.2.' class="message" href="/scinfu/SwiftSoup/commit/11da8c685ddde2d519fad04a7daf8485bbbc773e">from hactar/master</a>
<span class="hidden-text-expander inline">
<button type="button" class="ellipsis-expander js-details-target" aria-expanded="false">&hellip;</button>
</span>
<div class="commit-desc"><pre class="text-small"><span class="issue-keyword tooltipped tooltipped-se" aria-label="This commit closes issue #101.">Fixes</span> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="369790520" data-permission-text="Issue title is private" data-url="https://github.com/scinfu/SwiftSoup/issues/101" data-hovercard-type="issue" data-hovercard-url="/scinfu/SwiftSoup/issues/101/hovercard" href="https://github.com/scinfu/SwiftSoup/issues/101">#101</a> - SwiftSoup builds in "release" mode on swift linux 4.2.</pre></div>
</div>
<div class="no-wrap">
Latest commit
<a class="commit-tease-sha" href="/scinfu/SwiftSoup/commit/11da8c685ddde2d519fad04a7daf8485bbbc773e" data-pjax>
11da8c6
</a>
<span itemprop="dateModified"><relative-time datetime="2018-10-13T13:31:19Z">Oct 13, 2018</relative-time></span>
</div>
</div>
<div class="file-wrap">
<a class="d-none js-permalink-shortcut" data-hotkey="y" href="/scinfu/SwiftSoup/tree/11da8c685ddde2d519fad04a7daf8485bbbc773e">Permalink</a>
<table class="files js-navigation-container js-active-navigation-container" data-pjax>
<thead>
<tr>
<th><span class="sr-only">Type</span></th>
<th><span class="sr-only">Name</span></th>
<th><span class="sr-only">Latest commit message</span></th>
<th><span class="sr-only">Commit time</span></th>
</tr>
</thead>
<tbody>
<tr class="warning include-fragment-error">
<td class="icon"><svg class="octicon octicon-alert" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"/></svg></td>
<td class="content" colspan="3">Failed to load latest commit information.</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="directory" class="octicon octicon-file-directory" viewBox="0 0 14 16" version="1.1" width="14" height="16" role="img"><path fill-rule="evenodd" d="M13 4H7V3c0-.66-.31-1-1-1H1c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V5c0-.55-.45-1-1-1zM6 4H1V3h5v1z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title="Example" id="0a52730597fb4ffa01fc117d9e71e3a9-05fa557554df7a7d5842143e838e575a280cec95" href="/scinfu/SwiftSoup/tree/master/Example">Example</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="Merge branch &#39;pr/97&#39;
* pr/97:
Adjust Dockerfile to newer Swift
Lower Swift version because of Linux build
Install cocoapods beta because it fails with older
Bump TravisCI Xcode version
Swift 4.2 and Xcode 10 support
# Conflicts:
# Example/Example.xcodeproj/project.pbxproj
# Example/Pods/Local Podspecs/SwiftSoup.podspec.json
# Example/Pods/Manifest.lock
# Example/Pods/Pods.xcodeproj/project.pbxproj
# Example/Pods/Target Support Files/SwiftSoup/Info.plist
# Sources/Evaluator.swift" class="message" href="/scinfu/SwiftSoup/commit/cdc4bbf376512622797437a1d1f8f667cc66011a">Merge branch 'pr/97'</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2018-09-23T13:26:42Z">Sep 23, 2018</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="directory" class="octicon octicon-file-directory" viewBox="0 0 14 16" version="1.1" width="14" height="16" role="img"><path fill-rule="evenodd" d="M13 4H7V3c0-.66-.31-1-1-1H1c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V5c0-.55-.45-1-1-1zM6 4H1V3h5v1z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title="Sources" id="fb61758d0f0fda4ba867c3d5a46c16a7-1ef2bba4f57db97dbf3c03f067db41ebbecd2c22" href="/scinfu/SwiftSoup/tree/master/Sources">Sources</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title='- Fixes #101 - SwiftSoup builds in "release" mode on swift linux 4.2.' class="message" href="/scinfu/SwiftSoup/commit/231864a7a48f07e0d8b2ced2770463bbb3ee4c72">-</a> <span class="issue-keyword tooltipped tooltipped-se" aria-label="This commit closes issue #101."><a data-pjax="true" title='- Fixes #101 - SwiftSoup builds in "release" mode on swift linux 4.2.' class="message" href="/scinfu/SwiftSoup/commit/231864a7a48f07e0d8b2ced2770463bbb3ee4c72">Fixes</a></span> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="369790520" data-permission-text="Issue title is private" data-url="https://github.com/scinfu/SwiftSoup/issues/101" data-hovercard-type="issue" data-hovercard-url="/scinfu/SwiftSoup/issues/101/hovercard" href="https://github.com/scinfu/SwiftSoup/issues/101">#101</a> <a data-pjax="true" title='- Fixes #101 - SwiftSoup builds in "release" mode on swift linux 4.2.' class="message" href="/scinfu/SwiftSoup/commit/231864a7a48f07e0d8b2ced2770463bbb3ee4c72">- SwiftSoup builds in "release" mode on swift linux 4.2.</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2018-10-13T11:56:37Z">Oct 13, 2018</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="directory" class="octicon octicon-file-directory" viewBox="0 0 14 16" version="1.1" width="14" height="16" role="img"><path fill-rule="evenodd" d="M13 4H7V3c0-.66-.31-1-1-1H1c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V5c0-.55-.45-1-1-1zM6 4H1V3h5v1z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title="SwiftSoup.xcodeproj" id="9a34342d3e5a5c864c4215fef1255499-8037054250ebf6826571a39453752456302906ec" href="/scinfu/SwiftSoup/tree/master/SwiftSoup.xcodeproj">SwiftSoup.xcodeproj</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="1.7.4" class="message" href="/scinfu/SwiftSoup/commit/9c4d27a7f20a8590a5b370c1dffabc63ddbe0e95">1.7.4</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2018-09-23T17:22:17Z">Sep 23, 2018</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="directory" class="octicon octicon-file-directory" viewBox="0 0 14 16" version="1.1" width="14" height="16" role="img"><path fill-rule="evenodd" d="M13 4H7V3c0-.66-.31-1-1-1H1c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V5c0-.55-.45-1-1-1zM6 4H1V3h5v1z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title="Tests" id="90792de52961c34118f976ebe4af3a75-860d529e975f8e38cb2cff6444df5193b77a3616" href="/scinfu/SwiftSoup/tree/master/Tests">Tests</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="lint" class="message" href="/scinfu/SwiftSoup/commit/8e064ada23fa0b0581b41c988ef60609191f90a4">lint</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2018-04-03T18:14:14Z">Apr 3, 2018</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="file" class="octicon octicon-file" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M6 5H2V4h4v1zM2 8h7V7H2v1zm0 2h7V9H2v1zm0 2h7v-1H2v1zm10-7.5V14c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V2c0-.55.45-1 1-1h7.5L12 4.5zM11 5L8 2H1v12h10V5z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title=".dockerignore" id="f7c5b4068637e2def526f9bbc7200c4e-e178c155b4784965e5b70f54338a262320059826" href="/scinfu/SwiftSoup/blob/master/.dockerignore">.dockerignore</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="Fix Swift 3.1" class="message" href="/scinfu/SwiftSoup/commit/90b9f9f16e043d8afaec7d37341f449efdd32dd0">Fix Swift 3.1</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2017-04-05T13:03:38Z">Apr 5, 2017</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="file" class="octicon octicon-file" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M6 5H2V4h4v1zM2 8h7V7H2v1zm0 2h7V9H2v1zm0 2h7v-1H2v1zm10-7.5V14c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V2c0-.55.45-1 1-1h7.5L12 4.5zM11 5L8 2H1v12h10V5z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title=".gitignore" id="a084b794bc0759e7a6b77810e01874f2-fd29596833ebce933a99e16409fe7768fa488338" href="/scinfu/SwiftSoup/blob/master/.gitignore">.gitignore</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="Shared data" class="message" href="/scinfu/SwiftSoup/commit/2f54ce95b688d15110a509f39e54f3848588db50">Shared data</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2017-11-18T11:56:14Z">Nov 18, 2017</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="file" class="octicon octicon-file" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M6 5H2V4h4v1zM2 8h7V7H2v1zm0 2h7V9H2v1zm0 2h7v-1H2v1zm10-7.5V14c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V2c0-.55.45-1 1-1h7.5L12 4.5zM11 5L8 2H1v12h10V5z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title=".swift-version" id="9a38fea2721c0361c4f24acc02197668-bf77d549685a9e09678fbbda05a071b312cf2de3" href="/scinfu/SwiftSoup/blob/master/.swift-version">.swift-version</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="added" class="message" href="/scinfu/SwiftSoup/commit/489072c6b1f1ebcc650538f55c0faaa627eeb88f">added</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2018-09-23T18:33:38Z">Sep 23, 2018</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="file" class="octicon octicon-file" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M6 5H2V4h4v1zM2 8h7V7H2v1zm0 2h7V9H2v1zm0 2h7v-1H2v1zm10-7.5V14c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V2c0-.55.45-1 1-1h7.5L12 4.5zM11 5L8 2H1v12h10V5z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title=".travis.yml" id="354f30a63fb0907d4ad57269548329e3-ec689a6670ab7061be2483eabfd1aeabc9aaefbb" href="/scinfu/SwiftSoup/blob/master/.travis.yml">.travis.yml</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="Bump TravisCI Xcode version" class="message" href="/scinfu/SwiftSoup/commit/e8685b7d6ccce0cac947b9d2b66e7c940d028be8">Bump TravisCI Xcode version</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2018-09-22T08:49:37Z">Sep 22, 2018</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="file" class="octicon octicon-file" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M6 5H2V4h4v1zM2 8h7V7H2v1zm0 2h7V9H2v1zm0 2h7v-1H2v1zm10-7.5V14c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V2c0-.55.45-1 1-1h7.5L12 4.5zM11 5L8 2H1v12h10V5z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title="CHANGELOG.md" id="4ac32a78649ca5bdd8e0ba38b7006a1e-50b6d11155fb64a04c588c9198647682c1f085d2" href="/scinfu/SwiftSoup/blob/master/CHANGELOG.md">CHANGELOG.md</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="1.7.4" class="message" href="/scinfu/SwiftSoup/commit/9c4d27a7f20a8590a5b370c1dffabc63ddbe0e95">1.7.4</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2018-09-23T17:22:17Z">Sep 23, 2018</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="file" class="octicon octicon-file" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M6 5H2V4h4v1zM2 8h7V7H2v1zm0 2h7V9H2v1zm0 2h7v-1H2v1zm10-7.5V14c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V2c0-.55.45-1 1-1h7.5L12 4.5zM11 5L8 2H1v12h10V5z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title="Dockerfile" id="3254677a7917c6c01f55212f86c57fbf-aa3f95ebe385100fe3a2154fe74aa778e0bbbb15" href="/scinfu/SwiftSoup/blob/master/Dockerfile">Dockerfile</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="docker" class="message" href="/scinfu/SwiftSoup/commit/c40934740c2e90aedc42a82e19360b0009ae4c12">docker</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2018-09-23T19:06:21Z">Sep 23, 2018</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="file" class="octicon octicon-file" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M6 5H2V4h4v1zM2 8h7V7H2v1zm0 2h7V9H2v1zm0 2h7v-1H2v1zm10-7.5V14c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V2c0-.55.45-1 1-1h7.5L12 4.5zM11 5L8 2H1v12h10V5z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title="LICENSE" id="9879d6db96fd29134fc802214163b95a-ddeb6c98802b19281bd10ab40fb5946a281d855f" itemprop="license" href="/scinfu/SwiftSoup/blob/master/LICENSE">LICENSE</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="Initial commit" class="message" href="/scinfu/SwiftSoup/commit/4e574755c8417842b0b416804b2c0b78e0405217">Initial commit</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2016-11-18T23:20:04Z">Nov 18, 2016</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="file" class="octicon octicon-file" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M6 5H2V4h4v1zM2 8h7V7H2v1zm0 2h7V9H2v1zm0 2h7v-1H2v1zm10-7.5V14c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V2c0-.55.45-1 1-1h7.5L12 4.5zM11 5L8 2H1v12h10V5z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title="Package.swift" id="37ca2dd15ca0f6b1b49e78db084ef5b9-be7d9f19b5395dbf4071676361e88466c327b127" href="/scinfu/SwiftSoup/blob/master/Package.swift">Package.swift</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="fix swift version" class="message" href="/scinfu/SwiftSoup/commit/fd94eb9537a15ce0c6d07d12b6886575392579a8">fix swift version</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2018-09-23T18:00:24Z">Sep 23, 2018</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="file" class="octicon octicon-file" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M6 5H2V4h4v1zM2 8h7V7H2v1zm0 2h7V9H2v1zm0 2h7v-1H2v1zm10-7.5V14c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V2c0-.55.45-1 1-1h7.5L12 4.5zM11 5L8 2H1v12h10V5z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title="README.md" id="04c6e90faac2675aa89e2176d2eec7d8-c40d2584e02d0c257d136ffd8cc4017c24b11bf0" href="/scinfu/SwiftSoup/blob/master/README.md">README.md</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="Up the version written in README.md to 1.7.4" class="message" href="/scinfu/SwiftSoup/commit/3cfabf2dcd89a4b8e23029084a70b6dce6d40d0e">Up the version written in README.md to 1.7.4</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2018-10-08T18:19:53Z">Oct 8, 2018</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="file" class="octicon octicon-file" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M6 5H2V4h4v1zM2 8h7V7H2v1zm0 2h7V9H2v1zm0 2h7v-1H2v1zm10-7.5V14c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V2c0-.55.45-1 1-1h7.5L12 4.5zM11 5L8 2H1v12h10V5z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title="SwiftSoup.podspec" id="1c6280be9361d751f7bbc4db8522fb16-0578e643d014e345a20ae7da80463e908124f604" href="/scinfu/SwiftSoup/blob/master/SwiftSoup.podspec">SwiftSoup.podspec</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="1.7.4" class="message" href="/scinfu/SwiftSoup/commit/9c4d27a7f20a8590a5b370c1dffabc63ddbe0e95">1.7.4</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2018-09-23T17:22:17Z">Sep 23, 2018</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="file" class="octicon octicon-file" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M6 5H2V4h4v1zM2 8h7V7H2v1zm0 2h7V9H2v1zm0 2h7v-1H2v1zm10-7.5V14c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V2c0-.55.45-1 1-1h7.5L12 4.5zM11 5L8 2H1v12h10V5z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title="_config.yml" id="aeb42283af8ef8e9da40ededd3ae2ab2-32d6ac241b2ada7b29fd859569a8438765383bd4" href="/scinfu/SwiftSoup/blob/master/_config.yml">_config.yml</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="Update _config.yml" class="message" href="/scinfu/SwiftSoup/commit/c50201dea2c0cb788fa00c879a5badde7f6e82dc">Update _config.yml</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2017-04-05T14:06:10Z">Apr 5, 2017</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="file" class="octicon octicon-file" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M6 5H2V4h4v1zM2 8h7V7H2v1zm0 2h7V9H2v1zm0 2h7v-1H2v1zm10-7.5V14c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V2c0-.55.45-1 1-1h7.5L12 4.5zM11 5L8 2H1v12h10V5z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title="ci" id="35ea51baf1fe7f0142ad5f950855dde0-cb81c086cbe9b2ce53677a8edfec3e67e5e2333e" href="/scinfu/SwiftSoup/blob/master/ci">ci</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="Install cocoapods beta because it fails with older" class="message" href="/scinfu/SwiftSoup/commit/0664e0a34476c6ef0a60bc1c8650093439a91f4d">Install cocoapods beta because it fails with older</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2018-09-22T09:55:57Z">Sep 22, 2018</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="file" class="octicon octicon-file" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M6 5H2V4h4v1zM2 8h7V7H2v1zm0 2h7V9H2v1zm0 2h7v-1H2v1zm10-7.5V14c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V2c0-.55.45-1 1-1h7.5L12 4.5zM11 5L8 2H1v12h10V5z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title="docker-test.sh" id="885959755540f746b7065bef4eb07c99-6a86fe26c0e68cf6fc6a449ee07e010a7372fa80" href="/scinfu/SwiftSoup/blob/master/docker-test.sh">docker-test.sh</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="Fix compile error on 3.2 on macOS" class="message" href="/scinfu/SwiftSoup/commit/916d5debc83ff72d4c08c08d51fc11e22c1d1a90">Fix compile error on 3.2 on macOS</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2017-09-27T23:30:05Z">Sep 27, 2017</time-ago></span>
</td>
</tr>
<tr class="js-navigation-item">
<td class="icon">
<svg aria-label="file" class="octicon octicon-file" viewBox="0 0 12 16" version="1.1" width="12" height="16" role="img"><path fill-rule="evenodd" d="M6 5H2V4h4v1zM2 8h7V7H2v1zm0 2h7V9H2v1zm0 2h7v-1H2v1zm10-7.5V14c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V2c0-.55.45-1 1-1h7.5L12 4.5zM11 5L8 2H1v12h10V5z"/></svg>
<img width="16" height="16" class="spinner" alt="" src="https://github.githubassets.com/images/spinners/octocat-spinner-32.gif" />
</td>
<td class="content">
<span class="css-truncate css-truncate-target"><a class="js-navigation-open" title="swifsoup.png" id="58e8e0b49420012c0fbf0e78f4b172cc-b15bf4f4a85486a6aefaff9d59801cf570e85258" href="/scinfu/SwiftSoup/blob/master/swifsoup.png">swifsoup.png</a></span>
</td>
<td class="message">
<span class="css-truncate css-truncate-target">
<a data-pjax="true" title="Add files via upload" class="message" href="/scinfu/SwiftSoup/commit/cb5c3d704a8d838a707be073be2097c178bbf7c4">Add files via upload</a>
</span>
</td>
<td class="age">
<span class="css-truncate css-truncate-target"><time-ago datetime="2017-07-14T20:08:41Z">Jul 14, 2017</time-ago></span>
</td>
</tr>
</tbody>
</table>
</div>
<div id="readme" class="Box Box--condensed instapaper_body md js-code-block-container">
<div class="Box-header d-flex flex-items-center flex-justify-between px-2">
<h3 class="Box-title pr-3">
<svg class="octicon octicon-book" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M3 5h4v1H3V5zm0 3h4V7H3v1zm0 2h4V9H3v1zm11-5h-4v1h4V5zm0 2h-4v1h4V7zm0 2h-4v1h4V9zm2-6v9c0 .55-.45 1-1 1H9.5l-1 1-1-1H2c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h5.5l1 1 1-1H15c.55 0 1 .45 1 1zm-8 .5L7.5 3H2v9h6V3.5zm7-.5H9.5l-.5.5V12h6V3z"/></svg>
README.md
</h3>
</div>
<div class="Box-body p-6">
<article class="markdown-body entry-content" itemprop="text"><p align="center">
<a target="_blank" rel="noopener noreferrer" href="https://raw.githubusercontent.com/scinfu/SwiftSoup/master/swifsoup.png"><img src="https://raw.githubusercontent.com/scinfu/SwiftSoup/master/swifsoup.png" alt="SwiftSoup" title="SwiftSoup" style="max-width:100%;"></a>
</p>
<p><a target="_blank" rel="noopener noreferrer" href="https://camo.githubusercontent.com/c84f3afbeb929ac60a66fc40a38279040c40e27b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d4c696e75782532302537432532304f5325323058253230253743253230694f5325323025374325323074764f5325323025374325323077617463684f532d6f72616e67652e737667"><img src="https://camo.githubusercontent.com/c84f3afbeb929ac60a66fc40a38279040c40e27b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d4c696e75782532302537432532304f5325323058253230253743253230694f5325323025374325323074764f5325323025374325323077617463684f532d6f72616e67652e737667" alt="Platform OS X | iOS | tvOS | watchOS | Linux" data-canonical-src="https://img.shields.io/badge/platform-Linux%20%7C%20OS%20X%20%7C%20iOS%20%7C%20tvOS%20%7C%20watchOS-orange.svg" style="max-width:100%;"></a>
<a href="https://github.com/apple/swift-package-manager"><img src="https://camo.githubusercontent.com/e85ea871cbc47fa16742cdb26a466fe9e38cb4ac/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53504d2d636f6d70617469626c652d3442433531442e7376673f7374796c653d666c6174" alt="SPM compatible" data-canonical-src="https://img.shields.io/badge/SPM-compatible-4BC51D.svg?style=flat" style="max-width:100%;"></a>
<a target="_blank" rel="noopener noreferrer" href="https://camo.githubusercontent.com/96733e6a51dc210d4bcb3de7f9a9fb187fb570ae/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2546302539462539302541372532306c696e75782d72656164792d7265642e737667"><img src="https://camo.githubusercontent.com/96733e6a51dc210d4bcb3de7f9a9fb187fb570ae/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2546302539462539302541372532306c696e75782d72656164792d7265642e737667" alt="🐧 linux: ready" data-canonical-src="https://img.shields.io/badge/%F0%9F%90%A7%20linux-ready-red.svg" style="max-width:100%;"></a>
<a target="_blank" rel="noopener noreferrer" href="https://camo.githubusercontent.com/3dc8a44a2c3f7ccd5418008d1295aae48466c141/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f43617274686167652d636f6d70617469626c652d3442433531442e7376673f7374796c653d666c6174"><img src="https://camo.githubusercontent.com/3dc8a44a2c3f7ccd5418008d1295aae48466c141/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f43617274686167652d636f6d70617469626c652d3442433531442e7376673f7374796c653d666c6174" alt="Carthage compatible" data-canonical-src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" style="max-width:100%;"></a>
<a href="https://travis-ci.org/scinfu/SwiftSoup" rel="nofollow"><img src="https://camo.githubusercontent.com/bf2aa75955175de3d7eb579ddf62ea7bace4b2a0/68747470733a2f2f7472617669732d63692e6f72672f7363696e66752f5377696674536f75702e7376673f6272616e63683d6d6173746572" alt="Build Status" data-canonical-src="https://travis-ci.org/scinfu/SwiftSoup.svg?branch=master" style="max-width:100%;"></a>
<a href="http://cocoapods.org/pods/SwiftSoup" rel="nofollow"><img src="https://camo.githubusercontent.com/c521c26c54ab57859a44ca1cbb3ff7477089b4e0/68747470733a2f2f696d672e736869656c64732e696f2f636f636f61706f64732f762f5377696674536f75702e7376673f7374796c653d666c6174" alt="Version" data-canonical-src="https://img.shields.io/cocoapods/v/SwiftSoup.svg?style=flat" style="max-width:100%;"></a>
<a href="http://cocoapods.org/pods/SwiftSoup" rel="nofollow"><img src="https://camo.githubusercontent.com/72080a0f5bedba6d2ab1e6465ee563c79521489a/68747470733a2f2f696d672e736869656c64732e696f2f636f636f61706f64732f6c2f5377696674536f75702e7376673f7374796c653d666c6174" alt="License" data-canonical-src="https://img.shields.io/cocoapods/l/SwiftSoup.svg?style=flat" style="max-width:100%;"></a>
<a href="http://twitter.com/scinfu" rel="nofollow"><img src="https://camo.githubusercontent.com/72841a20e56139a393177bf3d52ab7829aba5fcd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f747769747465722d407363696e66752d626c75652e7376673f7374796c653d666c6174" alt="Twitter" data-canonical-src="https://img.shields.io/badge/twitter-@scinfu-blue.svg?style=flat" style="max-width:100%;"></a></p>
<p><code>SwiftSoup</code> is a pure Swift library, cross-platform (macOS, iOS, tvOS, watchOS and Linux!), for working with real-world HTML. It provides a very convenient API for extracting and manipulating data, using the best of DOM, CSS, and jQuery-like methods.
<code>SwiftSoup</code> implements the WHATWG HTML5 specification, and parses HTML to the same DOM as modern browsers do.</p>
<ul>
<li>Scrape and parse HTML from a URL, file, or string</li>
<li>Find and extract data, using DOM traversal or CSS selectors</li>
<li>Manipulate the HTML elements, attributes, and text</li>
<li>Clean user-submitted content against a safe white-list, to prevent XSS attacks</li>
<li>Output tidy HTML
<code>SwiftSoup</code> is designed to deal with all varieties of HTML found in the wild; from pristine and validating, to invalid tag-soup; <code>SwiftSoup</code> will create a sensible parse tree.</li>
</ul>
<h2><a id="user-content-installation" class="anchor" aria-hidden="true" href="#installation"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Installation</h2>
<h3><a id="user-content-cocoapods" class="anchor" aria-hidden="true" href="#cocoapods"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cocoapods</h3>
<p>SwiftSoup is available through <a href="http://cocoapods.org" rel="nofollow">CocoaPods</a>. To install
it, simply add the following line to your Podfile:</p>
<div class="highlight highlight-source-ruby"><pre>pod <span class="pl-s"><span class="pl-pds">'</span>SwiftSoup<span class="pl-pds">'</span></span></pre></div>
<h3><a id="user-content-carthage" class="anchor" aria-hidden="true" href="#carthage"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Carthage</h3>
<p>SwiftSoup is also available through <a href="https://github.com/Carthage/Carthage">Carthage</a>. To install
it, simply add the following line to your Cartfile:</p>
<div class="highlight highlight-source-ruby"><pre>github <span class="pl-s"><span class="pl-pds">"</span>scinfu/SwiftSoup<span class="pl-pds">"</span></span></pre></div>
<h3><a id="user-content-swift-package-manager" class="anchor" aria-hidden="true" href="#swift-package-manager"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Swift Package Manager</h3>
<p>SwiftSoup is also available through <a href="https://github.com/apple/swift-package-manager">Swift Package Manager</a>.
To install it, simply add the dependency to your Package.Swift file:</p>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">...</span>
dependencies<span class="pl-k">:</span> [
.<span class="pl-c1">package</span>(<span class="pl-c1">url</span>: <span class="pl-s"><span class="pl-pds">"</span>https://github.com/scinfu/SwiftSoup.git<span class="pl-pds">"</span></span>, <span class="pl-c1">from</span>: <span class="pl-s"><span class="pl-pds">"</span>1.7.4<span class="pl-pds">"</span></span>),
],
targets<span class="pl-k">:</span> [
.<span class="pl-c1">target</span>( <span class="pl-c1">name</span>: <span class="pl-s"><span class="pl-pds">"</span>YourTarget<span class="pl-pds">"</span></span>, <span class="pl-c1">dependencies</span>: [<span class="pl-s"><span class="pl-pds">"</span>SwiftSoup<span class="pl-pds">"</span></span>]),
]
<span class="pl-k">...</span></pre></div>
<h2><a id="user-content-try" class="anchor" aria-hidden="true" href="#try"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Try</h2>
<h3><a id="user-content-try-out-the-simple-online-css-selectors-site" class="anchor" aria-hidden="true" href="#try-out-the-simple-online-css-selectors-site"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Try out the simple online CSS selectors site:</h3>
<p><a href="https://swiftsoup.herokuapp.com/" rel="nofollow">SwiftSoup Test Site</a></p>
<h3><a id="user-content-try-out-the-example-project-opening-terminal-and-type" class="anchor" aria-hidden="true" href="#try-out-the-example-project-opening-terminal-and-type"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Try out the example project opening Terminal and type:</h3>
<div class="highlight highlight-source-shell"><pre>pod try SwiftSoup</pre></div>
<p align="center">
<a target="_blank" rel="noopener noreferrer" href="https://raw.githubusercontent.com/scinfu/SwiftSoup/master/Example/img1.png"><img src="https://raw.githubusercontent.com/scinfu/SwiftSoup/master/Example/img1.png" alt="SwiftSoup" title="SwiftSoup" style="max-width:100%;"></a>
<a target="_blank" rel="noopener noreferrer" href="https://raw.githubusercontent.com/scinfu/SwiftSoup/master/Example/img2.png"><img src="https://raw.githubusercontent.com/scinfu/SwiftSoup/master/Example/img2.png" alt="SwiftSoup" title="SwiftSoup" style="max-width:100%;"></a>
</p>
<h1><a id="user-content-to-parse-an-html-document" class="anchor" aria-hidden="true" href="#to-parse-an-html-document"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>To parse an HTML document:</h1>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">do</span> {
<span class="pl-k">let</span> html <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;html&gt;&lt;head&gt;&lt;title&gt;First parse&lt;/title&gt;&lt;/head&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;body&gt;&lt;p&gt;Parsed HTML into a doc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">let</span> doc<span class="pl-k">:</span> Document <span class="pl-k">=</span> <span class="pl-k">try</span> SwiftSoup.<span class="pl-c1">parse</span>(html)
<span class="pl-k">return</span> <span class="pl-k">try</span> doc.<span class="pl-c1">text</span>()
} <span class="pl-k">catch</span> Exception.<span class="pl-c1">Error</span>(<span class="pl-k">let</span> type, <span class="pl-k">let</span> message) {
<span class="pl-c1">print</span>(message)
} <span class="pl-k">catch</span> {
<span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">"</span>error<span class="pl-pds">"</span></span>)
}</pre></div>
<ul>
<li>Unclosed tags (e.g. <code>&lt;p&gt;Lorem &lt;p&gt;Ipsum</code> parses to <code>&lt;p&gt;Lorem&lt;/p&gt; &lt;p&gt;Ipsum&lt;/p&gt;</code>)</li>
<li>Implicit tags (e.g. a naked <code>&lt;td&gt;Table data&lt;/td&gt;</code> is wrapped into a <code>&lt;table&gt;&lt;tr&gt;&lt;td&gt;...</code>)</li>
<li>Reliably creating the document structure (<code>html</code> containing a <code>head</code> and <code>body</code>, and only appropriate elements within the head)</li>
</ul>
<h3><a id="user-content-the-object-model-of-a-document" class="anchor" aria-hidden="true" href="#the-object-model-of-a-document"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>The object model of a document</h3>
<ul>
<li>Documents consist of Elements and TextNodes</li>
<li>The inheritance chain is: <code>Document</code> extends <code>Element</code> extends <code>Node.TextNode</code> extends <code>Node</code>.</li>
<li>An Element contains a list of children Nodes, and has one parent Element. They also have provide a filtered list of child Elements only.</li>
</ul>
<h1><a id="user-content-extract-attributes-text-and-html-from-elements" class="anchor" aria-hidden="true" href="#extract-attributes-text-and-html-from-elements"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Extract attributes, text, and HTML from elements</h1>
<h3><a id="user-content-problem" class="anchor" aria-hidden="true" href="#problem"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Problem</h3>
<p>After parsing a document, and finding some elements, you'll want to get at the data inside those elements.</p>
<h3><a id="user-content-solution" class="anchor" aria-hidden="true" href="#solution"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Solution</h3>
<ul>
<li>To get the value of an attribute, use the <code>Node.attr(_ String key)</code> method</li>
<li>For the text on an element (and its combined children), use <code>Element.text()</code></li>
<li>For HTML, use <code>Element.html()</code>, or <code>Node.outerHtml()</code> as appropriate</li>
</ul>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">do</span> {
<span class="pl-k">let</span> html<span class="pl-k">:</span> <span class="pl-c1">String</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;p&gt;An &lt;a href='http://example.com/'&gt;&lt;b&gt;example&lt;/b&gt;&lt;/a&gt; link.&lt;/p&gt;<span class="pl-pds">"</span></span>;
<span class="pl-k">let</span> doc<span class="pl-k">:</span> Document <span class="pl-k">=</span> <span class="pl-k">try</span> SwiftSoup.<span class="pl-c1">parse</span>(html)
<span class="pl-k">let</span> link<span class="pl-k">:</span> <span class="pl-c1">Element</span> <span class="pl-k">=</span> <span class="pl-k">try</span> doc.<span class="pl-c1">select</span>(<span class="pl-s"><span class="pl-pds">"</span>a<span class="pl-pds">"</span></span>).<span class="pl-c1">first</span>()<span class="pl-k">!</span>
<span class="pl-k">let</span> text<span class="pl-k">:</span> <span class="pl-c1">String</span> <span class="pl-k">=</span> <span class="pl-k">try</span> doc.<span class="pl-c1">body</span>()<span class="pl-k">!</span>.<span class="pl-c1">text</span>(); <span class="pl-c"><span class="pl-c">//</span> "An example link"</span>
<span class="pl-c"></span> <span class="pl-k">let</span> linkHref<span class="pl-k">:</span> <span class="pl-c1">String</span> <span class="pl-k">=</span> <span class="pl-k">try</span> link.<span class="pl-c1">attr</span>(<span class="pl-s"><span class="pl-pds">"</span>href<span class="pl-pds">"</span></span>); <span class="pl-c"><span class="pl-c">//</span> "http://example.com/"</span>
<span class="pl-c"></span> <span class="pl-k">let</span> linkText<span class="pl-k">:</span> <span class="pl-c1">String</span> <span class="pl-k">=</span> <span class="pl-k">try</span> link.<span class="pl-c1">text</span>(); <span class="pl-c"><span class="pl-c">//</span> "example""</span>
<span class="pl-c"></span>
<span class="pl-k">let</span> linkOuterH<span class="pl-k">:</span> <span class="pl-c1">String</span> <span class="pl-k">=</span> <span class="pl-k">try</span> link.<span class="pl-c1">outerHtml</span>(); <span class="pl-c"><span class="pl-c">//</span> "&lt;a href="http://example.com"&gt;&lt;b&gt;example&lt;/b&gt;&lt;/a&gt;"</span>
<span class="pl-c"></span> <span class="pl-k">let</span> linkInnerH<span class="pl-k">:</span> <span class="pl-c1">String</span> <span class="pl-k">=</span> <span class="pl-k">try</span> link.<span class="pl-c1">html</span>(); <span class="pl-c"><span class="pl-c">//</span> "&lt;b&gt;example&lt;/b&gt;"</span>
<span class="pl-c"></span>} <span class="pl-k">catch</span> Exception.<span class="pl-c1">Error</span>(<span class="pl-k">let</span> type, <span class="pl-k">let</span> message) {
<span class="pl-c1">print</span>(message)
} <span class="pl-k">catch</span> {
<span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">"</span>error<span class="pl-pds">"</span></span>)
}</pre></div>
<h3><a id="user-content-description" class="anchor" aria-hidden="true" href="#description"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Description</h3>
<p>The methods above are the core of the element data access methods. There are additional others:</p>
<ul>
<li><code>Element.id()</code></li>
<li><code>Element.tagName()</code></li>
<li><code>Element.className()</code> and <code>Element.hasClass(_ String className)</code></li>
</ul>
<p>All of these accessor methods have corresponding setter methods to change the data.</p>
<h1><a id="user-content-parse-a-document-from-a-string" class="anchor" aria-hidden="true" href="#parse-a-document-from-a-string"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Parse a document from a String</h1>
<h3><a id="user-content-problem-1" class="anchor" aria-hidden="true" href="#problem-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Problem</h3>
<p>You have HTML in a Swift String, and you want to parse that HTML to get at its contents, or to make sure it's well formed, or to modify it. The String may have come from user input, a file, or from the web.</p>
<h3><a id="user-content-solution-1" class="anchor" aria-hidden="true" href="#solution-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Solution</h3>
<p>Use the static <code>SwiftSoup.parse(_ html: String)</code> method, or <code>SwiftSoup.parse(_ html: String, _ baseUri: String)</code>.</p>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">do</span> {
<span class="pl-k">let</span> html <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;html&gt;&lt;head&gt;&lt;title&gt;First parse&lt;/title&gt;&lt;/head&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;body&gt;&lt;p&gt;Parsed HTML into a doc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">let</span> doc<span class="pl-k">:</span> Document <span class="pl-k">=</span> <span class="pl-k">try</span> SwiftSoup.<span class="pl-c1">parse</span>(html)
<span class="pl-k">return</span> <span class="pl-k">try</span> doc.<span class="pl-c1">text</span>()
} <span class="pl-k">catch</span> Exception.<span class="pl-c1">Error</span>(<span class="pl-k">let</span> type, <span class="pl-k">let</span> message) {
<span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>)
} <span class="pl-k">catch</span> {
<span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>)
}</pre></div>
<h3><a id="user-content-description-1" class="anchor" aria-hidden="true" href="#description-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Description</h3>
<p>The <code>parse(_ html: String, _ baseUri: String)</code> method parses the input HTML into a new <code>Document</code>. The base URI argument is used to resolve relative URLs into absolute URLs, and should be set to the URL where the document was fetched from. If that's not applicable, or if you know the HTML has a base element, you can use the <code>parse(_ html: String)</code> method.</p>
<p>As long as you pass in a non-null string, you're guaranteed to have a successful, sensible parse, with a Document containing (at least) a <code>head</code> and a <code>body</code> element.</p>
<p>Once you have a <code>Document</code>, you can get at the data using the appropriate methods in <code>Document</code> and its supers <code>Element</code> and <code>Node</code>.</p>
<h1><a id="user-content-parsing-a-body-fragment" class="anchor" aria-hidden="true" href="#parsing-a-body-fragment"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Parsing a body fragment</h1>
<h3><a id="user-content-problem-2" class="anchor" aria-hidden="true" href="#problem-2"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Problem</h3>
<p>You have a fragment of body HTML (e.g. <code>div</code> containing a couple of p tags; as opposed to a full HTML document) that you want to parse. Perhaps it was provided by a user submitting a comment, or editing the body of a page in a CMS.</p>
<h3><a id="user-content-solution-2" class="anchor" aria-hidden="true" href="#solution-2"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Solution</h3>
<p>Use the <code>SwiftSoup.parseBodyFragment(_ html: String)</code> method.</p>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">do</span> {
<span class="pl-k">let</span> html<span class="pl-k">:</span> <span class="pl-c1">String</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;div&gt;&lt;p&gt;Lorem ipsum.&lt;/p&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">let</span> doc<span class="pl-k">:</span> Document <span class="pl-k">=</span> <span class="pl-k">try</span> SwiftSoup.<span class="pl-c1">parseBodyFragment</span>(html)
<span class="pl-k">let</span> body<span class="pl-k">:</span> <span class="pl-c1">Element</span><span class="pl-k">?</span> <span class="pl-k">=</span> doc.<span class="pl-c1">body</span>()
} <span class="pl-k">catch</span> Exception.<span class="pl-c1">Error</span>(<span class="pl-k">let</span> type, <span class="pl-k">let</span> message) {
<span class="pl-c1">print</span>(message)
} <span class="pl-k">catch</span> {
<span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">"</span>error<span class="pl-pds">"</span></span>)
}</pre></div>
<h3><a id="user-content-description-2" class="anchor" aria-hidden="true" href="#description-2"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Description</h3>
<p>The <code>parseBodyFragment</code> method creates an empty shell document, and inserts the parsed HTML into the <code>body</code> element. If you used the normal <code>SwiftSoup(_ html: String)</code> method, you would generally get the same result, but explicitly treating the input as a body fragment ensures that any bozo HTML provided by the user is parsed into the <code>body</code> element.</p>
<p>The <code>Document.body()</code> method retrieves the element children of the document's <code>body</code> element; it is equivalent to <code>doc.getElementsByTag("body")</code>.</p>
<h3><a id="user-content-stay-safe" class="anchor" aria-hidden="true" href="#stay-safe"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Stay safe</h3>
<p>If you are going to accept HTML input from a user, you need to be careful to avoid cross-site scripting attacks. See the documentation for the <code>Whitelist</code> based cleaner, and clean the input with <code>clean(String bodyHtml, Whitelist whitelist)</code>.</p>
<h1><a id="user-content-sanitize-untrusted-html-to-prevent-xss" class="anchor" aria-hidden="true" href="#sanitize-untrusted-html-to-prevent-xss"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Sanitize untrusted HTML (to prevent XSS)</h1>
<h3><a id="user-content-problem-3" class="anchor" aria-hidden="true" href="#problem-3"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Problem</h3>
<p>You want to allow untrusted users to supply HTML for output on your website (e.g. as comment submission). You need to clean this HTML to avoid <a href="https://en.wikipedia.org/wiki/Cross-site_scripting" rel="nofollow">cross-site scripting</a> (XSS) attacks.</p>
<h3><a id="user-content-solution-3" class="anchor" aria-hidden="true" href="#solution-3"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Solution</h3>
<p>Use the SwiftSoup HTML <code>Cleaner</code> with a configuration specified by a <code>Whitelist</code>.</p>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">do</span> {
<span class="pl-k">let</span> unsafe<span class="pl-k">:</span> <span class="pl-c1">String</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;p&gt;&lt;a href='http://example.com/' onclick='stealCookies()'&gt;Link&lt;/a&gt;&lt;/p&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">let</span> safe<span class="pl-k">:</span> <span class="pl-c1">String</span> <span class="pl-k">=</span> <span class="pl-k">try</span> SwiftSoup.<span class="pl-c1">clean</span>(unsafe, Whitelist.<span class="pl-c1">basic</span>())<span class="pl-k">!</span>
<span class="pl-c"><span class="pl-c">//</span> now: &lt;p&gt;&lt;a href="http://example.com/" rel="nofollow"&gt;Link&lt;/a&gt;&lt;/p&gt;</span>
<span class="pl-c"></span>} <span class="pl-k">catch</span> Exception.<span class="pl-c1">Error</span>(<span class="pl-k">let</span> type, <span class="pl-k">let</span> message) {
<span class="pl-c1">print</span>(message)
} <span class="pl-k">catch</span> {
<span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">"</span>error<span class="pl-pds">"</span></span>)
}</pre></div>
<h3><a id="user-content-discussion" class="anchor" aria-hidden="true" href="#discussion"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Discussion</h3>
<p>A cross-site scripting attack against your site can really ruin your day, not to mention your users'. Many sites avoid XSS attacks by not allowing HTML in user submitted content: they enforce plain text only, or use an alternative markup syntax like wiki-text or Markdown. These are seldom optimal solutions for the user, as they lower expressiveness, and force the user to learn a new syntax.</p>
<p>A better solution may be to use a rich text WYSIWYG editor (like <a href="http://ckeditor.com" rel="nofollow">CKEditor</a> or <a href="https://www.tinymce.com" rel="nofollow">TinyMCE</a>). These output HTML, and allow the user to work visually. However, their validation is done on the client side: you need to apply a server-side validation to clean up the input and ensure the HTML is safe to place on your site. Otherwise, an attacker can avoid the client-side Javascript validation and inject unsafe HMTL directly into your site</p>
<p>The SwiftSoup whitelist sanitizer works by parsing the input HTML (in a safe, sand-boxed environment), and then iterating through the parse tree and only allowing known-safe tags and attributes (and values) through into the cleaned output.</p>
<p>It does not use regular expressions, which are inappropriate for this task.</p>
<p>SwiftSoup provides a range of <code>Whitelist</code> configurations to suit most requirements; they can be modified if necessary, but take care.</p>
<p>The cleaner is useful not only for avoiding XSS, but also in limiting the range of elements the user can provide: you may be OK with textual <code>a</code>, <code>strong</code> elements, but not structural <code>div</code> or <code>table</code> elements.</p>
<h3><a id="user-content-see-also" class="anchor" aria-hidden="true" href="#see-also"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>See also</h3>
<ul>
<li>See the <a href="http://ha.ckers.org/xss.html" rel="nofollow">XSS cheat sheet</a> and filter evasion guide, as an example of how regular-expression filters don't work, and why a safe whitelist parser-based sanitizer is the correct approach.</li>
<li>See the <code>Cleaner</code> reference if you want to get a <code>Document</code> instead of a String return</li>
<li>See the <code>Whitelist</code> reference for the different canned options, and to create a custom whitelist</li>
<li>The <a href="https://en.wikipedia.org/wiki/Nofollow" rel="nofollow">nofollow</a> link attribute</li>
</ul>
<h1><a id="user-content-set-attribute-values" class="anchor" aria-hidden="true" href="#set-attribute-values"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Set attribute values</h1>
<h3><a id="user-content-problem-4" class="anchor" aria-hidden="true" href="#problem-4"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Problem</h3>
<p>You have a parsed document that you would like to update attribute values on, before saving it out to disk, or sending it on as a HTTP response.</p>
<h3><a id="user-content-solution-4" class="anchor" aria-hidden="true" href="#solution-4"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Solution</h3>
<p>Use the attribute setter methods <code>Element.attr(_ key: String, _ value: String)</code>, and <code>Elements.attr(_ key: String, _ value: String)</code>.</p>
<p>If you need to modify the class attribute of an element, use the <code>Element.addClass(_ className: String)</code> and <code>Element.removeClass(_ className: String)</code> methods.</p>
<p>The <code>Elements</code> collection has bulk attribute and class methods. For example, to add a <code>rel="nofollow"</code> attribute to every <code>a</code> element inside a div:</p>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">do</span> {
<span class="pl-k">try</span> doc.<span class="pl-c1">select</span>(<span class="pl-s"><span class="pl-pds">"</span>div.comments a<span class="pl-pds">"</span></span>).<span class="pl-c1">attr</span>(<span class="pl-s"><span class="pl-pds">"</span>rel<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>nofollow<span class="pl-pds">"</span></span>)
} <span class="pl-k">catch</span> Exception.<span class="pl-c1">Error</span>(<span class="pl-k">let</span> type, <span class="pl-k">let</span> message) {
<span class="pl-c1">print</span>(message)
} <span class="pl-k">catch</span> {
<span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">"</span>error<span class="pl-pds">"</span></span>)
}</pre></div>
<h3><a id="user-content-description-3" class="anchor" aria-hidden="true" href="#description-3"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Description</h3>
<p>Like the other methods in <code>Element</code>, the attr methods return the current <code>Element</code> (or <code>Elements</code> when working on a collection from a select). This allows convenient method chaining:</p>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">do</span> {
<span class="pl-k">try</span> doc.<span class="pl-c1">select</span>(<span class="pl-s"><span class="pl-pds">"</span>div.masthead<span class="pl-pds">"</span></span>).<span class="pl-c1">attr</span>(<span class="pl-s"><span class="pl-pds">"</span>title<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>swiftsoup<span class="pl-pds">"</span></span>).<span class="pl-c1">addClass</span>(<span class="pl-s"><span class="pl-pds">"</span>round-box<span class="pl-pds">"</span></span>);
} <span class="pl-k">catch</span> Exception.<span class="pl-c1">Error</span>(<span class="pl-k">let</span> type, <span class="pl-k">let</span> message) {
<span class="pl-c1">print</span>(message)
} <span class="pl-k">catch</span> {
<span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">"</span>error<span class="pl-pds">"</span></span>)
}</pre></div>
<h1><a id="user-content-set-the-html-of-an-element" class="anchor" aria-hidden="true" href="#set-the-html-of-an-element"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Set the HTML of an element</h1>
<h3><a id="user-content-problem-5" class="anchor" aria-hidden="true" href="#problem-5"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Problem</h3>
<p>You need to modify the HTML of an element.</p>
<h3><a id="user-content-solution-5" class="anchor" aria-hidden="true" href="#solution-5"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Solution</h3>
<p>Use the HTML setter methods in <code>Element</code>:</p>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">do</span> {
<span class="pl-k">let</span> doc<span class="pl-k">:</span> Document <span class="pl-k">=</span> <span class="pl-k">try</span> SwiftSoup.<span class="pl-c1">parse</span>(<span class="pl-s"><span class="pl-pds">"</span>&lt;div&gt;One&lt;/div&gt;&lt;span&gt;One&lt;/span&gt;<span class="pl-pds">"</span></span>)
<span class="pl-k">let</span> div<span class="pl-k">:</span> <span class="pl-c1">Element</span> <span class="pl-k">=</span> <span class="pl-k">try</span> doc.<span class="pl-c1">select</span>(<span class="pl-s"><span class="pl-pds">"</span>div<span class="pl-pds">"</span></span>).<span class="pl-c1">first</span>()<span class="pl-k">!</span> <span class="pl-c"><span class="pl-c">//</span> &lt;div&gt;&lt;/div&gt;</span>
<span class="pl-c"></span> <span class="pl-k">try</span> div.<span class="pl-c1">html</span>(<span class="pl-s"><span class="pl-pds">"</span>&lt;p&gt;lorem ipsum&lt;/p&gt;<span class="pl-pds">"</span></span>) <span class="pl-c"><span class="pl-c">//</span> &lt;div&gt;&lt;p&gt;lorem ipsum&lt;/p&gt;&lt;/div&gt;</span>
<span class="pl-c"></span> <span class="pl-k">try</span> div.<span class="pl-c1">prepend</span>(<span class="pl-s"><span class="pl-pds">"</span>&lt;p&gt;First&lt;/p&gt;<span class="pl-pds">"</span></span>)
<span class="pl-k">try</span> div.<span class="pl-c1">append</span>(<span class="pl-s"><span class="pl-pds">"</span>&lt;p&gt;Last&lt;/p&gt;<span class="pl-pds">"</span></span>)
<span class="pl-c1">print</span>(div)
<span class="pl-c"><span class="pl-c">//</span> now div is: &lt;div&gt;&lt;p&gt;First&lt;/p&gt;&lt;p&gt;lorem ipsum&lt;/p&gt;&lt;p&gt;Last&lt;/p&gt;&lt;/div&gt;</span>
<span class="pl-c"></span>
<span class="pl-k">let</span> span<span class="pl-k">:</span> <span class="pl-c1">Element</span> <span class="pl-k">=</span> <span class="pl-k">try</span> doc.<span class="pl-c1">select</span>(<span class="pl-s"><span class="pl-pds">"</span>span<span class="pl-pds">"</span></span>).<span class="pl-c1">first</span>()<span class="pl-k">!</span> <span class="pl-c"><span class="pl-c">//</span> &lt;span&gt;One&lt;/span&gt;</span>
<span class="pl-c"></span> <span class="pl-k">try</span> span.<span class="pl-c1">wrap</span>(<span class="pl-s"><span class="pl-pds">"</span>&lt;li&gt;&lt;a href='http://example.com/'&gt;&lt;/a&gt;&lt;/li&gt;<span class="pl-pds">"</span></span>)
<span class="pl-c1">print</span>(doc)
<span class="pl-c"><span class="pl-c">//</span> now: &lt;li&gt;&lt;a href="http://example.com/"&gt;&lt;span&gt;One&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;</span>
<span class="pl-c"></span>} <span class="pl-k">catch</span> Exception.<span class="pl-c1">Error</span>(<span class="pl-k">let</span> type, <span class="pl-k">let</span> message) {
<span class="pl-c1">print</span>(message)
} <span class="pl-k">catch</span> {
<span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">"</span>error<span class="pl-pds">"</span></span>)
}</pre></div>
<h3><a id="user-content-discussion-1" class="anchor" aria-hidden="true" href="#discussion-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Discussion</h3>
<ul>
<li><code>Element.html(_ html: String)</code> clears any existing inner HTML in an element, and replaces it with parsed HTML.</li>
<li><code>Element.prepend(_ first: String)</code> and <code>Element.append(_ last: String)</code> add HTML to the start or end of an element's inner HTML, respectively</li>
<li><code>Element.wrap(_ around: String)</code> wraps HTML around the outer HTML of an element.</li>
</ul>
<h3><a id="user-content-see-also-1" class="anchor" aria-hidden="true" href="#see-also-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>See also</h3>
<p>You can also use the <code>Element.prependElement(_ tag: String)</code> and <code>Element.appendElement(_ tag: String)</code> methods to create new elements and insert them into the document flow as a child element.</p>
<h1><a id="user-content-setting-the-text-content-of-elements" class="anchor" aria-hidden="true" href="#setting-the-text-content-of-elements"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Setting the text content of elements</h1>
<h3><a id="user-content-problem-6" class="anchor" aria-hidden="true" href="#problem-6"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Problem</h3>
<p>You need to modify the text content of an HTML document.</p>
<h1><a id="user-content-solution-6" class="anchor" aria-hidden="true" href="#solution-6"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Solution</h1>
<p>Use the text setter methods of <code>Element</code>:</p>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">do</span> {
<span class="pl-k">let</span> doc<span class="pl-k">:</span> Document <span class="pl-k">=</span> <span class="pl-k">try</span> SwiftSoup.<span class="pl-c1">parse</span>(<span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>)
<span class="pl-k">let</span> div<span class="pl-k">:</span> <span class="pl-c1">Element</span> <span class="pl-k">=</span> <span class="pl-k">try</span> doc.<span class="pl-c1">select</span>(<span class="pl-s"><span class="pl-pds">"</span>div<span class="pl-pds">"</span></span>).<span class="pl-c1">first</span>()<span class="pl-k">!</span> <span class="pl-c"><span class="pl-c">//</span> &lt;div&gt;&lt;/div&gt;</span>
<span class="pl-c"></span> <span class="pl-k">try</span> div.<span class="pl-c1">text</span>(<span class="pl-s"><span class="pl-pds">"</span>five &gt; four<span class="pl-pds">"</span></span>) <span class="pl-c"><span class="pl-c">//</span> &lt;div&gt;five &amp;gt; four&lt;/div&gt;</span>
<span class="pl-c"></span> <span class="pl-k">try</span> div.<span class="pl-c1">prepend</span>(<span class="pl-s"><span class="pl-pds">"</span>First <span class="pl-pds">"</span></span>)
<span class="pl-k">try</span> div.<span class="pl-c1">append</span>(<span class="pl-s"><span class="pl-pds">"</span> Last<span class="pl-pds">"</span></span>)
<span class="pl-c"><span class="pl-c">//</span> now: &lt;div&gt;First five &amp;gt; four Last&lt;/div&gt;</span>
<span class="pl-c"></span>} <span class="pl-k">catch</span> Exception.<span class="pl-c1">Error</span>(<span class="pl-k">let</span> type, <span class="pl-k">let</span> message) {
<span class="pl-c1">print</span>(message)
} <span class="pl-k">catch</span> {
<span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">"</span>error<span class="pl-pds">"</span></span>)
}</pre></div>
<h3><a id="user-content-discussion-2" class="anchor" aria-hidden="true" href="#discussion-2"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Discussion</h3>
<p>The text setter methods mirror the [[HTML setter|Set the HTML of an element]] methods:</p>
<ul>
<li><code>Element.text(_ text: String)</code> clears any existing inner HTML in an element, and replaces it with the supplied text.</li>
<li><code>Element.prepend(_ first: String)</code> and <code>Element.append(_ last: String)</code> add text nodes to the start or end of an element's inner HTML, respectively
The text should be supplied unencoded: characters like <code>&lt;</code>, <code>&gt;</code> etc will be treated as literals, not HTML.</li>
</ul>
<h1><a id="user-content-use-dom-methods-to-navigate-a-document" class="anchor" aria-hidden="true" href="#use-dom-methods-to-navigate-a-document"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Use DOM methods to navigate a document</h1>
<h3><a id="user-content-problem-7" class="anchor" aria-hidden="true" href="#problem-7"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Problem</h3>
<p>You have a HTML document that you want to extract data from. You know generally the structure of the HTML document.</p>
<h3><a id="user-content-solution-7" class="anchor" aria-hidden="true" href="#solution-7"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Solution</h3>
<p>Use the DOM-like methods available after parsing HTML into a <code>Document</code>.</p>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">do</span> {
<span class="pl-k">let</span> html<span class="pl-k">:</span> <span class="pl-c1">String</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;a id=1 href='?foo=bar&amp;mid&amp;lt=true'&gt;One&lt;/a&gt; &lt;a id=2 href='?foo=bar&amp;lt;qux&amp;lg=1'&gt;Two&lt;/a&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">let</span> els<span class="pl-k">:</span> <span class="pl-c1">Elements</span> <span class="pl-k">=</span> <span class="pl-k">try</span> SwiftSoup.<span class="pl-c1">parse</span>(html).<span class="pl-c1">select</span>(<span class="pl-s"><span class="pl-pds">"</span>a<span class="pl-pds">"</span></span>)
<span class="pl-k">for</span> link<span class="pl-k">:</span> <span class="pl-c1">Element</span> <span class="pl-k">in</span> els.<span class="pl-c1">array</span>() {
<span class="pl-k">let</span> linkHref<span class="pl-k">:</span> <span class="pl-c1">String</span> <span class="pl-k">=</span> <span class="pl-k">try</span> link.<span class="pl-c1">attr</span>(<span class="pl-s"><span class="pl-pds">"</span>href<span class="pl-pds">"</span></span>)
<span class="pl-k">let</span> linkText<span class="pl-k">:</span> <span class="pl-c1">String</span> <span class="pl-k">=</span> <span class="pl-k">try</span> link.<span class="pl-c1">text</span>()
}
} <span class="pl-k">catch</span> Exception.<span class="pl-c1">Error</span>(<span class="pl-k">let</span> type, <span class="pl-k">let</span> message) {
<span class="pl-c1">print</span>(message)
} <span class="pl-k">catch</span> {
<span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">"</span>error<span class="pl-pds">"</span></span>)
}</pre></div>
<h3><a id="user-content-description-4" class="anchor" aria-hidden="true" href="#description-4"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Description</h3>
<p>Elements provide a range of DOM-like methods to find elements, and extract and manipulate their data. The DOM getters are contextual: called on a parent Document they find matching elements under the document; called on a child element they find elements under that child. In this way you can window in on the data you want.</p>
<h3><a id="user-content-finding-elements" class="anchor" aria-hidden="true" href="#finding-elements"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Finding elements</h3>
<ul>
<li><code>getElementById(_ id: String)</code></li>
<li><code>getElementsByTag(_ tag:String)</code></li>
<li><code>getElementsByClass(_ className: String)</code></li>
<li><code>getElementsByAttribute(_ key: String)</code> (and related methods)</li>
<li>Element siblings: <code>siblingElements()</code>, <code>firstElementSibling()</code>, <code>lastElementSibling()</code>, <code>nextElementSibling()</code>, <code>previousElementSibling()</code></li>
<li>Graph: <code>parent()</code>, <code>children()</code>, <code>child(_ index: Int)</code></li>
</ul>
<h1><a id="user-content-element-data" class="anchor" aria-hidden="true" href="#element-data"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Element data</h1>
<ul>
<li><code>attr(_ key: Strin)</code> to get and <code>attr(_ key: String, _ value: String)</code> to set attributes</li>
<li><code>attributes()</code> to get all attributes</li>
<li><code>id()</code>, <code>className()</code> and <code>classNames()</code></li>
<li><code>text()</code> to get and <code>text(_ value: String)</code> to set the text content</li>
<li><code>html()</code> to get and <code>html(_ value: String)</code> to set the inner HTML content</li>
<li><code>outerHtml()</code> to get the outer HTML value</li>
<li><code>data()</code> to get data content (e.g. of script and style tags)</li>
<li><code>tag()</code> and <code>tagName()</code></li>
</ul>
<h3><a id="user-content-manipulating-html-and-text" class="anchor" aria-hidden="true" href="#manipulating-html-and-text"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Manipulating HTML and text</h3>
<ul>
<li><code>append(_ html: String)</code>, <code>prepend(html: String)</code></li>
<li><code>appendText(text: String)</code>, <code>prependText(text: String)</code></li>
<li><code>appendElement(tagName: String)</code>, <code>prependElement(tagName: String)</code></li>
<li><code>html(_ value: String)</code></li>
</ul>
<h1><a id="user-content-use-selector-syntax-to-find-elements" class="anchor" aria-hidden="true" href="#use-selector-syntax-to-find-elements"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Use selector syntax to find elements</h1>
<h3><a id="user-content-problem-8" class="anchor" aria-hidden="true" href="#problem-8"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Problem</h3>
<p>You want to find or manipulate elements using a CSS or jQuery-like selector syntax.</p>
<h3><a id="user-content-solution-8" class="anchor" aria-hidden="true" href="#solution-8"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Solution</h3>
<p>Use the <code>Element.select(_ selector: String)</code> and <code>Elements.select(_ selector: String)</code> methods:</p>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">do</span> {
<span class="pl-k">let</span> doc<span class="pl-k">:</span> Document <span class="pl-k">=</span> <span class="pl-k">try</span> SwiftSoup.<span class="pl-c1">parse</span>(<span class="pl-s"><span class="pl-pds">"</span>...<span class="pl-pds">"</span></span>)
<span class="pl-k">let</span> links<span class="pl-k">:</span> <span class="pl-c1">Elements</span> <span class="pl-k">=</span> <span class="pl-k">try</span> doc.<span class="pl-c1">select</span>(<span class="pl-s"><span class="pl-pds">"</span>a[href]<span class="pl-pds">"</span></span>) <span class="pl-c"><span class="pl-c">//</span> a with href</span>
<span class="pl-c"></span> <span class="pl-k">let</span> pngs<span class="pl-k">:</span> <span class="pl-c1">Elements</span> <span class="pl-k">=</span> <span class="pl-k">try</span> doc.<span class="pl-c1">select</span>(<span class="pl-s"><span class="pl-pds">"</span>img[src$=.png]<span class="pl-pds">"</span></span>)
<span class="pl-c"><span class="pl-c">//</span> img with src ending .png</span>
<span class="pl-c"></span> <span class="pl-k">let</span> masthead<span class="pl-k">:</span> <span class="pl-c1">Element</span><span class="pl-k">?</span> <span class="pl-k">=</span> <span class="pl-k">try</span> doc.<span class="pl-c1">select</span>(<span class="pl-s"><span class="pl-pds">"</span>div.masthead<span class="pl-pds">"</span></span>).<span class="pl-c1">first</span>()
<span class="pl-c"><span class="pl-c">//</span> div with class=masthead</span>
<span class="pl-c"></span> <span class="pl-k">let</span> resultLinks<span class="pl-k">:</span> <span class="pl-c1">Elements</span><span class="pl-k">?</span> <span class="pl-k">=</span> <span class="pl-k">try</span> doc.<span class="pl-c1">select</span>(<span class="pl-s"><span class="pl-pds">"</span>h3.r &gt; a<span class="pl-pds">"</span></span>) <span class="pl-c"><span class="pl-c">//</span> direct a after h3</span>
<span class="pl-c"></span>} <span class="pl-k">catch</span> Exception.<span class="pl-c1">Error</span>(<span class="pl-k">let</span> type, <span class="pl-k">let</span> message) {
<span class="pl-c1">print</span>(message)
} <span class="pl-k">catch</span> {
<span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">"</span>error<span class="pl-pds">"</span></span>)
}</pre></div>
<h3><a id="user-content-description-5" class="anchor" aria-hidden="true" href="#description-5"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Description</h3>
<p>SwiftSoup elements support a <a href="https://www.w3.org/TR/2009/PR-css3-selectors-20091215/" rel="nofollow">CSS</a> (or <a href="http://jquery.com" rel="nofollow">jQuery</a>) like selector syntax to find matching elements, that allows very powerful and robust queries.</p>
<p>The <code>select</code> method is available in a <code>Document</code>, <code>Element</code>, or in <code>Elements</code>. It is contextual, so you can filter by selecting from a specific element, or by chaining select calls.</p>
<p>Select returns a list of <code>Elements</code> (as <code>Elements</code>), which provides a range of methods to extract and manipulate the results.</p>
<h3><a id="user-content-selector-overview" class="anchor" aria-hidden="true" href="#selector-overview"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Selector overview</h3>
<ul>
<li><code>tagname</code>: find elements by tag, e.g. <code>a</code></li>
<li><code>ns|tag</code>: find elements by tag in a namespace, e.g. <code>fb|name</code> finds <code>&lt;fb:name&gt;</code> elements</li>
<li><code>#id</code>: find elements by ID, e.g. <code>#logo</code></li>
<li><code>.class</code>: find elements by class name, e.g. <code>.masthead</code></li>
<li><code>[attribute]</code>: elements with attribute, e.g. <code>[href]</code></li>
<li><code>[^attr]</code>: elements with an attribute name prefix, e.g. <code>[^data-]</code> finds elements with HTML5 dataset attributes</li>
<li><code>[attr=value]</code>: elements with attribute value, e.g. <code>[width=500]</code> (also quotable, like <code>[data-name='launch sequence']</code>)</li>
<li><code>[attr^=value]</code>, <code>[attr$=value]</code>, <code>[attr*=value]</code>: elements with attributes that start with, end with, or contain the value, e.g. <code>[href*=/path/]</code></li>
<li><code>[attr~=regex]</code>: elements with attribute values that match the regular expression; e.g. <code>img[src~=(?i)\.(png|jpe?g)]</code></li>
<li><code>*</code>: all elements, e.g. <code>*</code></li>
</ul>
<h3><a id="user-content-selector-combinations" class="anchor" aria-hidden="true" href="#selector-combinations"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Selector combinations</h3>
<ul>
<li><code>el#id</code>: elements with ID, e.g. <code>div#logo</code></li>
<li><code>el.class</code>: elements with class, e.g. <code>div.masthead</code></li>
<li><code>el[attr]</code>: elements with attribute, e.g. <code>a[href]</code></li>
<li>Any combination, e.g. <code>a[href].highlight</code></li>
<li>Ancestor <code>child</code>: child elements that descend from ancestor, e.g. <code>.body p</code> finds <code>p</code> elements anywhere under a block with class "body"</li>
<li><code>parent &gt; child</code>: child elements that descend directly from parent, e.g. <code>div.content &gt; p</code> finds p elements; and <code>body &gt; *</code> finds the direct children of the body tag</li>
<li><code>siblingA + siblingB</code>: finds sibling B element immediately preceded by sibling A, e.g. <code>div.head + div</code></li>
<li><code>siblingA ~ siblingX</code>: finds sibling X element preceded by sibling A, e.g. <code>h1 ~ p</code></li>
<li><code>el</code>, <code>el</code>, <code>el</code>: group multiple selectors, find unique elements that match any of the selectors; e.g. <code>div.masthead</code>, <code>div.logo</code></li>
</ul>
<h3><a id="user-content-pseudo-selectors" class="anchor" aria-hidden="true" href="#pseudo-selectors"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Pseudo selectors</h3>
<ul>
<li><code>:lt(n)</code>: find elements whose sibling index (i.e. its position in the DOM tree relative to its parent) is less than n; e.g. <code>td:lt(3)</code></li>
<li><code>:gt(n)</code>: find elements whose sibling index is greater than n; e.g. <code>div p:gt(2)</code></li>
<li><code>:eq(n)</code>: find elements whose sibling index is equal to n; e.g. <code>form input:eq(1)</code></li>
<li><code>:has(seletor)</code>: find elements that contain elements matching the selector; e.g. <code>div:has(p)</code></li>
<li><code>:not(selector)</code>: find elements that do not match the selector; e.g. <code>div:not(.logo)</code></li>
<li><code>:contains(text)</code>: find elements that contain the given text. The search is case-insensitive; e.g. <code>p:contains(swiftsoup)</code></li>
<li><code>:containsOwn(text)</code>: find elements that directly contain the given text</li>
<li><code>:matches(regex)</code>: find elements whose text matches the specified regular expression; e.g. <code>div:matches((?i)login)</code></li>
<li><code>:matchesOwn(regex)</code>: find elements whose own text matches the specified regular expression</li>
<li>Note that the above indexed pseudo-selectors are 0-based, that is, the first element is at index 0, the second at 1, etc</li>
</ul>
<h1><a id="user-content-examples" class="anchor" aria-hidden="true" href="#examples"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Examples</h1>
<h2><a id="user-content-to-parse-an-html-document-from-string" class="anchor" aria-hidden="true" href="#to-parse-an-html-document-from-string"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>To parse an HTML document from String:</h2>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">let</span> html <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;html&gt;&lt;head&gt;&lt;title&gt;First parse&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;Parsed HTML into a doc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">guard</span> <span class="pl-k">let</span> doc<span class="pl-k">:</span> Document <span class="pl-k">=</span> <span class="pl-k">try</span><span class="pl-k">?</span> SwiftSoup.<span class="pl-c1">parse</span>(html) <span class="pl-k">else</span> { <span class="pl-k">return</span> }</pre></div>
<h2><a id="user-content-get-all-text-nodes" class="anchor" aria-hidden="true" href="#get-all-text-nodes"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Get all text nodes:</h2>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">guard</span> <span class="pl-k">let</span> elements <span class="pl-k">=</span> <span class="pl-k">try</span><span class="pl-k">?</span> doc.<span class="pl-c1">getAllElements</span>() <span class="pl-k">else</span> { <span class="pl-k">return</span> html }
<span class="pl-k">for</span> element <span class="pl-k">in</span> elements {
<span class="pl-k">for</span> textNode <span class="pl-k">in</span> element.<span class="pl-c1">textNodes</span>() {
[<span class="pl-k">...</span>]
}
}</pre></div>
<h2><a id="user-content-set-css-using-swiftsoup" class="anchor" aria-hidden="true" href="#set-css-using-swiftsoup"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Set CSS using SwiftSoup:</h2>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">try</span> doc.<span class="pl-c1">head</span>()<span class="pl-k">?</span>.<span class="pl-c1">append</span>(<span class="pl-s"><span class="pl-pds">"</span>&lt;style&gt;html {font-size: 2em}&lt;/style&gt;<span class="pl-pds">"</span></span>)</pre></div>
<h2><a id="user-content-get-html-value" class="anchor" aria-hidden="true" href="#get-html-value"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Get HTML value</h2>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">let</span> html <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;div class=<span class="pl-cce">\"</span>container-fluid<span class="pl-cce">\"</span>&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;div class=<span class="pl-cce">\"</span>panel panel-default <span class="pl-cce">\"</span>&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;div class=<span class="pl-cce">\"</span>panel-body<span class="pl-cce">\"</span>&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;form id=<span class="pl-cce">\"</span>coupon_checkout<span class="pl-cce">\"</span> action=<span class="pl-cce">\"</span>http://uat.all.com.my/checkout/couponcode<span class="pl-cce">\"</span> method=<span class="pl-cce">\"</span>post<span class="pl-cce">\"</span>&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;input type=<span class="pl-cce">\"</span>hidden<span class="pl-cce">\"</span> name=<span class="pl-cce">\"</span>transaction_id<span class="pl-cce">\"</span> value=<span class="pl-cce">\"</span>4245<span class="pl-cce">\"</span>&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;input type=<span class="pl-cce">\"</span>hidden<span class="pl-cce">\"</span> name=<span class="pl-cce">\"</span>lang<span class="pl-cce">\"</span> value=<span class="pl-cce">\"</span>EN<span class="pl-cce">\"</span>&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;input type=<span class="pl-cce">\"</span>hidden<span class="pl-cce">\"</span> name=<span class="pl-cce">\"</span>devicetype<span class="pl-cce">\"</span> value=<span class="pl-cce">\"\"</span>&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;div class=<span class="pl-cce">\"</span>input-group<span class="pl-cce">\"</span>&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;input type=<span class="pl-cce">\"</span>text<span class="pl-cce">\"</span> class=<span class="pl-cce">\"</span>form-control<span class="pl-cce">\"</span> id=<span class="pl-cce">\"</span>coupon_code<span class="pl-cce">\"</span> name=<span class="pl-cce">\"</span>coupon<span class="pl-cce">\"</span> placeholder=<span class="pl-cce">\"</span>Coupon Code<span class="pl-cce">\"</span>&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;span class=<span class="pl-cce">\"</span>input-group-btn<span class="pl-cce">\"</span>&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;button class=<span class="pl-cce">\"</span>btn btn-primary<span class="pl-cce">\"</span> type=<span class="pl-cce">\"</span>submit<span class="pl-cce">\"</span>&gt;Enter Code&lt;/button&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;/span&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;/div&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;/form&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;/div&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;/div&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">guard</span> <span class="pl-k">let</span> doc<span class="pl-k">:</span> Document <span class="pl-k">=</span> <span class="pl-k">try</span><span class="pl-k">?</span> SwiftSoup.<span class="pl-c1">parse</span>(html) <span class="pl-k">else</span> { <span class="pl-k">return</span> } <span class="pl-c"><span class="pl-c">//</span> parse html</span>
<span class="pl-c"></span><span class="pl-k">let</span> elements <span class="pl-k">=</span> <span class="pl-k">try</span> doc.<span class="pl-c1">select</span>(<span class="pl-s"><span class="pl-pds">"</span>[name=transaction_id]<span class="pl-pds">"</span></span>) <span class="pl-c"><span class="pl-c">//</span> query</span>
<span class="pl-c"></span><span class="pl-k">let</span> transaction_id <span class="pl-k">=</span> <span class="pl-k">try</span> elements.<span class="pl-c1">get</span>(<span class="pl-c1">0</span>) <span class="pl-c"><span class="pl-c">//</span> select first element</span>
<span class="pl-c"></span><span class="pl-k">let</span> value <span class="pl-k">=</span> <span class="pl-k">try</span> transaction_id.<span class="pl-c1">val</span>() <span class="pl-c"><span class="pl-c">//</span> get value</span>
<span class="pl-c"></span><span class="pl-c1">print</span>(value) <span class="pl-c"><span class="pl-c">//</span> 4245</span></pre></div>
<h2><a id="user-content-how-to-remove-all-the-html-from-a-string" class="anchor" aria-hidden="true" href="#how-to-remove-all-the-html-from-a-string"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to remove all the html from a string</h2>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">guard</span> <span class="pl-k">let</span> doc<span class="pl-k">:</span> Document <span class="pl-k">=</span> <span class="pl-k">try</span><span class="pl-k">?</span> SwiftSoup.<span class="pl-c1">parse</span>(html) <span class="pl-k">else</span> { <span class="pl-k">return</span> } <span class="pl-c"><span class="pl-c">//</span> parse html</span>
<span class="pl-c"></span><span class="pl-k">guard</span> <span class="pl-k">let</span> txt <span class="pl-k">=</span> <span class="pl-k">try</span><span class="pl-k">?</span> doc.<span class="pl-c1">text</span>() <span class="pl-k">else</span> { <span class="pl-k">return</span> }
<span class="pl-c1">print</span>(txt)</pre></div>
<h2><a id="user-content-how-to-get-and-update-xml-values" class="anchor" aria-hidden="true" href="#how-to-get-and-update-xml-values"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to get and update XML values</h2>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">let</span> xml <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;?xml version='1' encoding='UTF-8' something='else'?&gt;&lt;val&gt;One&lt;/val&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">guard</span> <span class="pl-k">let</span> doc <span class="pl-k">=</span> <span class="pl-k">try</span><span class="pl-k">?</span> SwiftSoup.<span class="pl-c1">parse</span>(xml, <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>, Parser.<span class="pl-c1">xmlParser</span>()) <span class="pl-k">else</span> { <span class="pl-k">return</span> }
<span class="pl-k">guard</span> <span class="pl-k">let</span> element <span class="pl-k">=</span> <span class="pl-k">try</span><span class="pl-k">?</span> doc.<span class="pl-c1">getElementsByTag</span>(<span class="pl-s"><span class="pl-pds">"</span>val<span class="pl-pds">"</span></span>).<span class="pl-c1">first</span>() <span class="pl-c"><span class="pl-c">//</span> Find first element</span>
<span class="pl-c"></span>element.<span class="pl-c1">text</span>(<span class="pl-s"><span class="pl-pds">"</span>NewValue<span class="pl-pds">"</span></span>) <span class="pl-c"><span class="pl-c">//</span> Edit Value</span>
<span class="pl-c"></span><span class="pl-k">let</span> valueString <span class="pl-k">=</span> element.<span class="pl-c1">text</span>() <span class="pl-c"><span class="pl-c">//</span> "NewValue"</span></pre></div>
<h2><a id="user-content-how-to-get-all-img-src" class="anchor" aria-hidden="true" href="#how-to-get-all-img-src"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to get all <code>&lt;img src&gt;</code></h2>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">do</span> {
<span class="pl-k">let</span> doc<span class="pl-k">:</span> Document <span class="pl-k">=</span> <span class="pl-k">try</span> SwiftSoup.<span class="pl-c1">parse</span>(html)
<span class="pl-k">let</span> srcs<span class="pl-k">:</span> <span class="pl-c1">Elements</span> <span class="pl-k">=</span> <span class="pl-k">try</span> doc.<span class="pl-c1">select</span>(<span class="pl-s"><span class="pl-pds">"</span>img[src]<span class="pl-pds">"</span></span>)
<span class="pl-k">let</span> srcsStringArray<span class="pl-k">:</span> [<span class="pl-c1">String</span><span class="pl-k">?</span>] <span class="pl-k">=</span> srcs.<span class="pl-c1">array</span>().<span class="pl-c1">map</span> { <span class="pl-k">try</span><span class="pl-k">?</span> <span class="pl-c1">$0</span>.<span class="pl-c1">attr</span>(<span class="pl-s"><span class="pl-pds">"</span>src<span class="pl-pds">"</span></span>).<span class="pl-c1">description</span> }
<span class="pl-c"><span class="pl-c">//</span> do something with srcsStringArray</span>
<span class="pl-c"></span>} <span class="pl-k">catch</span> Exception.<span class="pl-c1">Error</span>(<span class="pl-c1">_</span>, <span class="pl-k">let</span> message) {
<span class="pl-c1">print</span>(message)
} <span class="pl-k">catch</span> {
<span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">"</span>error<span class="pl-pds">"</span></span>)
}</pre></div>
<h2><a id="user-content-get-all-href-of-a" class="anchor" aria-hidden="true" href="#get-all-href-of-a"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Get all <code>href</code> of <code>&lt;a&gt;</code></h2>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">let</span> html <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>&lt;a id=1 href='?foo=bar&amp;mid&amp;lt=true'&gt;One&lt;/a&gt; &lt;a id=2 href='?foo=bar&amp;lt;qux&amp;lg=1'&gt;Two&lt;/a&gt;<span class="pl-pds">"</span></span>
<span class="pl-k">guard</span> <span class="pl-k">let</span> els<span class="pl-k">:</span> <span class="pl-c1">Elements</span> <span class="pl-k">=</span> <span class="pl-k">try</span><span class="pl-k">?</span> SwiftSoup.<span class="pl-c1">parse</span>(html).<span class="pl-c1">select</span>(<span class="pl-s"><span class="pl-pds">"</span>a<span class="pl-pds">"</span></span>) <span class="pl-k">else</span> { <span class="pl-k">return</span> }
<span class="pl-k">for</span> element<span class="pl-k">:</span> <span class="pl-c1">Element</span> <span class="pl-k">in</span> els.<span class="pl-c1">array</span>() {
<span class="pl-c1">print</span>(<span class="pl-k">try</span><span class="pl-k">?</span> element.<span class="pl-c1">attr</span>(<span class="pl-s"><span class="pl-pds">"</span>href<span class="pl-pds">"</span></span>))
}</pre></div>
<p>Output:</p>
<pre><code>"?foo=bar&amp;mid&amp;lt=true"
"?foo=bar&lt;qux&amp;lg=1"
</code></pre>
<h2><a id="user-content-escape-and-enescape" class="anchor" aria-hidden="true" href="#escape-and-enescape"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Escape and Enescape</h2>
<div class="highlight highlight-source-swift"><pre><span class="pl-k">let</span> text <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>Hello &amp;&lt;&gt; Å å π 新 there ¾ © »<span class="pl-pds">"</span></span>
<span class="pl-c1">print</span>(Entities.<span class="pl-c1">escape</span>(text))
<span class="pl-c1">print</span>(Entities.<span class="pl-c1">unescape</span>(text))
<span class="pl-c1">print</span>(Entities.<span class="pl-c1">escape</span>(text, <span class="pl-c1">OutputSettings</span>().<span class="pl-c1">encoder</span>(<span class="pl-c1">String</span>.<span class="pl-smi">Encoding</span>.<span class="pl-smi">ascii</span>).<span class="pl-c1">escapeMode</span>(Entities.<span class="pl-smi">EscapeMode</span>.<span class="pl-c1">base</span>)))
<span class="pl-c1">print</span>(Entities.<span class="pl-c1">escape</span>(text, <span class="pl-c1">OutputSettings</span>().<span class="pl-c1">charset</span>(<span class="pl-c1">String</span>.<span class="pl-smi">Encoding</span>.<span class="pl-smi">ascii</span>).<span class="pl-c1">escapeMode</span>(Entities.<span class="pl-smi">EscapeMode</span>.<span class="pl-smi">extended</span>)))
<span class="pl-c1">print</span>(Entities.<span class="pl-c1">escape</span>(text, <span class="pl-c1">OutputSettings</span>().<span class="pl-c1">charset</span>(<span class="pl-c1">String</span>.<span class="pl-smi">Encoding</span>.<span class="pl-smi">ascii</span>).<span class="pl-c1">escapeMode</span>(Entities.<span class="pl-smi">EscapeMode</span>.<span class="pl-smi">xhtml</span>)))
<span class="pl-c1">print</span>(Entities.<span class="pl-c1">escape</span>(text, <span class="pl-c1">OutputSettings</span>().<span class="pl-c1">charset</span>(<span class="pl-c1">String</span>.<span class="pl-smi">Encoding</span>.<span class="pl-c1">utf8</span>).<span class="pl-c1">escapeMode</span>(Entities.<span class="pl-smi">EscapeMode</span>.<span class="pl-smi">extended</span>)))
<span class="pl-c1">print</span>(Entities.<span class="pl-c1">escape</span>(text, <span class="pl-c1">OutputSettings</span>().<span class="pl-c1">charset</span>(<span class="pl-c1">String</span>.<span class="pl-smi">Encoding</span>.<span class="pl-c1">utf8</span>).<span class="pl-c1">escapeMode</span>(Entities.<span class="pl-smi">EscapeMode</span>.<span class="pl-smi">xhtml</span>)))
</pre></div>
<p>Output:</p>
<pre><code>"Hello &amp;amp;&amp;lt;&amp;gt; Å å π 新 there ¾ © »"
"Hello &amp;&lt;&gt; Å å π 新 there ¾ © »"
"Hello &amp;amp;&amp;lt;&amp;gt; &amp;Aring; &amp;aring; &amp;#x3c0; &amp;#x65b0; there &amp;frac34; &amp;copy; &amp;raquo;"
"Hello &amp;amp;&amp;lt;&amp;gt; &amp;angst; &amp;aring; &amp;pi; &amp;#x65b0; there &amp;frac34; &amp;copy; &amp;raquo;"
"Hello &amp;amp;&amp;lt;&amp;gt; &amp;#xc5; &amp;#xe5; &amp;#x3c0; &amp;#x65b0; there &amp;#xbe; &amp;#xa9; &amp;#xbb;"
"Hello &amp;amp;&amp;lt;&amp;gt; Å å π 新 there ¾ © »"
"Hello &amp;amp;&amp;lt;&amp;gt; Å å π 新 there ¾ © »"
</code></pre>
<h2><a id="user-content-author" class="anchor" aria-hidden="true" href="#author"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Author</h2>
<p>Nabil Chatbi, <a href="mailto:scinfu@gmail.com">scinfu@gmail.com</a></p>
<h2><a id="user-content-note" class="anchor" aria-hidden="true" href="#note"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Note</h2>
<p>SwiftSoup was ported to Swift from Java <a href="https://jsoup.org/" rel="nofollow">Jsoup</a> library.</p>
<h2><a id="user-content-license" class="anchor" aria-hidden="true" href="#license"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>License</h2>
<p>SwiftSoup is available under the MIT license. See the LICENSE file for more info.</p>
</article>
</div>
</div>
</div>
<div class="modal-backdrop js-touch-events"></div>
</div>
</div>
</div>
</div>
<div class="footer container-lg px-3" role="contentinfo">
<div class="position-relative d-flex flex-justify-between pt-6 pb-2 mt-6 f6 text-gray border-top border-gray-light ">
<ul class="list-style-none d-flex flex-wrap ">
<li class="mr-3">&copy; 2019 <span title="0.19843s from unicorn-77f499c856-l6p5j">GitHub</span>, Inc.</li>
<li class="mr-3"><a data-ga-click="Footer, go to terms, text:terms" href="https://github.com/site/terms">Terms</a></li>
<li class="mr-3"><a data-ga-click="Footer, go to privacy, text:privacy" href="https://github.com/site/privacy">Privacy</a></li>
<li class="mr-3"><a data-ga-click="Footer, go to security, text:security" href="https://github.com/security">Security</a></li>
<li class="mr-3"><a href="https://githubstatus.com/" data-ga-click="Footer, go to status, text:status">Status</a></li>
<li><a data-ga-click="Footer, go to help, text:help" href="https://help.github.com">Help</a></li>
</ul>
<a aria-label="Homepage" title="GitHub" class="footer-octicon mr-lg-4" href="https://github.com">
<svg height="24" class="octicon octicon-mark-github" viewBox="0 0 16 16" version="1.1" width="24" aria-hidden="true"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
</a>
<ul class="list-style-none d-flex flex-wrap ">
<li class="mr-3"><a data-ga-click="Footer, go to contact, text:contact" href="https://github.com/contact">Contact GitHub</a></li>
<li class="mr-3"><a href="https://github.com/pricing" data-ga-click="Footer, go to Pricing, text:Pricing">Pricing</a></li>
<li class="mr-3"><a href="https://developer.github.com" data-ga-click="Footer, go to api, text:api">API</a></li>
<li class="mr-3"><a href="https://training.github.com" data-ga-click="Footer, go to training, text:training">Training</a></li>
<li class="mr-3"><a href="https://github.blog" data-ga-click="Footer, go to blog, text:blog">Blog</a></li>
<li><a data-ga-click="Footer, go to about, text:about" href="https://github.com/about">About</a></li>
</ul>
</div>
<div class="d-flex flex-justify-center pb-6">
<span class="f6 text-gray-light"></span>
</div>
</div>
<div id="ajax-error-message" class="ajax-error-message flash flash-error">
<svg class="octicon octicon-alert" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"/></svg>
<button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error">
<svg class="octicon octicon-x" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"/></svg>
</button>
You cant perform that action at this time.
</div>
<script crossorigin="anonymous" integrity="sha512-dQvtC5pSFXZtMywADdHZ/WrSJTLtJHIgdmLaQr4S7p6MvToW4vSBCzHTWbtVbwNOT0+NbvN141Y3nZjGDQ9B5g==" type="application/javascript" src="https://github.githubassets.com/assets/frameworks-0e0307a1.js"></script>
<script crossorigin="anonymous" async="async" integrity="sha512-ovp6Vd8ts4G3NlT7AZ//VkXxUo+Nvfmng9uuSLUUxdF+7ktSFgV569XzR94UcJTExbf4QSWM43nv7kd5uSKuHQ==" type="application/javascript" src="https://github.githubassets.com/assets/github-bootstrap-01bb88c1.js"></script>
<div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner d-none">
<svg class="octicon octicon-alert" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"/></svg>
<span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span>
<span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span>
</div>
<template id="site-details-dialog">
<details class="details-reset details-overlay details-overlay-dark lh-default text-gray-dark" open>
<summary aria-haspopup="dialog" aria-label="Close dialog"></summary>
<details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast">
<button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog>
<svg class="octicon octicon-x" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"/></svg>
</button>
<div class="octocat-spinner my-6 js-details-dialog-spinner"></div>
</details-dialog>
</details>
</template>
<div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;" tabindex="0">
<div class="Popover-message Popover-message--bottom-left Popover-message--large Box box-shadow-large" style="width:360px;">
</div>
</div>
<div id="hovercard-aria-description" class="sr-only">
Press h to open a hovercard with more details.
</div>
<div aria-live="polite" class="js-global-screen-reader-notice sr-only"></div>
</body>
</html>