{"id":20360895,"url":"https://github.com/deijin27/wren-xsequence","last_synced_at":"2026-02-10T20:33:19.380Z","repository":{"id":37495599,"uuid":"499254749","full_name":"Deijin27/wren-xsequence","owner":"Deijin27","description":"XML parser/writer for the Wren programming language","archived":false,"fork":false,"pushed_at":"2025-09-26T21:18:04.000Z","size":226,"stargazers_count":5,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-26T23:27:36.129Z","etag":null,"topics":["wren","wren-language","xml","xml-parser"],"latest_commit_sha":null,"homepage":"","language":"Wren","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/Deijin27.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-06-02T18:55:41.000Z","updated_at":"2025-09-26T21:18:08.000Z","dependencies_parsed_at":"2023-12-09T17:23:29.924Z","dependency_job_id":"89f1ba20-646b-4e9a-8c15-61d645458153","html_url":"https://github.com/Deijin27/wren-xsequence","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/Deijin27/wren-xsequence","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deijin27%2Fwren-xsequence","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deijin27%2Fwren-xsequence/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deijin27%2Fwren-xsequence/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deijin27%2Fwren-xsequence/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Deijin27","download_url":"https://codeload.github.com/Deijin27/wren-xsequence/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deijin27%2Fwren-xsequence/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29314705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T17:48:59.043Z","status":"ssl_error","status_checked_at":"2026-02-10T17:45:37.240Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["wren","wren-language","xml","xml-parser"],"created_at":"2024-11-14T23:43:19.162Z","updated_at":"2026-02-10T20:33:19.360Z","avatar_url":"https://github.com/Deijin27.png","language":"Wren","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XSequence\n\nXml parser/writer for [Wren](https://wren.io/)\n\nApi similar to [C#'s XLinq](https://docs.microsoft.com/en-us/dotnet/standard/linq/linq-xml-overview)\n\nTo use, download the [latest release](https://github.com/Deijin27/wren-xsequence/releases/latest) and take the single file `xsequence.wren` and put it into your project\n\n[Documentation](https://github.com/Deijin27/wren-xsequence/blob/master/docs.md)\n\n## Quick Examples\n\nTo create an xml document like this:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cfishies amount=\"2\"\u003e\n  \u003c!--This is a comment in an element--\u003e\n  \u003cdanio name=\"zebra\" color=\"red\"/\u003e\n  \u003cdanio name=\"pearl\" color=\"pink\"/\u003e\n  \u003cdanio\u003evalue\u003c/danio\u003e\n\u003c/fishies\u003e\n\u003c!--This is a comment in a document--\u003e\n```\n\nYou can write code like this to build the tree\n\n```wren\nimport \"./xsequence\" for XDocument, XElement, XAttribute, XComment\n\nvar doc = XDocument.new(\n    XElement.new(\"fishies\",\n        XComment.new(\"This is a comment in an element\"),\n        XAttribute.new(\"amount\", 2),\n        XElement.new(\"danio\",\n            XAttribute.new(\"name\", \"zebra\"),\n            XAttribute.new(\"color\", \"red\")\n        ),\n        XElement.new(\"danio\",\n            XAttribute.new(\"name\", \"pearl\"),\n            XAttribute.new(\"color\", \"pink\")\n        ),\n        XElement.new(\"danio\", \"value\")\n    ),\n    XComment.new(\"This is a comment in a document\")\n)\n```\n\nThen to save to a string you can either do \n\n```wren\nvar string = doc.toString\n```\n\nOr for better performance if you are able to write directly to a file stream, you can hook in a custom writer function\n\n```wren\ndoc.write {|s|\n  stream.writeString(s)\n}\n```\n\nTo parse xml document, you first load the xml into a string, then parse it with XDocument. In wren_cli you could do something like this\n\n```wren\nvar xmlText = File.read(\"myDocument.xml\")\nvar doc = XDocument.parse(xmlText)\n```\n\nIf we have a document loaded which is like the fishies document shown above, you could navigate the names of all fishies which are pink\n\n```wren\nvar colorOfFishCalledPearl = doc\n    .elementOrAbort(\"fishies\")\n    .elements(\"danio\")\n    .where {|e| e.attributeValue(\"color\") == \"pink\" }\n    .map {|e| e.attributeValue(\"name\") }\n    .toList\n```\n\nYou can get the values converted to number, or boolean too. In the following example we get the fish called pearl,\nthen get it's size converted to a Num. If there is no \"size\" attribute, then it uses the default value provided 2.\nThis converter funcionality is extensible, see the \"collada\" example.\n\n```wren\nvar pearlTheFish = doc.elementOrAbort(\"fishies\").findElement(\"danio\") {|e| e.attributeValue(\"name\") == \"pearl\" }\nvar sizeOfPearl = pearlTheFish.attributeValue(\"size\", Num, 2)\n```\n\nThe library also supports namespaces like so\n\n```wren\nvar element = XElement.parse(\"\u003cp:svg xmlns:p='http://www.w3.org/2000/svg'/\u003e\")\n// will load into an element identical to\nelement = XElement.new(\"{http://www.w3.org/2000/svg}svg\", XAttribute.xmlns(\"p\", \"http://www.w3.org/2000/svg\"))\n// the namespace prefix is replaced with the value itself delimited by curly braces\n```\n\n## Testing\n\nUsing [wren-assert](https://github.com/RobLoach/wren-assert) for generic assertions.\n\nTo run tests use [wren cli](https://github.com/wren-lang/wren-cli)\n\n```powershell\n\u003e wren_cli.exe test.wren\n```\n\nIf you're using vscode you can use the automated task\n\nThe exceptions are caught by default, which loses the call stack. To view the callstack set at the start of the file the global variable `DEBUG=true`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeijin27%2Fwren-xsequence","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeijin27%2Fwren-xsequence","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeijin27%2Fwren-xsequence/lists"}