{"id":16609287,"url":"https://github.com/thedome/xmljs-sax","last_synced_at":"2025-06-14T16:05:24.305Z","repository":{"id":36988513,"uuid":"272132985","full_name":"TheDome/xmljs-sax","owner":"TheDome","description":"An xml parsing libary using sax.js","archived":false,"fork":false,"pushed_at":"2023-03-29T00:59:26.000Z","size":2068,"stargazers_count":2,"open_issues_count":9,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-06-08T22:08:34.780Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheDome.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}},"created_at":"2020-06-14T04:32:16.000Z","updated_at":"2022-11-01T01:47:56.000Z","dependencies_parsed_at":"2025-02-10T08:37:38.235Z","dependency_job_id":null,"html_url":"https://github.com/TheDome/xmljs-sax","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/TheDome/xmljs-sax","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDome%2Fxmljs-sax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDome%2Fxmljs-sax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDome%2Fxmljs-sax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDome%2Fxmljs-sax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheDome","download_url":"https://codeload.github.com/TheDome/xmljs-sax/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDome%2Fxmljs-sax/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259843320,"owners_count":22920309,"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-10-12T01:28:40.526Z","updated_at":"2025-06-14T16:05:24.280Z","avatar_url":"https://github.com/TheDome.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XML-Sax\n\n[![codecov](https://codecov.io/gh/TheDome/xmljs-sax/branch/develop/graph/badge.svg?token=BIEQR9H432)](https://codecov.io/gh/TheDome/xmljs-sax)\n[![npm](https://img.shields.io/npm/v/saxxmlparser?color=red\u0026label=version)](https://www.npmjs.com/package/saxxmlparser)\n[![npm](https://img.shields.io/npm/dt/saxxmlparser)](https://www.npmjs.com/package/saxxmlparser)\n[![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/thedome/xmljs-sax/latest)](https://github.com/TheDome/xmljs-sax/compare/master...develop)\n\nA small package to transverse xml into javascript\n\n## Example\n\n### Parse.ts\n\n```typescript\nimport { readFileSync } from \"fs\";\nimport parse from \"saxxmlparser\";\n\nvar xml = readFileSync(\"xml.xml\");\n\nparse(xml).then((node) =\u003e {\n  var price = node.resolveNSPath(\n    \"A:envelope/A:body/B:getstockPriceResponsE/B:price\",\n    {\n      A: \"http://www.w3.org/2001/12/soap-envelope\",\n      B: \"http://www.example.org/stock\",\n    }\n  );\n  console.log(price.value); // Prints 34.5\n});\n```\n\n### xml.xml\n\n```xml\n\u003c?xml version=\"1.0\"?\u003e\n\u003csoap:Envelope\nxmlns:soap=\"http://www.w3.org/2001/12/soap-envelope\"\nsoap:encodingStyle=\"http://www.w3.org/2001/12/soap-encoding\"\u003e\n\n  \u003csoap:Body xmlns:m=\"http://www.example.org/stock\"\u003e\n    \u003cm:GetStockPriceResponse\u003e\n      \u003cm:Price\u003e34.5\u003c/m:Price\u003e\n    \u003c/m:GetStockPriceResponse\u003e\n  \u003c/soap:Body\u003e\n\n\u003c/soap:Envelope\u003e\n```\n\n## Usage\n\n### resolving a specific child\n\n```typescript\nimport { readFileSync } from \"fs\";\nimport parse from \"saxxmlparser\";\n\nvar xml = readFileSync(\"xml.xml\");\n\nparse(xml).then((node) =\u003e {\n  var price = node.resolveNSPath(\n    \"A:envelope/A:body/B:getstockPriceResponsE/B:price\", // Put the absolute path to the child in here\n    {\n      A: \"http://www.w3.org/2001/12/soap-envelope\",\n      B: \"http://www.example.org/stock\",\n    }\n  );\n  console.log(price.value); // Prints 34.5\n});\n```\n\n### Resolving a child whose parents don't matter\n\nSometimes when you only want a specific child but the parents or the path does not matter\n\n```typescript\nimport { readFileSync } from \"fs\";\nimport parse from \"saxxmlparser\";\n\nvar xml = readFileSync(\"xml.xml\");\n\nparse(xml).then((node) =\u003e {\n  // A double slash (//) in front of the search triggers a child search\n  var price = node.resolveNSPath(\n    \"//B:price\", // Put the absolute path to the child in here\n    {\n      A: \"http://www.w3.org/2001/12/soap-envelope\",\n      B: \"http://www.example.org/stock\",\n    }\n  );\n  console.log(price.value); // Prints 34.5\n});\n```\n\n### Resolving a child of a child whose parents don't matter\n\nSometimes when you only want a specific child but the parents or the path does not matter\n\n```typescript\nimport { readFileSync } from \"fs\";\nimport parse from \"saxxmlparser\";\n\nvar xml = readFileSync(\"xml.xml\");\n\nparse(xml).then((node) =\u003e {\n  // A double slash (//) in front of the search triggers a child search\n  var price = node.resolveNSPath(\n    \"//B:GetStockPriceResponse/B:price\", // Put the absolute path to the child in here\n    {\n      A: \"http://www.w3.org/2001/12/soap-envelope\",\n      B: \"http://www.example.org/stock\",\n    }\n  );\n  console.log(price.value); // Prints 34.5\n});\n```\n\n## Functions\n\n### Resolver\n\nParses the supplied xml and returns the root node\nIf strict is set to true, the sax parser will be instructed to use strict mode (defaults to true)\n\n`parse(xml, strict = true): Promise\u003cXmlNode\u003e`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedome%2Fxmljs-sax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthedome%2Fxmljs-sax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedome%2Fxmljs-sax/lists"}