{"id":21115894,"url":"https://github.com/thomasjo/xml.js","last_synced_at":"2025-03-14T10:26:59.959Z","repository":{"id":17456726,"uuid":"20230689","full_name":"thomasjo/xml.js","owner":"thomasjo","description":"A simple JavaScript library for working with XML data","archived":false,"fork":false,"pushed_at":"2014-05-27T18:33:56.000Z","size":128,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-21T04:41:39.163Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/thomasjo.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}},"created_at":"2014-05-27T18:30:46.000Z","updated_at":"2018-10-01T00:36:03.000Z","dependencies_parsed_at":"2022-09-18T06:35:39.737Z","dependency_job_id":null,"html_url":"https://github.com/thomasjo/xml.js","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/thomasjo%2Fxml.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasjo%2Fxml.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasjo%2Fxml.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasjo%2Fxml.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasjo","download_url":"https://codeload.github.com/thomasjo/xml.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243560853,"owners_count":20310994,"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":[],"created_at":"2024-11-20T02:01:44.129Z","updated_at":"2025-03-14T10:26:59.930Z","avatar_url":"https://github.com/thomasjo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"XML.js\n======\nA minimalistic library for working with XML in JavaScript. Supports converting to and from XML,\nin a simple, straightforward manner.\n\nExample usage\n-------------\nConverting an XML document, in this case, in the form of a string, to a JavaScript object\n\n```js\nvar obj = XML.objectify(\n    \"\u003cstock-quote market=\\\"NYSE\\\"\u003e\" +\n    \"  \u003csymbol\u003eIBM\u003c/symbol\u003e\" +\n    \"  \u003cprice type=\\\"ask\\\" value=\\\"84.25\\\"/\u003e\" +\n    \"  \u003cprice type=\\\"bid\\\" value=\\\"85.00\\\"/\u003e\" +\n    \"  \u003cwhen\u003e\" +\n    \"    \u003cdate\u003e8/5/2005\u003c/date\u003e\" +\n    \"    \u003ctime\u003e12:13PM\u003c/time\u003e\" +\n    \"  \u003c/when\u003e\" +\n    \"\u003c/stock-quote\u003e\"\n    );\n\n/*\nobj = {\n    \"stock-quote\": {\n        \"@market\": \"NASDAQ\",\n        symbol: {\n            \"#text\": \"AAPL\"\n        },\n        price: [\n            { \"@type\": \"ask\", \"@value\": \"412.76\" },\n            { \"@type\": \"bid\", \"@value\": \"413.5\" } \n        ],\n        when: {\n            date: { \"#text\": \"2013-06-21\" },\n            time: { \"#text\": \"22:09\" }\n        }\n    }\n}\n*/\n```\n\nLikewise, we can convert from a JavaScript object to XML\n\n```js\nvar xml = XML.stringify({\n    \"stock-quote\": {\n        \"@market\": \"NASDAQ\",\n        symbol: {\n            \"#text\": \"AAPL\"\n        },\n        price: [\n            { \"@type\": \"ask\", \"@value\": \"412.76\" },\n            { \"@type\": \"bid\", \"@value\": \"413.5\" } \n        ],\n        when: {\n            date: { \"#text\": \"2013-06-21\" },\n            time: { \"#text\": \"22:09\" }\n        }\n    }\n});\n\n// xml = '\u003cstock-quote market=\"NASDAQ\"\u003e\u003csymbol\u003eAAPL\u003c/symbol\u003e\u003cprice type=\"ask\" value=\"412.76\"/\u003e\u003cprice type=\"bid\" value=\"413.5\"/\u003e\u003cwhen\u003e\u003cdate\u003e2013-06-21\u003c/date\u003e\u003ctime\u003e22:09\u003c/time\u003e\u003c/when\u003e\u003c/stock-quote\u003e'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasjo%2Fxml.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasjo%2Fxml.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasjo%2Fxml.js/lists"}