{"id":17540045,"url":"https://github.com/yockow/swiftxhtml","last_synced_at":"2025-03-29T04:32:13.122Z","repository":{"id":42396604,"uuid":"179649201","full_name":"YOCKOW/SwiftXHTML","owner":"YOCKOW","description":"XHTML parser/generator in Swift.","archived":false,"fork":false,"pushed_at":"2024-10-27T07:04:00.000Z","size":327,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-03T14:18:26.132Z","etag":null,"topics":["swift","xhtml"],"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/YOCKOW.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2019-04-05T08:51:27.000Z","updated_at":"2024-10-27T07:03:38.000Z","dependencies_parsed_at":"2024-10-27T07:49:19.417Z","dependency_job_id":null,"html_url":"https://github.com/YOCKOW/SwiftXHTML","commit_stats":null,"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YOCKOW%2FSwiftXHTML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YOCKOW%2FSwiftXHTML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YOCKOW%2FSwiftXHTML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YOCKOW%2FSwiftXHTML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YOCKOW","download_url":"https://codeload.github.com/YOCKOW/SwiftXHTML/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246140565,"owners_count":20729797,"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":["swift","xhtml"],"created_at":"2024-10-20T22:07:54.733Z","updated_at":"2025-03-29T04:32:13.105Z","avatar_url":"https://github.com/YOCKOW.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is `SwiftXHTML`?\n\n`SwiftXHTML` will provide some functions related to XHTML.  \nIt was originally written as a part of [SwiftCGIResponder](https://github.com/YOCKOW/SwiftCGIResponder),\nand is intended to be used by it.\n\n\n# Requirements\n\n- Swift 5, 6\n- macOS(\u003e=10.15) or Linux\n\n## Dependencies\n\n![Dependencies](./dependencies.svg)\n\n\n# Usage\n\n## As a parser\n\n```Swift\nimport XHTML\n\nlet string = \"\"\"\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE html\u003e\n\u003chtml xmlns=\"http://www.w3.org/1999/xhtml\"\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eTitle\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cdiv id=\"main\"\u003e\n      \u003ch1\u003eMy Page\u003c/h1\u003e\n      \u003cp\u003eWelcome to my page.\u003c/p\u003e\n    \u003c/div\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n\"\"\"\n\nlet document = try Parser.parse(string.data(using: .utf8)!)\n\nprint(document.prolog.xmlVersion) // -\u003e \"1.0\"\nprint(document.element(for: \"main\")!.name) // -\u003e \"div\"\n\n```\n\n\n## As a generator\n\n```Swift\nimport XHTML\n\nlet page = Document.template(title: \"Title\",\n                             contents:[.text(\"It's my page.\")])\nprint(page.xhtmlString)\n\n/*\n-- OUTPUT --\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003c!DOCTYPE html\u003e\n\u003chtml xmlns=\"http://www.w3.org/1999/xhtml\"\u003e\u003chead\u003e\u003ctitle\u003eTitle\u003c/title\u003e\u003c/head\u003e\u003cbody\u003eIt\u0026apos;s my page.\u003c/body\u003e\u003c/html\u003e\n\n*/\n\npage.rootElement.body!.append(.comment(\"This is a comment.\"))\nprint(page.prettyXHTMLString)\n\n/*\n-- OUTPUT --\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003c!DOCTYPE html\u003e\n\u003chtml xmlns=\"http://www.w3.org/1999/xhtml\"\u003e\n    \u003chead\u003e\u003ctitle\u003eTitle\u003c/title\u003e\u003c/head\u003e\n    \u003cbody\u003e\n        It\u0026apos;s my page.\n        \u003c!--This is a comment.--\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n\n*/\n```\n\n\n## What are not supported yet...\n\n- XPath\n- CSS selector\n- CSS parser\n\n\n# License\n\nMIT License.  \nSee \"LICENSE.txt\" for more information.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyockow%2Fswiftxhtml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyockow%2Fswiftxhtml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyockow%2Fswiftxhtml/lists"}