{"id":32110119,"url":"https://github.com/tid-kijyun/kanna","last_synced_at":"2026-02-25T14:01:32.434Z","repository":{"id":41284393,"uuid":"20853731","full_name":"tid-kijyun/Kanna","owner":"tid-kijyun","description":"Kanna(鉋) is an XML/HTML parser for Swift.","archived":false,"fork":false,"pushed_at":"2025-06-26T16:36:54.000Z","size":504,"stargazers_count":2471,"open_issues_count":18,"forks_count":223,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-10-17T08:03:38.619Z","etag":null,"topics":["html-parser","swift","xml-parser"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tid-kijyun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["tid-kijyun"],"custom":["https://paypal.me/atsushikiwaki"]}},"created_at":"2014-06-15T11:14:38.000Z","updated_at":"2025-10-07T18:07:35.000Z","dependencies_parsed_at":"2024-06-18T11:02:30.186Z","dependency_job_id":"0e374528-ec2d-4175-a0ac-12767906653b","html_url":"https://github.com/tid-kijyun/Kanna","commit_stats":{"total_commits":258,"total_committers":42,"mean_commits":6.142857142857143,"dds":"0.18604651162790697","last_synced_commit":"41c3d28ea0eac07e4551b28def9de1ede702e739"},"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"purl":"pkg:github/tid-kijyun/Kanna","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tid-kijyun%2FKanna","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tid-kijyun%2FKanna/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tid-kijyun%2FKanna/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tid-kijyun%2FKanna/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tid-kijyun","download_url":"https://codeload.github.com/tid-kijyun/Kanna/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tid-kijyun%2FKanna/sbom","scorecard":{"id":884695,"data":{"date":"2025-08-11","repo":{"name":"github.com/tid-kijyun/Kanna","commit":"a23a4584f8e7de07cab420ae4d51eee553dd988d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 1/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":6,"reason":"8 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 6","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/tid-kijyun/Kanna/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/tid-kijyun/Kanna/ci.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 25 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T09:33:25.751Z","repository_id":41284393,"created_at":"2025-08-24T09:33:25.752Z","updated_at":"2025-08-24T09:33:25.752Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280102713,"owners_count":26272390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-20T02:00:06.978Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html-parser","swift","xml-parser"],"created_at":"2025-10-20T13:55:12.960Z","updated_at":"2025-10-20T13:55:15.887Z","avatar_url":"https://github.com/tid-kijyun.png","language":"Swift","funding_links":["https://github.com/sponsors/tid-kijyun","https://paypal.me/atsushikiwaki"],"categories":[],"sub_categories":[],"readme":"# Kanna(鉋)\nKanna(鉋) is an XML/HTML parser for cross-platform(macOS, iOS, tvOS, watchOS and Linux!).\n\nIt was inspired by [Nokogiri](https://github.com/sparklemotion/nokogiri)(鋸).\n\n[![CI](https://github.com/tid-kijyun/Kanna/actions/workflows/ci.yml/badge.svg)](https://github.com/tid-kijyun/Kanna/actions/workflows/ci.yml)\n[![Platform](http://img.shields.io/badge/platform-ios_osx_watchos_tvos_linux-lightgrey.svg?style=flat)](https://developer.apple.com/resources/)\n[![Cocoapod](http://img.shields.io/cocoapods/v/Kanna.svg?style=flat)](http://cocoadocs.org/docsets/Kanna/)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Swift Package Manager](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)\n[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)\n\n:information_source: [Documentation](http://tid-kijyun.github.io/Kanna/)\n\n\n## Features\n- [x] XPath 1.0 support for document searching\n- [x] CSS3 selector support for document searching\n- [x] Support for namespaces\n- [x] Comprehensive test suite\n\n## Installation\nℹ️ If you are using Swift 6, please use Kanna 6.0.0 or later.  \nℹ️ The same applies if you set `Strict Concurrency Check` to `Targeted` or higher.\n\n#### CocoaPods\nAdd the following to your `Podfile`:\n```ruby\nuse_frameworks!\npod 'Kanna', '~\u003e 5.2.2'\n```\n\n#### Carthage\nAdd the following to your `Cartfile`:\n\n```ogdl\ngithub \"tid-kijyun/Kanna\" ~\u003e 5.2.2\n```\n\nFor xcode 11.3 and earlier, the following settings are required.\n1. In the project settings add `$(SDKROOT)/usr/include/libxml2` to the \"header search paths\" field\n\n#### Swift Package Manager\n1. Installing libxml2 to your computer:\n\n```bash\n// macOS: For xcode 11.3 and earlier, the following settings are required.\n$ brew install libxml2\n$ brew link --force libxml2\n\n// Linux(Ubuntu):\n$ sudo apt-get install libxml2-dev\n```\n\n2. Add the following to your `Package.swift`:\n\n```swift\n// swift-tools-version:5.0\nimport PackageDescription\n\nlet package = Package(\n    name: \"YourProject\",\n    dependencies: [\n        .package(url: \"https://github.com/tid-kijyun/Kanna.git\", from: \"5.2.2\"),\n    ],\n    targets: [\n        .target(\n            name: \"YourTarget\",\n            dependencies: [\"Kanna\"]),\n    ]\n)\n```\n\n```bash\n$ swift build\n```\n\n*Note: When a build error occurs, please try run the following command:*\n```bash\n// Linux(Ubuntu)\n$ sudo apt-get install pkg-config\n```\n\n#### Manual Installation\n1. Add these files to your project:  \n  [Kanna.swift](Source/Kanna.swift)  \n  [CSS.swift](Source/CSS.swift)  \n  [libxmlHTMLDocument.swift](Source/libxml/libxmlHTMLDocument.swift)  \n  [libxmlHTMLNode.swift](Source/libxml/libxmlHTMLNode.swift)  \n  [libxmlParserOption.swift](Source/libxml/libxmlParserOption.swift)  \n  [Modules](Modules)\n1. In the target settings add `$(SDKROOT)/usr/include/libxml2` to the `Search Paths \u003e Header Search Paths` field\n1. In the target settings add `$(SRCROOT)/Modules` to the `Swift Compiler - Search Paths \u003e Import Paths` field\n\n\n#### [Installation for swift 4](https://github.com/tid-kijyun/Kanna/blob/master/Documentation/InstallationForSwift4.md)\n#### [Installation for swift 3](https://github.com/tid-kijyun/Kanna/blob/master/Documentation/InstallationForSwift3.md)\n\n## Synopsis\n```swift\nimport Kanna\n\nlet html = \"\u003chtml\u003e...\u003c/html\u003e\"\n\nif let doc = try? HTML(html: html, encoding: .utf8) {\n    print(doc.title)\n    \n    // Search for nodes by CSS\n    for link in doc.css(\"a, link\") {\n        print(link.text)\n        print(link[\"href\"])\n    }\n    \n    // Search for nodes by XPath\n    for link in doc.xpath(\"//a | //link\") {\n        print(link.text)\n        print(link[\"href\"])\n    }\n}\n```\n\n```swift\nlet xml = \"...\"\nif let doc = try? Kanna.XML(xml: xml, encoding: .utf8) {\n    let namespaces = [\n                    \"o\":  \"urn:schemas-microsoft-com:office:office\",\n                    \"ss\": \"urn:schemas-microsoft-com:office:spreadsheet\"\n                ]\n    if let author = doc.at_xpath(\"//o:Author\", namespaces: namespaces) {\n        print(author.text)\n    }\n}\n```\n\n## Donation\nIf you like Kanna, please donate via GitHub sponsors or PayPal.  \nIt is used to improve and maintain the library.\n\n## License\nThe MIT License. See the LICENSE file for more information.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftid-kijyun%2Fkanna","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftid-kijyun%2Fkanna","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftid-kijyun%2Fkanna/lists"}