1. Products
  2.   HTML
  3.   Swift
  4.   Fuzi

Swift Library for Speedy XML & HTML Documents Loading & Parsing

Free Swift Library for Speedy XML & HTML Documents Parsing. It allows to Load and Parse Large HTML and XML Documents and Extract Valuable Data form it.

In the world of modern web development, parsing HTML content efficiently is a critical task. As a Swift developer, you might be seeking a reliable and powerful library to handle this task with ease. Look no further than Fuzi, a remarkable Swift HTML parsing library that simplifies the process of extracting valuable data from HTML documents. It offers an intuitive and developer-friendly API, making it straightforward for both beginners and seasoned developers to get started. With a few lines of code, you can parse an HTML document and access its elements efficiently.

Fuzi is an open-source Swift library designed to facilitate the parsing of HTML and XML documents effortlessly without an external dependencies. Created by Charlie Monroe, this lightweight and highly efficient library has gained popularity among iOS and macOS developers due to its simplicity and performance. There are several important features part of the library, such as load and parse large HTML documents, CSS Selector Support, XPath Support, Robust Parsing, Modifiable Parsing Option, compatibility with both iOS and macOS platforms and many more.

Fuzi provides detailed error messages and diagnostics, making it easier to troubleshoot issues during parsing. It is undoubtedly a powerful and versatile HTML parsing library helping Swift developers to create their own powerful applications for working with HTML files. Its simplicity, robustness, and support for CSS selectors and XPath expressions make it an excellent choice for extracting data from HTML documents efficiently. Whether you're extracting data for analysis, building web scraping tools, or creating dynamic web applications, Fuzi can streamline your development process and save you time.

Previous Next

Getting Started with Fuzi

The recommended and easiest way to install Fuzi is using CocoaPods. Please use the following command a smooth installation.

Install Fuzi via CocoaPods

// adding it to your to your Podfile:
platform :ios, '8.0'

target 'MyApp' do
	pod 'Fuzi', '~> 1.0.0'

// Then, run the following command:
$ pod install

You can also install it manually; download the latest release files directly from GitHub repository.

HTML Documents Parsing via Swift API

The open source Fuzi API makes it easy for software developers to load and parse HTML document inside their Swift applications with just a couple of lines of code. It is built on top of the libxml2 library, which is known for its speed and efficiency. This ensures that parsing large HTML documents won't result in significant performance bottlenecks. The following example demonstrates how software developers can load and extract data from an HTML documents inside Swift applications. The API is used to parse an HTML document containing a title and a paragraph. The extracted data is then printed to the console.

How you can extract data from an HTML document using Fuzi

import Fuzi

if let htmlData = "

Hello, Fuzi!

Welcome to the world of HTML parsing.

".data(using: .utf8) { do { let doc = try HTMLDocument(data: htmlData) if let title = doc.firstChild(xpath: "//h1")?.stringValue { print("Title: \(title)") } if let paragraph = doc.firstChild(xpath: "//p")?.stringValue { print("Paragraph: \(paragraph)") } } catch let error { print("Error: \(error)") } }

Powerful Querying Support

Fuzi allows you to use CSS selectors and XPath expressions to target specific elements within HTML documents. This enables you to precisely extract the data you need without writing complex and error-prone parsing code. Moreover, the library lets users customize parsing options to suit your specific requirements. Developers can choose between lax and strict parsing modes, depending on the level of validation you desire.

CSS Selector Support

The open source Fuzi library supports CSS selectors, allowing software developers to target specific elements within the HTML document. This feature is incredibly useful when developers want to extract particular data without having to traverse the entire document. The API is compatible with both iOS and macOS platforms, making it a versatile choice for developers building applications across Apple devices.