Fuzi is an XML & HTML parsing library inspired by a number of similar libraries including Ono & Matt. Its intention is to provide the most straightforward and easiest way possible to parse XML & HTML documents in Swift.
Installation
You can install Fuzi in your Swift project using Swift Package Manager, CocoaPods, or Carthage.
Swift Package Manager
For Swift Package Manager, simply include Fuzi as a package in your Package.swift file and import Fuzi in the Swift files where you want to use it.
CocoaPods
For CocoaPods, add Fuzi to your Podfile and run `pod install` in your project directory.
Carthage
For Carthage, add Fuzi to your Cartfile, run `carthage update`, and link the Fuzi.framework in your project.
Usage
Once you have Fuzi installed, you can use it to parse XML or HTML documents. The snippet below demonstrates basic usage:
// import the Fuzi library
import Fuzi
// load an HTML document
let html = """
<!doctype html>
<html>
<body>
<h1>Hello, world!</h1>
</body>
</html>
"""
do {
let doc = try HTMLDocument(string: html)
print(document.body!)
} catch let error {
print(error)
}
Frequently Asked Questions (FAQs)
If you’re new to Fuzi or have some queries about the library, check out our FAQs section. If you can’t find what you’re looking for, feel free to raise an issue on our GitHub page.
Contact and Contributing
If you would like to contribute to the development of Fuzi or if you need to contact the maintainers for any reason, you can reach out on our GitHub repository. Your contributions to FOSS (Free and Open Source Software) are greatly appreciated.
Disclaimer
Fuzi is provided as-is under the MIT license. For more details, see the LICENSE file in the Fuzi repository. If you use Fuzi in your application and want to give back or show your support, consider leaving a star on the GitHub repository – it helps!