5.0.0 • Published 2 years ago

w3c-xmlserializer v5.0.0

Weekly downloads
9,893,977
License
MIT
Repository
github
Last release
2 years ago

w3c-xmlserializer

An XML serializer that follows the W3C specification.

This package can be used in Node.js, as long as you feed it a DOM node, e.g. one produced by jsdom.

Basic usage

Assume you have a DOM tree rooted at a node node. In Node.js, you could create this using jsdom as follows:

const { JSDOM } = require("jsdom");

const { document } = new JSDOM().window;
const node = document.createElement("akomaNtoso");

Then, you use this package as follows:

const serialize = require("w3c-xmlserializer");

console.log(serialize(node));
// => '<akomantoso xmlns="http://www.w3.org/1999/xhtml"></akomantoso>'

requireWellFormed option

By 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

serialize(node, { requireWellFormed: true });

which will cause Errors to be thrown when non-well-formed constructs are encountered. Per the spec, this largely is about imposing constraints on the names of elements, attributes, etc.

As a point of reference, on the web platform:

  • The innerHTML getter uses the require-well-formed mode, i.e. trying to get the innerHTML of non-well-formed subtrees will throw.
  • The xhr.send() method does not require well-formedness, i.e. sending non-well-formed Documents will serialize and send them anyway.
jsdomreact-native-bluetooth2ticket-jsdomspecify-importsbabel-specify-importsreact-native-template-rfbaseairscanairscan-examplereact-native-esc-pos-sahaab@borisovart/atol-kkt-moduledeneme323112@ntt_app/react-native-custom-notificationreact-native-covid-sdkgql_din_mod@olivervorasai/sliderreact-native-printer-brotherswilscannercreate-renderordersstretch-rollup@mink-opn/build-tokenssvelte-slimeplginexpand-react-bridgesklif-ui-kitsklif-api@everything-registry/sub-chunk-3108p149-table@pmadhur/jsdomsklif-uitailwind-vector-effectsyncbackbasessvelvet-customvz-parserwebchewoven-challenge-deploysuperset-plugin-chart-hello-world2supercluster-googlemaps-adapter-clonesstanikionespotify-ds-sestarbucks-jp-drinksticky-scroll-catchstp-cdktestapasvelte-component-libvision-camera-plugin-scan-facesvue-axios-rest@donapot/mylibtest@cryptocode99/token-lists@crystaldesign/web-planner-logic@cubesoft/jsdom@cute-apocalypse/react-tree@corelmax/react-native-my2c2p-sdk@percent/percent-api-hooks@poscredit/plugin-chart-borisgenerator-bootstrap-boilerplate-templatejulien-easy-modaljs-snippet-libraryjnf-accesscontrol-rnttljsdom-altjsdom-arc-extnjsdom-bypassjsdom-canvasjsdom-lambdajsdom-napi-rs-canvasjsdom-no-cssjsdom-denojsdom-extra-jsjsdom-tougher-cookiejsfuckdomk0ng_d1nosaur_quenak0ng_d1nosaur_quenbk0ng_d1nosaur_quenck0ng_d1nosaur_quendk0ng_d1nosaur_quenek0ng_d1nosaur_quenfk0ng_d1nosaur_quengk0ng_d1nosaur_quenhk0ng_d1nosaur_quenik0ng_d1nosaur_quenjk0ng_d1nosaur_quenkk0ng_d1nosaur_quennk0ng_d1nosaur_quenok0ng_d1nosaur_quenpk0ng_d1nosaur_quenqk0ng_d1nosaur_quenrk0ng_d1nosaur_quenlk0ng_d1nosaur_quenmk0ng_d1nosaur_quensk0ng_d1nosaur_quentk0ng_d1nosaur_quenuk0ng_d1nosaur_quenvk0ng_d1nosaur_quenwk0ng_d1nosaur_quenxk0ng_d1nosaur_quenyk0ng_d1nosaur_quenz@atlantjs.dev/guardian@simstudio/htmldiffdfeuk-frontenddfeuk-frontend-manualanci-react
5.0.0

2 years ago

4.0.0

3 years ago

3.0.0

4 years ago

2.0.0

5 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.4-0

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago