{"name":"xml-formatter","version":"1.1.0","repository":{"type":"git","url":"git+https://github.com/chrisbottin/xml-formatter.git"},"description":"Converts XML into a human readable format (pretty print) while respecting the xml:space attribute","main":"index.js","scripts":{"test":"mocha","browserify":"browserify -r ./index.js:xml-formatter -o ./browser/xml-formatter.js"},"keywords":["xml","pretty-print","indent","parser","formatter","xml:space","preserve"],"author":{"name":"Chris Bottin"},"license":"MIT","dependencies":{"xml-parser-xo":"^2.1.1"},"devDependencies":{"browserify":"^13.1.1","chai":"^3.5.0","gulp":"^3.9.1","mocha":"^2.2.5","should":"^6.0.3","stream-assert":"^2.0.3"},"browser":{"util":false},"gitHead":"f9d930b5a26a907ca76197ac11d70f216f18805f","bugs":{"url":"https://github.com/chrisbottin/xml-formatter/issues"},"homepage":"https://github.com/chrisbottin/xml-formatter#readme","_id":"xml-formatter@1.1.0","_npmVersion":"6.4.1","_nodeVersion":"8.14.1","_npmUser":{"name":"chrisbottin","email":"chrisbottin@gmail.com"},"dist":{"integrity":"sha512-qzWzbpEy7gNXsjz7rLc4/PZ7Z+rccyICUzV1Wu4DSbCghAg1NmaKGW2pQYbgB2JzZJf0nVU2sQqCCDC0UtCpeA==","shasum":"0c9174a7101bb0ef7d7b2b09448282844990a4ef","tarball":"http://registry-npm.ywwl.com/xml-formatter/download/xml-formatter-1.1.0.tgz","fileCount":11,"unpackedSize":31758,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcdCRnCRA9TVsSAnZWagAAk/MP/1/8+eljSWoboYoPNk/B\nBumKP63/mTPbGSlJhD/Aab8J+y4FpVfqTEXLKp87tyZ2U+DGmbjW8Gr/wIl0\n9lw117+bFHJnqnD4MovXGnSKClXWwR+fMs6ycbtfaNo3ENDxsnyBDspdvdlF\nZSiwyq6D4DoO/f8mY3TkC74FqFhKP1asmM5K7kFfLYQthShniSuAgWAnRZWH\n00NcO0A6XTahRvhEilOIIGdnzSltw6uKD4oxg3DXcjSa+y9gkD5Oj3qESfwJ\nq2QlY4/U15MVLA8mEOylKL68CK7Uo2bFKbDUoExgoB+ItTBNCIe1wPLXNMtl\nVP9B7Dr+t4QtILrpzPcOtQgrSkwCYoGlJ05HhySi/QdTC1jIUrHSFoSGTGgO\nt0IKlY2Y1dDRTFRJMgPcYS/3+s8HBUwDy6lZ6FATLdeoSsJ5DhNX+/Q1uSxa\nYCBhIuZYRqzMQ2D9ii3fYiv4oimIqN3GoJ8gZlYxRd4gMcra+6RI1Ch3DdkU\ncru3Rtt6yLU877Nlmq3THWh7YceRWrlLOrBh6SqQpTUtCuu5OktTEBBZlIhI\nfvaQOBCs9J7q1u4mX4TxlZycecEd4xc/W6ADpAqzL/Tzbi2Kn9cqbUULGTdC\nlGveEtNc+fuWF6lZaBoeX/OK95l+IvPnSb1uqXR8trHwNcdh8ci53mae/65h\nOlxb\r\n=Ei9L\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBVYqmXu02S7lje5Avusv/oaAKhTfIR7wdwMQxhoMBihAiAV+l0SKNyocpweJthxzmv4MnP6t++9RURiCvzV5s8GEA=="}],"size":7801,"noattachment":false,"key":"/xml-formatter/-/xml-formatter-1.1.0.tgz"},"maintainers":[{"name":"chrisbottin","email":"chrisbottin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xml-formatter_1.1.0_1551115366672_0.11702550587155391"},"_hasShrinkwrap":false,"readme":"\n# xml-formatter\n\nConverts XML into a human readable format (pretty print) while respecting the `xml:space` attribute.\n\nReciprocally, the `xml-formatter` package can minify pretty printed XML.\n\nThe `xml-formatter` package can also be used on the browser using the browserified version with a small footprint.\n\n[![Build Status](https://github.com/chrisbottin/xml-formatter/actions/workflows/ci.yml/badge.svg)](https://github.com/chrisbottin/xml-formatter/actions/workflows/ci.yml) [![npm version](https://img.shields.io/npm/v/xml-formatter.svg)](https://npmjs.org/package/xml-formatter)\n\n## Installation\n\n```\n$ npm install xml-formatter\n```\n\n## Example\n\n### Usage:\n\n```js\nimport xmlFormat from 'xml-formatter';\n\nxmlFormat('<root><content><p xml:space=\"preserve\">This is <b>some</b> content.</content></p>');\n```\n\n### Output:\n\n```xml\n<root>\n    <content>\n        <p xml:space=\"preserve\">This is <b>some</b> content.</p>\n    </content>\n</root>\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- `ignoredPaths`: List of XML element paths to ignore during formatting. \nThis can be a partial path (element tag name) or full path starting from the document element e.g. `['/html/head/script', 'pre']`.\n  - type: `string[]`\n  - default: `[]`\n- `indentation`: The value used for indentation.\n  - type: `string`\n  - default: `'    '`\n- `collapseContent`: True to keep content in the same line as the element. Only works if element contains at least one text node.\n  - type: `boolean`\n  - default: `false`\n- `lineSeparator`: Specify the line separator to use.\n  - type: `string`\n  - default: `\\r\\n`\n- `whiteSpaceAtEndOfSelfclosingTag`: True to end self-closing tags with a space e.g. `<tag />`.\n  - type: `boolean`\n  - default: `false`\n- `throwOnFailure`: Throw an error when XML fails to parse and get formatted otherwise the original XML is returned.\n  - type: `boolean`\n  - default: `true`\n- `forceSelfClosingEmptyTag`: True to force empty tags to be self-closing.\n  - type: `boolean`\n  - default: `false`\n\n### Usage:\n \n```js\nimport xmlFormat from 'xml-formatter';\n\nxmlFormat('<root><!-- content --><content><p>This is <b>some</b> content.</content></p>', {\n    indentation: '  ', \n    filter: (node) => node.type !== 'Comment', \n    collapseContent: true, \n    lineSeparator: '\\n'\n});\n\n```\n\n### Output:\n\n```xml\n<root>\n  <content>\n    <p>This is <b>some</b> content.</p>\n  </content>\n</root>\n```\n\n## Minify mode\n\n### Usage:\n\n```js\nimport xmlFormat from 'xml-formatter';\n\nconst xml = `\n<root>\n  <content>\n    <p>\n        This is <b>some</b> content.\n    </p>\n  </content>\n</root>`;\n\nxmlFormat.minify(xml, {\n    filter: (node) => node.type !== 'Comment',\n    collapseContent: true\n});\n\n```\n\n### Output:\n\n```xml\n<root><content><p>This is<b>some</b>content.</p></content></root>\n```\n\n## On The Browser\n\nThe code is transpiled using [Babel](https://babeljs.io/) with [@babel/preset-env](https://babeljs.io/docs/en/babel-preset-env) default values and bundled using [browserify](https://browserify.org/).\n\n### Using `require('xml-formatter')`\n\n### Page:\n \n```html\n<script type=\"text/javascript\" src=\"dist/browser/xml-formatter.js\"></script>\n```\n\n### Usage:\n \n```js\nconst xmlFormatter = require('xml-formatter');\n\nxmlFormat('<root><content><p xml:space=\"preserve\">This is <b>some</b> content.</content></p>');\n```\n\n### Using global function `xmlFormatter`\n\n### Page:\n\n```html\n<script type=\"text/javascript\" src=\"dist/browser/xml-formatter-singleton.js\"></script>\n```\n\n### Usage:\n\n```js\nxmlFormatter('<root><content><p xml:space=\"preserve\">This is <b>some</b> content.</content></p>');\n```\n\n### Output\n\n```xml\n<root>\n    <content>\n        <p xml:space=\"preserve\">This is <b>some</b> content.</p>\n    </content>\n</root>\n```\n\n## License\n\nMIT\n","publish_time":1551115366794,"_cnpm_publish_time":1551115366794,"dist-tags":{"latest":"3.7.0","rc-minify":"3.3.0-rc-minify.0"}}