{"id":13764119,"url":"https://github.com/shabbyrobe/xmlwriter","last_synced_at":"2025-03-22T10:31:50.603Z","repository":{"id":19781248,"uuid":"87889223","full_name":"shabbyrobe/xmlwriter","owner":"shabbyrobe","description":"xmlwriter is a pure-Go library providing procedural XML generation based on libxml2's xmlwriter module","archived":false,"fork":false,"pushed_at":"2023-05-25T08:38:48.000Z","size":167,"stargazers_count":28,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T10:38:03.739Z","etag":null,"topics":["go","golang","pure-go","xml"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shabbyrobe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2017-04-11T04:43:26.000Z","updated_at":"2024-10-04T13:46:45.000Z","dependencies_parsed_at":"2024-06-18T18:16:02.119Z","dependency_job_id":"24d1bb1a-c82e-4ebd-9cd8-394a591b5b8e","html_url":"https://github.com/shabbyrobe/xmlwriter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shabbyrobe%2Fxmlwriter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shabbyrobe%2Fxmlwriter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shabbyrobe%2Fxmlwriter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shabbyrobe%2Fxmlwriter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shabbyrobe","download_url":"https://codeload.github.com/shabbyrobe/xmlwriter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244943935,"owners_count":20536290,"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":["go","golang","pure-go","xml"],"created_at":"2024-08-03T15:01:14.454Z","updated_at":"2025-03-22T10:31:50.318Z","avatar_url":"https://github.com/shabbyrobe.png","language":"Go","funding_links":[],"categories":["XML","Libraries for creating HTTP middlewares"],"sub_categories":["Routers","路由器","创建http中间件的代码库","高级控制台界面","高級控制台界面"],"readme":"xmlwriter\n=========\n\n[![GoDoc](https://godoc.org/github.com/shabbyrobe/xmlwriter?status.svg)](https://godoc.org/github.com/shabbyrobe/xmlwriter)\n![Go](https://github.com/shabbyrobe/xmlwriter/workflows/Go/badge.svg)\n\nxmlwriter is a pure-Go library providing a procedural XML generation API based\non libxml2's xmlwriter module. The package is extensively documented at\n[GoDoc](https://godoc.org/github.com/shabbyrobe/xmlwriter).\n\nQuick example:\n\n```go\nfunc main() {\n    b := \u0026bytes.Buffer{}\n    w := xmlwriter.Open(b)\n    ec := \u0026xmlwriter.ErrCollector{}\n    defer ec.Panic()\n\n    ec.Do(\n        w.StartDoc(xmlwriter.Doc{})\n        w.StartElem(xmlwriter.Elem{Name: \"foo\"})\n        w.WriteAttr(xmlwriter.Attr{Name: \"a1\", Value: \"val1\"})\n        w.WriteAttr(xmlwriter.Attr{Name: \"a2\", Value: \"val2\"})\n        w.WriteComment(xmlwriter.Comment{\"hello\"})\n        w.StartElem(xmlwriter.Elem{Name: \"bar\"})\n        w.WriteAttr(xmlwriter.Attr{Name: \"a1\", Value: \"val1\"})\n        w.WriteAttr(xmlwriter.Attr{Name: \"a2\", Value: \"val2\"})\n        w.StartElem(xmlwriter.Elem{Name: \"baz\"})\n        w.EndAllFlush()\n    )\n    fmt.Println(b.String())\n}\n```\n\nxmlwriter is about twice as quick as using the stdlib's `encoding/xml` and\noffers total control of the output. If you don't require that level of control,\nit's probably better to stick with `encoding/xml`\n\n    BenchmarkWriterHuge-8     \t     165\t   7189290 ns/op\t    4944 B/op\t       4 allocs/op\n    BenchmarkWriterSmall-8    \t  299679\t      4035 ns/op\t    4944 B/op\t       4 allocs/op\n    BenchmarkGolangHuge-8      \t      52\t  21770422 ns/op\t 4324496 B/op\t   60008 allocs/op\n    BenchmarkGolangSmall-8    \t  139767\t      8828 ns/op\t    5936 B/op\t      28 allocs/op\n\nxmlwriter is exhaustively tested using a fairly insane mess of C scripts you\ncan find in the `tester/` directory.\n\n\nLicense\n-------\n\nxmlwriter uses the Apache License 2.0. I pulled in about 60 lines of code from\nthe `xml/encoding` package in the Go sources and retained the copyright. Not sure \nthe exact implications, IANAL. Please file an issue if I've done something wrong.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshabbyrobe%2Fxmlwriter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshabbyrobe%2Fxmlwriter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshabbyrobe%2Fxmlwriter/lists"}