{"_id":"w3c-xmlserializer@6.0.0","bugs":{"url":"https://github.com/jsdom/w3c-xmlserializer/issues"},"dist":{"shasum":"27c0747e0091ada8cdb513c3645362e71fc50d82","tarball":"http://registry-npm.ywwl.com/w3c-xmlserializer/download/w3c-xmlserializer-6.0.0.tgz","fileCount":6,"integrity":"sha512-4Nsy8K5Tr6SPDH9jhKJOHf7ChDrc1zufZTVSF7x72hwuEXBqxqk9G6cK+K2NRUtB3iELRJqjXb4JPDMBjMTl2Q==","signatures":[{"sig":"MEUCIQDzqJpJs4OS0tqYNKTKtOb+1tyo5fld5HTGU5Pp+M7s1gIgf3uaUdxezPQgOI7TzmxVlcLprvF9n3Fng1lMEmtEB60=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDTO4LiXDxFp/QR9F9cwmqaN+Y7NlSXaFh8hJXaUGVcIQIhAL/OcDn2OhyQZQZ9XqslTMaODpDZBYS+/rnXy3ZgQAUE"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/w3c-xmlserializer@6.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":18139,"size":5340,"noattachment":false,"key":"/w3c-xmlserializer/-/w3c-xmlserializer-6.0.0.tgz"},"main":"lib/serialize.js","name":"w3c-xmlserializer","engines":{"node":"^22.22.2 || ^24.15.0 || >=26.0.0"},"gitHead":"265f1e1a192594708281809c8c7730b65acb36f3","license":"MIT","scripts":{"lint":"eslint","test":"node --test"},"version":"6.0.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1eda3276-e708-47ad-8963-a218f4cc691e"}},"homepage":"https://github.com/jsdom/w3c-xmlserializer#readme","keywords":["dom","w3c","xml","xmlserializer"],"repository":{"url":"git+https://github.com/jsdom/w3c-xmlserializer.git","type":"git"},"_npmVersion":"11.19.0","description":"A per-spec XML serializer implementation","directories":{},"maintainers":[{"name":"timothygu","email":"timothygu99@gmail.com"},{"name":"domenic","email":"d@domenic.me"},{"name":"sebmaster","email":"sebmaster16@gmail.com"},{"name":"zirro","email":"code@zirro.se"},{"name":"tmpvar","email":"tmpvar@gmail.com"},{"name":"joris-van-der-wel","email":"joris@jorisvanderwel.com"}],"_nodeVersion":"24.20.0","dependencies":{"xml-name-validator":"^5.0.0"},"_hasShrinkwrap":false,"devDependencies":{"jsdom":"^30.1.0","eslint":"^10.11.0","globals":"^17.12.0","@domenic/eslint-config":"^5.1.0","@stylistic/eslint-plugin":"^5.10.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/w3c-xmlserializer_6.0.0_1789980108809_0.344138148549725"},"readme":"# w3c-xmlserializer\n\nAn XML serializer that follows the [W3C specification](https://w3c.github.io/DOM-Parsing/).\n\nThis package can be used in Node.js, as long as you feed it a DOM node, e.g. one produced by [jsdom](https://github.com/jsdom/jsdom).\n\n## Basic usage\n\nAssume you have a DOM tree rooted at a node `node`. In Node.js, you could create this using [jsdom](https://github.com/jsdom/jsdom) as follows:\n\n```js\nconst { JSDOM } = require(\"jsdom\");\n\nconst { document } = new JSDOM().window;\nconst node = document.createElement(\"akomaNtoso\");\n```\n\nThen, you use this package as follows:\n\n\n```js\nconst serialize = require(\"w3c-xmlserializer\");\n\nconsole.log(serialize(node));\n// => '<akomantoso xmlns=\"http://www.w3.org/1999/xhtml\"></akomantoso>'\n```\n\n## `requireWellFormed` option\n\nBy default the input DOM tree is not required to be \"well-formed\"; any given input will serialize to some output string. You can instead require well-formedness via\n\n```js\nserialize(node, { requireWellFormed: true });\n```\n\nwhich will cause `Error`s to be thrown when non-well-formed constructs are encountered. [Per the spec](https://w3c.github.io/DOM-Parsing/#dfn-require-well-formed), this largely is about imposing constraints on the names of elements, attributes, etc.\n\nAs a point of reference, on the web platform:\n\n* The [`innerHTML` getter](https://w3c.github.io/DOM-Parsing/#dom-innerhtml-innerhtml) uses the require-well-formed mode, i.e. trying to get the `innerHTML` of non-well-formed subtrees will throw.\n* The [`xhr.send()` method](https://xhr.spec.whatwg.org/#the-send()-method) does not require well-formedness, i.e. sending non-well-formed `Document`s will serialize and send them anyway.\n","publish_time":1789980108922,"_cnpm_publish_time":1789980108922,"dist-tags":{"latest":"6.0.0"}}