{"name":"xml-parser-xo","version":"4.1.4","keywords":["xml","parse","parser","convert","converter","syntax","tree"],"author":{"name":"Chris Bottin","email":"chrisbottin@gmail.com"},"license":"MIT","_id":"xml-parser-xo@4.1.4","maintainers":[{"name":"chrisbottin","email":"chrisbottin@gmail.com"}],"homepage":"https://github.com/chrisbottin/xml-parser#readme","bugs":{"url":"https://github.com/chrisbottin/xml-parser/issues"},"dist":{"shasum":"2b9c05d3336a140a1d2b1e2993d187daa4d7dcfe","tarball":"http://registry-npm.ywwl.com/xml-parser-xo/download/xml-parser-xo-4.1.4.tgz","fileCount":10,"integrity":"sha512-wo+yWDNeMwd1ctzH4CsiGXaAappDsxuR+VnmPewOzHk/zvefksT2ZlcWpAePl11THOWgnIZM4GjvumevurNWZw==","signatures":[{"sig":"MEQCICmlPkX5odQQ4ODc0whzUElbt82j9D0TdeTMqN5QpcKSAiA33YOixN6j3f0GkT7efJYHVlG5XP555bnptkpX5+Hfmg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43191,"size":8157,"noattachment":false,"key":"/xml-parser-xo/-/xml-parser-xo-4.1.4.tgz"},"main":"./dist/cjs/index.js","types":"./dist/types/index.d.ts","es2015":"./dist/esm/index.js","engines":{"node":">= 16"},"gitHead":"93c8a780451529eb4c3f2c0e3b549074e921f605","scripts":{"lint":"eslint . --ext=js,ts","test":"mocha --require=ts-node/register --extension=js,ts --spec=test","clean":"rm -rf ./dist","compile":"npm run clean && npm run lint && npm run compile:commonjs && npm run compile:esnext && npm run compile:types","compile:types":"tsc --emitDeclarationOnly --declaration --declarationMap --outDir ./dist/types --noEmit false","compile:esnext":"tsc --module esnext --outDir ./dist/esm --noEmit false","prepublishOnly":"echo Please use publish.sh && exit 1","compile:commonjs":"tsc --module commonjs --outDir ./dist/cjs --noEmit false"},"_npmUser":{"name":"chrisbottin","email":"chrisbottin@gmail.com"},"repository":{"url":"git+https://github.com/chrisbottin/xml-parser.git","type":"git"},"_npmVersion":"10.9.2","description":"Parse a XML string into a proprietary syntax tree","directories":{},"sideEffects":false,"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"chai":"^4.3.4","mocha":"^10.2.0","eslint":"^6.8.0","ts-node":"^10.9.1","typescript":"^4.8.3","@types/chai":"^4.3.3","@types/node":"^14.18.29","@types/mocha":"^7.0.2","@typescript-eslint/parser":"^5.37.0","@typescript-eslint/eslint-plugin":"^5.37.0"},"_npmOperationalInternal":{"tmp":"tmp/xml-parser-xo_4.1.4_1746994192242_0.19564646246633477","host":"s3://npm-registry-packages-npm-production"},"readme":"\n# xml-parser-xo\n\nAn XML parser based on [xml-parser](https://www.npmjs.com/package/xml-parser).\n\n[![Build Status](https://github.com/chrisbottin/xml-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/chrisbottin/xml-parser/actions/workflows/ci.yml) [![npm version](https://img.shields.io/npm/v/xml-parser-xo.svg)](https://npmjs.org/package/xml-parser-xo)\n\n## Installation\n\n```\n$ npm install xml-parser-xo\n```\n\n## Example\n\n### Usage:\n\n```js\nimport xmlParser from 'xml-parser-xo';\n\nvar xml = `<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Load the stylesheet -->\n<?xml-stylesheet href=\"foo.xsl\" type=\"text/xsl\" ?>\n<!DOCTYPE foo SYSTEM \"foo.dtd\">\n<foo><![CDATA[some text]]> content</foo>`;\n\nxmlParser(xml);\n```\n\n### Output:\n\n```json\n{\n    \"declaration\": {\n        \"type\": \"ProcessingInstruction\",\n        \"attributes\": {\"version\": \"1.0\", \"encoding\": \"utf-8\"}\n    },\n    \"root\": {\n        \"type\": \"Element\",\n        \"name\": \"foo\",\n        \"attributes\": {},\n        \"children\": [\n            {\"type\": \"CDATA\", \"content\": \"<![CDATA[some text]]>\"},\n            {\"type\": \"Text\", \"content\": \" content\"}\n        ]\n    },\n    \"children\": [\n        {\"type\": \"Comment\", \"content\": \"<!-- Load the stylesheet -->\"},\n        {\"type\": \"ProcessingInstruction\", \"attributes\": {\"href\": \"foo.xsl\", \"type\": \"text/xsl\"}},\n        {\"type\": \"DocumentType\", \"content\": \"<!DOCTYPE foo SYSTEM \\\"foo.dtd\\\">\"},\n        {\n            \"type\": \"Element\",\n            \"name\": \"foo\",\n            \"attributes\": {},\n            \"children\": [\n                {\"type\": \"CDATA\", \"content\": \"<![CDATA[some text]]>\"},\n                {\"type\": \"Text\", \"content\": \" content\"}\n            ]\n        }\n    ]\n}\n```\n\n## Options\n\n- `filter`: Function to filter out unwanted nodes by returning `false`.\n  - type: `function(node) => boolean`\n  - default: `() => true`\n- `strictMode`: True to throw an error when parsing XML document with invalid content like mismatched closing tags.\n  - type: `boolean`\n  - default: `false`\n\n### Usage:\n\n```js\nimport xmlParser from 'xml-parser-xo';\n\nconst xml = `<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Load the stylesheet -->\n<?xml-stylesheet href=\"foo.xsl\" type=\"text/xsl\" ?>\n<!DOCTYPE foo SYSTEM \"foo.dtd\">\n<foo><![CDATA[some text]]> content</foo>`;\n\nxmlParser(xml, {\n    filter: (node) => {\n        return node.type === 'Element' || node.type === 'Text';\n    }\n});\n```\n\n### Output:\n\n```json\n{\n    \"declaration\": {\n        \"type\": \"ProcessingInstruction\",\n        \"attributes\": {\"version\": \"1.0\", \"encoding\": \"utf-8\"}\n    },\n    \"root\": {\n        \"type\": \"Element\",\n        \"name\": \"foo\",\n        \"attributes\": {},\n        \"children\": [\n            {\"type\": \"Text\", \"content\": \" content\"}\n        ]\n    },\n    \"children\": [\n        {\n            \"type\": \"Element\",\n            \"name\": \"foo\",\n            \"attributes\": {},\n            \"children\": [\n                {\"type\": \"Text\", \"content\": \" content\"}\n            ]\n        }\n    ]\n}\n```\n\n## License\n\nMIT\n","publish_time":1746994192453,"_cnpm_publish_time":1746994192453,"dist-tags":{"latest":"4.1.6"}}