{"_id":"@anhquoc96/fastxml","name":"@anhquoc96/fastxml","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.2":{"name":"@anhquoc96/fastxml","version":"0.1.2","license":"MIT","description":"DOM-like XML for Node.js and Deno, with incremental streaming parsing.","type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"types":"./dist/index.d.ts","main":"./dist/index.js","scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit"},"engines":{"node":">=18"},"gitHead":"321353c78b100ee364ac6ed20bf93dfd62f10664","_id":"@anhquoc96/fastxml@0.1.2","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-X59DTKsh3+I0EgpVhMirwBcP40XJUuC0O86gidM1qRmwadV/bwsOf8fkQXHn/2kaDGiXFo+r95CzMtaat7M0mA==","shasum":"22423c9faf37d36a42cc7f14e60cdee9c774bd1d","tarball":"https://registry.npmjs.org/@anhquoc96/fastxml/-/fastxml-0.1.2.tgz","fileCount":207,"unpackedSize":177246,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDjTihNhbxsoyTywK8GTniXYJtEYjhAcEomT7NlTgK/MAiAvwjAOf194yrqUcK9hKWikTkWmNNZFXZ9W7I9cCMsXsg=="}]},"_npmUser":{"name":"anhquoc96","email":"aquoc.hue@outlook.com"},"directories":{},"maintainers":[{"name":"anhquoc96","email":"aquoc.hue@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fastxml_0.1.2_1786959224160_0.5240764683545593"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-17T09:33:43.832Z","0.1.2":"2026-08-17T09:33:44.322Z","modified":"2026-08-17T09:33:44.623Z"},"maintainers":[{"name":"anhquoc96","email":"aquoc.hue@outlook.com"}],"description":"DOM-like XML for Node.js and Deno, with incremental streaming parsing.","license":"MIT","readme":"# @anhquoc96/fastxml\n\nPortable XML parsing and DOM-style document APIs for Node.js and Deno.\n\n`fastxml` is the core package in the fastxml family. It supports convenient\ntree-based XML processing and incremental parsing for large documents without\nruntime-specific XML dependencies.\n\n## Installation\n\n```bash\nnpm install @anhquoc96/fastxml\n```\n\nNode.js:\n\n```ts\nimport { parse, loadFile } from \"@anhquoc96/fastxml\";\n```\n\nDeno:\n\n```ts\nimport { parse, parseStream } from \"npm:@anhquoc96/fastxml\";\n```\n\n## Parse XML\n\n```ts\nimport { parse } from \"@anhquoc96/fastxml\";\n\nconst document = parse(\n  `<catalog xmlns=\"urn:example:catalog\"><book id=\"1\">XML</book></catalog>`,\n);\n\nconst book = document.getElementsByTagNameNS(\"urn:example:catalog\", \"book\")[0];\nconsole.log(book.textContent); // XML\nconsole.log(book.getAttribute(\"id\")); // 1\n```\n\nThe DOM API includes `documentElement`, `childNodes`, `parentNode`,\n`appendChild`, `removeChild`, `cloneNode`, `textContent`, attributes,\n`getElementsByTagName`, `getElementsByTagNameNS`, `querySelector`, and\n`querySelectorAll`.\n\n## String, file, URL, and stream inputs\n\n```ts\nimport { load, loadFile, parseStream, parseUrl } from \"@anhquoc96/fastxml\";\n\nconst fromText = await load({ text: xmlText });\nconst fromFile = await loadFile(\"./large.xml\");\nconst fromStream = await parseStream(response.body!);\nconst fromUrl = await parseUrl(\"https://example.com/data.xml\");\n```\n\n`parseStream` accepts async iterables and Web Streams. File access is provided\nthrough runtime adapters for Node.js and Deno.\n\n## Event parsing for large XML\n\nUse events when the application does not need a complete DOM tree:\n\n```ts\nimport { parseFileEvents } from \"@anhquoc96/fastxml\";\n\nfor await (const event of parseFileEvents(\"large.xml\", { preserveWhitespace: false })) {\n  if (event.type === \"startElement\" && event.name === \"record\") {\n    // Process records incrementally.\n  }\n}\n```\n\n## Parser options\n\n```ts\nconst document = parse(xmlText, {\n  preserveWhitespace: false,\n  strictNamespaces: true,\n  maxDepth: 256,\n  maxTokenLength: 16 * 1024 * 1024,\n  maxAttributes: 1024,\n  maxEntityExpansion: 8 * 1024 * 1024,\n  allowDoctype: false,\n});\n```\n\nExternal entities are never resolved. Configure explicit limits when processing\nuntrusted or tenant-controlled XML.\n\n## Development\n\n```bash\nnpm install\nnpm run build --workspace @anhquoc96/fastxml\nnpm run typecheck --workspace @anhquoc96/fastxml\n```\n\n## License\n\nMIT License. See the package `LICENSE` file.\n","readmeFilename":"README.md","_rev":"1-a4f14981120266a84f359a152578a94a"}