A cross-platform XML/HTML parser for Swift with XPath and CSS selector support.
Kanna is an XML/HTML parser for Swift that enables developers to parse, navigate, and extract data from structured documents. It provides support for both XPath 1.0 and CSS3 selectors, making it easy to query documents using familiar syntax. The library is cross-platform and works across all Apple platforms and Linux.
Swift developers who need to parse XML or HTML documents in their applications, particularly those working on cross-platform projects or requiring advanced document querying capabilities.
Developers choose Kanna for its comprehensive feature set, including dual XPath and CSS selector support, cross-platform compatibility, and reliability backed by a thorough test suite. It fills a specific need in the Swift ecosystem for a robust parsing library inspired by established tools like Nokogiri.
Kanna(鉋) is an XML/HTML parser for Swift.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports both XPath 1.0 and CSS3 selectors, allowing developers to use familiar syntax for precise document navigation, as demonstrated in the synopsis with examples for both query types.
Works on all Apple platforms (iOS, macOS, tvOS, watchOS) and Linux, enabling consistent parsing logic across mobile, desktop, and server-side Swift projects.
Correctly processes XML documents with namespaces, essential for standards-compliant parsing, shown in the XML example where namespace mappings are used in XPath queries.
Backed by a thorough test suite that ensures reliability and correctness, as indicated by the CI badge and features list in the README.
Requires manual installation of libxml2 on Linux and additional header search path setup for older Xcode versions, adding significant setup overhead compared to pure Swift libraries.
Only supports XPath 1.0, lacking features from newer versions like XPath 2.0 or 3.0, which may be necessary for advanced XML transformations or functions.
Loads entire documents into memory via libxml2, making it less suitable for parsing very large XML/HTML files where streaming or incremental approaches would be more efficient.