{"id":15059602,"url":"https://github.com/ymtszw/elm-xml-decode","last_synced_at":"2025-10-25T11:37:40.791Z","repository":{"id":27283521,"uuid":"113199844","full_name":"ymtszw/elm-xml-decode","owner":"ymtszw","description":"Elm XML decoder sharing the spirit of Json.Decode","archived":false,"fork":false,"pushed_at":"2024-05-23T06:38:15.000Z","size":952,"stargazers_count":16,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T05:04:01.445Z","etag":null,"topics":["decoder","elm","elm-lang","xml"],"latest_commit_sha":null,"homepage":"http://package.elm-lang.org/packages/ymtszw/elm-xml-decode/latest/","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ymtszw.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-12-05T15:32:37.000Z","updated_at":"2024-05-23T06:38:18.000Z","dependencies_parsed_at":"2024-05-23T07:35:27.719Z","dependency_job_id":"a0ff6bc3-6d41-4420-b5a6-820c5889ce4c","html_url":"https://github.com/ymtszw/elm-xml-decode","commit_stats":{"total_commits":124,"total_committers":7,"mean_commits":"17.714285714285715","dds":0.08870967741935487,"last_synced_commit":"2d3266d43ec7fa669e546a4989ef3e4d985fcaaa"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymtszw%2Felm-xml-decode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymtszw%2Felm-xml-decode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymtszw%2Felm-xml-decode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymtszw%2Felm-xml-decode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ymtszw","download_url":"https://codeload.github.com/ymtszw/elm-xml-decode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166120,"owners_count":21058474,"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":["decoder","elm","elm-lang","xml"],"created_at":"2024-09-24T22:45:53.960Z","updated_at":"2025-10-25T11:37:35.735Z","avatar_url":"https://github.com/ymtszw.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# elm-xml-decode\n\n[![Main Workflow](https://github.com/ymtszw/elm-xml-decode/actions/workflows/main.yml/badge.svg)](https://github.com/ymtszw/elm-xml-decode/actions/workflows/main.yml)\n\nXML decoder, sharing the spirit of [`Json.Decode`][jd]. Ready for Elm 0.19.\n\nUsing [miniBill/elm-xml-parser][exp] as its parser component, which is based on [elm/parser][ep].\n\n[jd]: https://github.com/elm/json\n[exp]: http://github.com/miniBill/elm-xml-parser\n[ep]: https://github.com/elm/parser\n\n## Related Works\n\n[eeue56/elm-xml][ex] was an existing full-package XML parser/decoder for Elm,\nthough I intended to provide an alternative XML decoder which exhibits following properties:\n\n- Provides [`Decoder`][de]-based APIs, sharing the spirit of [`Json.Decode`][jd]\n- Also provides DSL-styled decoder compositions, sharing the sprits of [`Json.Decode.Pipeline`][jdp]\n- Handles list of XML node with identical tags, using [`ListDecoder`][ld] type\n- Locates targeting XML nodes using \"path\" of tags, partially mimicking XPath\n\n[ex]: https://github.com/eeue56/elm-xml\n[de]: https://package.elm-lang.org/packages/ymtszw/elm-xml-decode/latest/Xml-Decode#Decoder\n[jdp]: https://package.elm-lang.org/packages/NoRedInk/elm-decode-pipeline/latest/Json-Decode-Pipeline\n[ld]: https://package.elm-lang.org/packages/ymtszw/elm-xml-decode/latest/Xml-Decode#ListDecoder\n\n## Examples\n\nBasics:\n\n```elm\nimport Xml.Decode exposing (..)\n\ntype alias Data =\n    { string : String\n    , integers : List Int\n    }\n\ndataDecoder : Decoder Data\ndataDecoder =\n    map2 Data\n        (path [ \"path\", \"to\", \"string\", \"value\" ] (single string))\n        (path [ \"path\", \"to\", \"int\", \"values\" ] (list int))\n\nrun dataDecoder\n    \"\"\"\n    \u003croot\u003e\n        \u003cpath\u003e\n            \u003cto\u003e\n                \u003cstring\u003e\n                    \u003cvalue\u003eSomeString\u003c/value\u003e\n                \u003c/string\u003e\n                \u003cint\u003e\n                    \u003cvalues\u003e1\u003c/values\u003e\n                    \u003cvalues\u003e2\u003c/values\u003e\n                \u003c/int\u003e\n            \u003c/to\u003e\n        \u003c/path\u003e\n    \u003c/root\u003e\n    \"\"\"\n--\u003e Ok { string = \"SomeString\", integers = [ 1, 2 ] }\n```\n\n### Pipeline Decoder compositions\n\nWe have `map`, `map2` and variants, though the Pipeline style is also possible:\n\n```elm\npipelineDecoder : Decoder Data\npipelineDecoder =\n    succeed Data\n        |\u003e requiredPath [ \"path\", \"to\", \"string\", \"value\" ] (single string)\n        |\u003e requiredPath [ \"path\", \"to\", \"int\", \"values\" ] (list int)\n```\n\n## Development\n\nInstall reasonably new Node.js (currently [Node.js 22 is tested](https://github.com/ymtszw/elm-xml-decode/blob/master/.github/workflows/main.yml))\n\n```sh\nnpm install\nnpm test\n```\n\n## Benchmarks\n\nBenchmark app can be found in `benchmarks/` directory.\nUsing [examples in W3School](https://www.w3schools.com/xml/xml_examples.asp) and\n[elm-explorations/benchmark](https://github.com/elm-explorations/benchmark).\n\n```sh\nnpm run generate-benchmark\n# Open docs/index.html\n```\n\nAlso available at \u003chttps://ymtszw.github.io/elm-xml-decode/\u003e\n\n**It may hang for a while** during JIT warming up, but keep waiting (~ a minute).\n\n### Elm 0.19.1, elm-xml-decode 3.2.1\n\nSample result (on my Windows 10 machine):\n\n- Environment\n  - CPU: Intel Core i7-8700K @ 3.7GHz\n  - Mem: 64GB\n  - Windows 10 Pro, 10.0.19044\n  - Google Chrome 98.0.4758.82 64bit\n- Versions\n  - elm 0.19.1\n  - elm-xml-decode version: 3.2.1\n  - elm-benchmark 1.0.2\n\n![bench20220219](https://raw.githubusercontent.com/ymtszw/elm-xml-decode/master/benchmarks/result20220219.png)\n\n## License\n\nBSD-3-Clause\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymtszw%2Felm-xml-decode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fymtszw%2Felm-xml-decode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymtszw%2Felm-xml-decode/lists"}