{"id":17690215,"url":"https://github.com/onmyway133/reindeers","last_synced_at":"2025-08-02T05:13:10.519Z","repository":{"id":62452758,"uuid":"70359168","full_name":"onmyway133/Reindeers","owner":"onmyway133","description":"❄️ XML and HTML parser in Swift","archived":false,"fork":false,"pushed_at":"2020-08-15T19:41:36.000Z","size":452,"stargazers_count":55,"open_issues_count":0,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-05-02T05:59:35.740Z","etag":null,"topics":["html","swift","xml"],"latest_commit_sha":null,"homepage":"https://onmyway133.github.io/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/onmyway133.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-08T21:47:12.000Z","updated_at":"2024-03-13T22:24:30.000Z","dependencies_parsed_at":"2022-11-01T22:32:18.134Z","dependency_job_id":null,"html_url":"https://github.com/onmyway133/Reindeers","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onmyway133%2FReindeers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onmyway133%2FReindeers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onmyway133%2FReindeers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onmyway133%2FReindeers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onmyway133","download_url":"https://codeload.github.com/onmyway133/Reindeers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252582244,"owners_count":21771634,"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","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","swift","xml"],"created_at":"2024-10-24T11:50:13.303Z","updated_at":"2025-05-05T21:43:30.186Z","avatar_url":"https://github.com/onmyway133.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reindeers\n\n❤️ Support my app ❤️ \n\n- [Push Hero - pure Swift native macOS application to test push notifications](https://www.producthunt.com/posts/push-hero-2)\n- [PastePal - Pasteboard, note and shortcut manager](https://www.producthunt.com/posts/pastepal)\n- [Frame recorder - Recorder gif and video with frame](https://www.producthunt.com/posts/frame-recorder)\n- [Alias - App and file shortcut manager](https://www.producthunt.com/posts/alias-shortcut-manager)\n- [Other apps](https://onmyway133.github.io/projects/)\n\n❤️❤️😇😍🤘❤️❤️\n\n[![Version](https://img.shields.io/cocoapods/v/Reindeers.svg?style=flat)](http://cocoadocs.org/docsets/Reindeers)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![License](https://img.shields.io/cocoapods/l/Reindeers.svg?style=flat)](http://cocoadocs.org/docsets/Reindeers)\n[![Platform](https://img.shields.io/cocoapods/p/Reindeers.svg?style=flat)](http://cocoadocs.org/docsets/Reindeers)\n![Swift](https://img.shields.io/badge/%20in-swift%204.0-orange.svg)\n\n![](Screenshots/Banner.png)\n\n## Description\n\n- Use libxml2\n- Based on https://github.com/mattt/Ono\n- Used in [Snowflake](https://github.com/onmyway133/Snowflake)\n\n## Usage\n\n### XML, SVG, RSS\n\n```xml\n\u003chtml\u003e\n\u003cbody\u003e\n\n\u003ch1\u003eMy first SVG\u003c/h1\u003e\n\n\u003csvg width=\"100\" height=\"100\"\u003e\n  \u003ccircle cx=\"50\" cy=\"50\" r=\"40\" stroke=\"green\" stroke-width=\"4\" fill=\"yellow\" /\u003e\n\u003c/svg\u003e\n\n\u003c/body\u003e\n\u003c/html\n```\n\n```swift\nlet data = doItYourselfToLoadXMLStringFrom(fileName: \"test4\", ext: \"svg\")\nlet document = try! Document(data: data)\n\ndocument.rootElement.name\ndocument.rootElement.children()\n\ndocument.rootElement.elements(XPath: \"//svg\").first?.attributes[\"width\"]\ndocument.rootElement.elements(XPath: \"//circle\").first?.attributes[\"stroke\"]\n```\n\n### HTML\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cstyle\u003e\n      h1 {\n        color: blue;\n        font-family: verdana;\n        font-size: 300%;\n\n      }\n    p  {\n      color: red;\n      font-family: courier;\n      font-size: 160%;\n    }\n    \u003c/style\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n\n    \u003ch1\u003eThis is a heading\u003c/h1\u003e\n    \u003cp\u003eThis is a paragraph.\u003c/p\u003e\n    \u003ca href=\"http://www.w3schools.com\"\u003eVisit W3Schools\u003c/a\u003e\n    \n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n```swift\nlet data = Utils.load(fileName: \"test3\", ext: \"html\")\nlet document = try? Document(data: data, kind: .html)\n\nlet body = document.rootElement.child(index: 1)\nbody?.elements(XPath: \"//p\").first?.content\n```\n\n### Query\n\n- Get element info\n\n```swift\nlet element = document.rootElement.child(index: 0)\n\nelement.name\nelement.ns\nelement.line\nelement.attributes\nelement.parent\nelement.nextSibling\nelement.previousSibling\n```\n\n- Get child elements\n\n```swift\nelement.children { child, index in\n  return child.name == \"a\"\n}\n\nelement.children(name: \"item\")\nelement.children(indexes: [0, 2, 4])\n```\n\n- XPath\n\n```swift\nlet body = document.rootElement.firstChild(name: \"body\")\nbody?.elements(XPath: \"//a\").first?.attributes[\"href\"]\nbody?.elements(XPath: \"//div\") { element in\n  return element.attributes[\"width\"] == \"100\"\n}\n```\n\n- Turn Element to String\n\n```\nelement.toAttributeString()\nelement.toXMLString()\n```\n\n## Installation\n\n**Reindeers** is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'Reindeers'\n```\n\n**Reindeers** is also available through [Carthage](https://github.com/Carthage/Carthage).\nTo install just write into your Cartfile:\n\n```ruby\ngithub \"onmyway133/Reindeers\"\n```\n\n**Reindeers** can also be installed manually. Just download and drop `Sources` folders in your project.\n\n## Author\n\nKhoa Pham, onmyway133@gmail.com\n\n## Contributing\n\nWe would love you to contribute to **Reindeers**, check the [CONTRIBUTING](https://github.com/onmyway133/Reindeers/blob/master/CONTRIBUTING.md) file for more info.\n\n## License\n\n**Reindeers** is available under the MIT license. See the [LICENSE](https://github.com/onmyway133/Reindeers/blob/master/LICENSE.md) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonmyway133%2Freindeers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonmyway133%2Freindeers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonmyway133%2Freindeers/lists"}