{"id":30377247,"url":"https://github.com/gechandesu/xmlencoder","last_synced_at":"2026-02-12T14:32:54.594Z","repository":{"id":307910135,"uuid":"1031054868","full_name":"gechandesu/xmlencoder","owner":"gechandesu","description":"An experimental XML encoder for V","archived":false,"fork":false,"pushed_at":"2025-08-02T23:10:58.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-20T16:46:39.887Z","etag":null,"topics":["vlang","vlang-package","xml","xml-encoder"],"latest_commit_sha":null,"homepage":"https://gechandesu.github.io/xmlencoder/","language":"V","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/gechandesu.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,"zenodo":null}},"created_at":"2025-08-02T22:57:57.000Z","updated_at":"2025-08-08T08:46:22.000Z","dependencies_parsed_at":"2025-08-03T01:06:26.443Z","dependency_job_id":"b20f6118-825d-4465-a712-c2d6af99be09","html_url":"https://github.com/gechandesu/xmlencoder","commit_stats":null,"previous_names":["gechandesu/xmlencoder"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gechandesu/xmlencoder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gechandesu%2Fxmlencoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gechandesu%2Fxmlencoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gechandesu%2Fxmlencoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gechandesu%2Fxmlencoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gechandesu","download_url":"https://codeload.github.com/gechandesu/xmlencoder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gechandesu%2Fxmlencoder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29368690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["vlang","vlang-package","xml","xml-encoder"],"created_at":"2025-08-20T16:29:04.354Z","updated_at":"2026-02-12T14:32:54.577Z","avatar_url":"https://github.com/gechandesu.png","language":"V","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XML encoder library for V\n\nThe `xmlencoder` module provides a way to marshal V structs into XML documents, similar to what the `json` module does.\n\nUse `xml` attribute to set XML document and field names and encoder special options:\n\n- a field with attribute `-` is omitted.\n- a field with attribute `name,attr` becomes an attribute with the given name in the XML element.\n- a field with attribute `,attr` becomes an attribute with the field name in the XML element.\n- a field with attribute `,chardata` is written as character data, not as an XML element.\n- a field with attribute `,cdata` is written as character data wrapped in one or more `\u003c![CDATA[ ... ]]\u003e` tags, not as an XML element.\n- a field with attribute `,comment` is written as an XML comment. It must not contain the `--` string within it.\n\nXML Namespaces are also supported. See examples below.\n\n## Examples\n\n```v\nimport xmlencoder\n\n@[xml: 'user']\nstruct User {\n    first_name string @[xml: 'firstName']\n    last_name  string @[xml: 'lastName']\n    age        int\n    skipped    int @[xml: '-']\n}\n\nfn main() {\n    user := User{'John', 'Doe', 27, -1}\n    assert xmlencoder.encode(user, pretty: true) == '\n    \u003cuser\u003e\n      \u003cfirstName\u003eJohn\u003c/firstName\u003e\n      \u003clastName\u003eDoe\u003c/lastName\u003e\n      \u003cage\u003e27\u003c/age\u003e\n    \u003c/user\u003e'.trim_indent()\n}\n```\n\nTag with attrubutes:\n\n```v\n@[xml: topology]\nstruct Topology {\n    sockets int @[xml: ',attr']\n    cores   int @[xml: ',attr']\n    threads int @[xml: ',attr']\n}\n\nfn main() {\n    topo := Topology{1, 4, 1}\n    assert xmlencoder.encode(topo) == \"\u003ctopology sockets='1' cores='4' threads='1'/\u003e\"\n}\n```\n\nExample with `,chardata`:\n\n```v\n@[xml: memory]\nstruct Memory {\n    unit  string @[xml: ',attr']\n    value u64    @[xml: ',chardata']\n}\n\nfn main() {\n    mem := Memory{'MiB', 10240}\n    assert xmlencoder.encode(mem) == \"\u003cmemory unit='MiB'\u003e10240\u003c/memory\u003e\"\n}\n```\n\nFor XML Namespaces specify `xmlns` attribute with comma separated `PREFIX,URI` arguments:\n\n```v ignore\n@[xmlns: 'exampl,https://example.com/xmlns/EXAMPL']\n@[xml: 'metadata']\nstruct Metadata {\n    tag []string\n}\n\nfn main() {\n    m := Metadata{['foobar', 'foobaz']}\n    assert xmlencoder.encode(m, pretty: true) == \"\n    \u003cexampl:metadata xmlns:exampl='https://example.com/xmlns/EXAMPL'\u003e\n      \u003cexampl:tag\u003efoobar\u003c/exampl:tag\u003e\n      \u003cexampl:tag\u003efoobaz\u003c/exampl:tag\u003e\n    \u003c/exampl:metadata\u003e\".trim_indent()\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgechandesu%2Fxmlencoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgechandesu%2Fxmlencoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgechandesu%2Fxmlencoder/lists"}