{"id":22222004,"url":"https://github.com/fabiospampinato/xml-simple-parser","last_synced_at":"2025-07-27T16:32:11.432Z","repository":{"id":192246712,"uuid":"686680947","full_name":"fabiospampinato/xml-simple-parser","owner":"fabiospampinato","description":"A simple and tiny XML parser and stringifier.","archived":false,"fork":false,"pushed_at":"2023-09-24T16:28:51.000Z","size":8,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-12T17:51:33.261Z","etag":null,"topics":["parser","simple","stringifier","tiny","xml"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/fabiospampinato.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}},"created_at":"2023-09-03T15:47:55.000Z","updated_at":"2023-12-11T16:09:11.000Z","dependencies_parsed_at":"2023-09-03T18:08:48.280Z","dependency_job_id":null,"html_url":"https://github.com/fabiospampinato/xml-simple-parser","commit_stats":null,"previous_names":["fabiospampinato/xml-simple-parser"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fxml-simple-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fxml-simple-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fxml-simple-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fxml-simple-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiospampinato","download_url":"https://codeload.github.com/fabiospampinato/xml-simple-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227817017,"owners_count":17824200,"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":["parser","simple","stringifier","tiny","xml"],"created_at":"2024-12-02T23:16:30.736Z","updated_at":"2024-12-02T23:16:31.273Z","avatar_url":"https://github.com/fabiospampinato.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XML Simple Parser\n\nA simple and tiny XML parser and stringifier.\n\n## Install\n\n```sh\nnpm install --save xml-simple-parser\n```\n\n## Usage\n\n```ts\nimport XML from 'xml-simple-parser';\n\n// It can parse an XML string\n\nconst svg = `\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?\u003e\n\u003c!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"\u003e\n\u003csvg width=\"100%\" height=\"100%\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:space=\"preserve\"\u003e\n  \u003crect x=\"11\" y=\"4\" width=\"2\" height=\"16\"/\u003e\n\u003c/svg\u003e\n`;\n\nconst ast = XML.parse ( svg );\n// {\n//   \"type\": \"root\",\n//   \"children\": [\n//     {\n//       \"type\": \"prolog\",\n//       \"attributes\": {\n//         \"version\": \"1.0\",\n//         \"encoding\": \"UTF-8\",\n//         \"standalone\": \"no\"\n//       }\n//     },\n//     {\n//       \"type\": \"doctype\",\n//       \"value\": \"svg PUBLIC \\\"-//W3C//DTD SVG 1.1//EN\\\" \\\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\\\"\",\n//       \"values\": [\n//         \"svg\",\n//         \"PUBLIC\",\n//         \"-//W3C//DTD SVG 1.1//EN\",\n//         \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"\n//       ]\n//     },\n//     {\n//       \"type\": \"element\",\n//       \"name\": \"svg\",\n//       \"attributes\": {\n//         \"width\": \"100%\",\n//         \"height\": \"100%\",\n//         \"viewBox\": \"0 0 24 24\",\n//         \"version\": \"1.1\",\n//         \"xmlns\": \"http://www.w3.org/2000/svg\",\n//         \"xmlns:xlink\": \"http://www.w3.org/1999/xlink\",\n//         \"xml:space\": \"preserve\"\n//       },\n//       \"children\": [\n//         {\n//           \"type\": \"text\",\n//           \"value\": \"\\n  \"\n//         },\n//         {\n//           \"type\": \"element\",\n//           \"name\": \"rect\",\n//           \"attributes\": {\n//             \"x\": \"11\",\n//             \"y\": \"4\",\n//             \"width\": \"2\",\n//             \"height\": \"16\"\n//           },\n//           \"children\": [],\n//           \"void\": true\n//         },\n//         {\n//           \"type\": \"text\",\n//           \"value\": \"\\n\"\n//         }\n//       ],\n//       \"void\": false\n//     },\n//     {\n//       \"type\": \"text\",\n//       \"value\": \"\\n\"\n//     }\n//   ]\n// }\n\n// It can stringify an AST back to an equivalent XML string\n\nconst xml = XML.stringify ( ast );\n// \u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?\u003e\n// \u003c!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"\u003e\n// \u003csvg width=\"100%\" height=\"100%\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:space=\"preserve\"\u003e\n//   \u003crect x=\"11\" y=\"4\" width=\"2\" height=\"16\"/\u003e\n// \u003c/svg\u003e\n\n// It can check if a string is a valid XML string, according to this parser anyway\n\nvalidate ( svg ); // =\u003e true\nvalidate ( xml ); // =\u003e true\n```\n\n## License\n\nMIT © Fabio Spampinato\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Fxml-simple-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiospampinato%2Fxml-simple-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Fxml-simple-parser/lists"}