{"_id":"pixl-xml","_rev":"680412","name":"pixl-xml","description":"A simple module for parsing and composing XML.","dist-tags":{"latest":"1.0.13"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"time":{"modified":"2021-08-30T02:34:46.000Z","created":"2015-05-29T06:29:22.323Z","1.0.13":"2017-07-23T04:55:05.282Z","1.0.12":"2017-06-27T04:02:55.985Z","1.0.11":"2017-06-26T05:56:25.931Z","1.0.10":"2016-10-25T05:38:08.647Z","1.0.9":"2016-09-18T20:33:28.273Z","1.0.8":"2016-09-18T20:23:24.436Z","1.0.7":"2016-06-10T18:09:51.124Z","1.0.6":"2016-02-21T04:33:38.531Z","1.0.5":"2016-02-21T04:15:31.342Z","1.0.4":"2015-08-08T01:02:29.840Z","1.0.3":"2015-06-24T03:56:03.683Z","1.0.2":"2015-05-29T15:42:25.707Z","1.0.1":"2015-05-29T15:09:56.871Z","1.0.0":"2015-05-29T06:29:22.323Z"},"users":{"cliff":true,"stpettersens":true,"kamil234":true,"aahz":true,"rdominy":true,"binarymax":true,"arttse":true,"ardingchen":true,"boczeratul":true},"author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/jhuckaby/pixl-xml.git"},"versions":{"1.0.13":{"name":"pixl-xml","version":"1.0.13","description":"A simple module for parsing and composing XML.","author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"homepage":"https://github.com/jhuckaby/pixl-xml","license":"MIT","main":"xml.js","repository":{"type":"git","url":"git+https://github.com/jhuckaby/pixl-xml.git"},"bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"keywords":["xml"],"dependencies":{},"devDependencies":{},"gitHead":"67a470dad7319c88b6ab086562d0ba48a866d722","_id":"pixl-xml@1.0.13","scripts":{},"_shasum":"5ba71408bdf37994c239dd01251c10c53c0587e3","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"jhuckaby","email":"jhuckaby@gmail.com"},"dist":{"shasum":"5ba71408bdf37994c239dd01251c10c53c0587e3","size":10557,"noattachment":false,"key":"/pixl-xml/-/pixl-xml-1.0.13.tgz","tarball":"http://registry.cnpm.dingdandao.com/pixl-xml/download/pixl-xml-1.0.13.tgz"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pixl-xml-1.0.13.tgz_1500785705201_0.5629505531396717"},"directories":{},"publish_time":1500785705282,"_hasShrinkwrap":false,"_cnpm_publish_time":1500785705282},"1.0.12":{"name":"pixl-xml","version":"1.0.12","description":"A simple module for parsing and composing XML.","author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"homepage":"https://github.com/jhuckaby/pixl-xml","license":"MIT","main":"xml.js","repository":{"type":"git","url":"git+https://github.com/jhuckaby/pixl-xml.git"},"bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"keywords":["xml"],"dependencies":{},"devDependencies":{},"gitHead":"f161a33bfb7e3e19905cf9e0bed4f9c482264c6a","_id":"pixl-xml@1.0.12","scripts":{},"_shasum":"671a0c8fbcf497f40c722367671d5eb4f0b2afed","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"jhuckaby","email":"jhuckaby@gmail.com"},"dist":{"shasum":"671a0c8fbcf497f40c722367671d5eb4f0b2afed","size":10364,"noattachment":false,"key":"/pixl-xml/-/pixl-xml-1.0.12.tgz","tarball":"http://registry.cnpm.dingdandao.com/pixl-xml/download/pixl-xml-1.0.12.tgz"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pixl-xml-1.0.12.tgz_1498536175825_0.5206052490975708"},"directories":{},"publish_time":1498536175985,"_hasShrinkwrap":false,"_cnpm_publish_time":1498536175985},"1.0.11":{"name":"pixl-xml","version":"1.0.11","description":"A simple module for parsing and composing XML.","author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"homepage":"https://github.com/jhuckaby/pixl-xml","license":"MIT","main":"xml.js","repository":{"type":"git","url":"git+https://github.com/jhuckaby/pixl-xml.git"},"bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"keywords":["xml"],"dependencies":{},"devDependencies":{},"gitHead":"e7c16c2a7cb15e4f6d343b13d44ee3e0bdfceb52","_id":"pixl-xml@1.0.11","scripts":{},"_shasum":"c638e11aa2c9653d88d4499614a3eb5e09ce8cec","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"jhuckaby","email":"jhuckaby@gmail.com"},"dist":{"shasum":"c638e11aa2c9653d88d4499614a3eb5e09ce8cec","size":10364,"noattachment":false,"key":"/pixl-xml/-/pixl-xml-1.0.11.tgz","tarball":"http://registry.cnpm.dingdandao.com/pixl-xml/download/pixl-xml-1.0.11.tgz"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pixl-xml-1.0.11.tgz_1498456585750_0.1113600772805512"},"directories":{},"publish_time":1498456585931,"_hasShrinkwrap":false,"_cnpm_publish_time":1498456585931},"1.0.10":{"name":"pixl-xml","version":"1.0.10","description":"A simple module for parsing and composing XML.","author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"homepage":"https://github.com/jhuckaby/pixl-xml","license":"MIT","main":"xml.js","repository":{"type":"git","url":"git+https://github.com/jhuckaby/pixl-xml.git"},"bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"keywords":["xml"],"dependencies":{},"devDependencies":{},"gitHead":"2f6b7612813836bcdde22eac255e4c914bd1dd8e","_id":"pixl-xml@1.0.10","scripts":{},"_shasum":"aedc1a47d8b16b9a71d9dad9f51332163f7a70ee","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"jhuckaby","email":"jhuckaby+npm@gmail.com"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"dist":{"shasum":"aedc1a47d8b16b9a71d9dad9f51332163f7a70ee","size":9838,"noattachment":false,"key":"/pixl-xml/-/pixl-xml-1.0.10.tgz","tarball":"http://registry.cnpm.dingdandao.com/pixl-xml/download/pixl-xml-1.0.10.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pixl-xml-1.0.10.tgz_1477373888386_0.9337083559948951"},"directories":{},"publish_time":1477373888647,"_cnpm_publish_time":1477373888647,"_hasShrinkwrap":false},"1.0.9":{"name":"pixl-xml","version":"1.0.9","description":"A simple module for parsing and composing XML.","author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"homepage":"https://github.com/jhuckaby/pixl-xml","license":"MIT","main":"xml.js","repository":{"type":"git","url":"git+https://github.com/jhuckaby/pixl-xml.git"},"bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"keywords":["xml"],"dependencies":{},"devDependencies":{},"gitHead":"38912a40dd2899d68737d0d1e55f757a076358e9","_id":"pixl-xml@1.0.9","scripts":{},"_shasum":"ffdbd1a61108fb35710144cd95e1c63651dcc88a","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"jhuckaby","email":"jhuckaby+npm@gmail.com"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"dist":{"shasum":"ffdbd1a61108fb35710144cd95e1c63651dcc88a","size":9479,"noattachment":false,"key":"/pixl-xml/-/pixl-xml-1.0.9.tgz","tarball":"http://registry.cnpm.dingdandao.com/pixl-xml/download/pixl-xml-1.0.9.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pixl-xml-1.0.9.tgz_1474230808012_0.4758675384800881"},"directories":{},"publish_time":1474230808273,"_cnpm_publish_time":1474230808273,"_hasShrinkwrap":false},"1.0.8":{"name":"pixl-xml","version":"1.0.8","description":"A simple module for parsing and composing XML.","author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"homepage":"https://github.com/jhuckaby/pixl-xml","license":"MIT","main":"xml.js","repository":{"type":"git","url":"git+https://github.com/jhuckaby/pixl-xml.git"},"bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"keywords":["xml"],"dependencies":{},"devDependencies":{},"gitHead":"42ec1db0260ba65c20de1ce4f82b213fa37da33a","_id":"pixl-xml@1.0.8","scripts":{},"_shasum":"c7925887499fc9776fa699454ae51eb82ad7e89b","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"jhuckaby","email":"jhuckaby+npm@gmail.com"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"dist":{"shasum":"c7925887499fc9776fa699454ae51eb82ad7e89b","size":9393,"noattachment":false,"key":"/pixl-xml/-/pixl-xml-1.0.8.tgz","tarball":"http://registry.cnpm.dingdandao.com/pixl-xml/download/pixl-xml-1.0.8.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pixl-xml-1.0.8.tgz_1474230204144_0.6295254167634994"},"directories":{},"publish_time":1474230204436,"_cnpm_publish_time":1474230204436,"_hasShrinkwrap":false},"1.0.7":{"name":"pixl-xml","version":"1.0.7","description":"A simple module for parsing and composing XML.","author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"homepage":"https://github.com/jhuckaby/pixl-xml","license":"MIT","main":"xml.js","repository":{"type":"git","url":"git+https://github.com/jhuckaby/pixl-xml.git"},"bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"keywords":["xml"],"dependencies":{},"devDependencies":{},"gitHead":"bb8e2ac4192c95ec51b87bd7715b1851dbb285ba","_id":"pixl-xml@1.0.7","scripts":{},"_shasum":"f8a6d4ed405ddc34b3d4e156038e92ab36140d41","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"jhuckaby","email":"jhuckaby+npm@gmail.com"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"dist":{"shasum":"f8a6d4ed405ddc34b3d4e156038e92ab36140d41","size":8713,"noattachment":false,"key":"/pixl-xml/-/pixl-xml-1.0.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/pixl-xml/download/pixl-xml-1.0.7.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/pixl-xml-1.0.7.tgz_1465582188260_0.5468346956185997"},"directories":{},"publish_time":1465582191124,"_cnpm_publish_time":1465582191124,"_hasShrinkwrap":false},"1.0.6":{"name":"pixl-xml","version":"1.0.6","description":"A simple module for parsing and composing XML.","author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"homepage":"https://github.com/jhuckaby/pixl-xml","license":"MIT","main":"xml.js","repository":{"type":"git","url":"git+https://github.com/jhuckaby/pixl-xml.git"},"bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"keywords":["xml"],"dependencies":{},"devDependencies":{},"gitHead":"334ccbdd629bbe507a4e9bc2373af2c8ee7cc356","_id":"pixl-xml@1.0.6","scripts":{},"_shasum":"b4b1c274b6f3d0a68a73e7ba34d034ea31dc686f","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"jhuckaby","email":"jhuckaby+npm@gmail.com"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"dist":{"shasum":"b4b1c274b6f3d0a68a73e7ba34d034ea31dc686f","size":8539,"noattachment":false,"key":"/pixl-xml/-/pixl-xml-1.0.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/pixl-xml/download/pixl-xml-1.0.6.tgz"},"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/pixl-xml-1.0.6.tgz_1456029214205_0.8292235527187586"},"directories":{},"publish_time":1456029218531,"_cnpm_publish_time":1456029218531,"_hasShrinkwrap":false},"1.0.5":{"name":"pixl-xml","version":"1.0.5","description":"A simple module for parsing and composing XML.","author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"homepage":"https://github.com/jhuckaby/pixl-xml","license":"MIT","main":"xml.js","repository":{"type":"git","url":"git+https://github.com/jhuckaby/pixl-xml.git"},"bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"keywords":["xml"],"dependencies":{},"devDependencies":{},"gitHead":"44c0b50e2a1e1296ff92f6b26368e8be62c8ace5","_id":"pixl-xml@1.0.5","scripts":{},"_shasum":"3a84f0eca3752ecfd8f8cfcbc6ed5392ea5cf559","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"jhuckaby","email":"jhuckaby+npm@gmail.com"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"dist":{"shasum":"3a84f0eca3752ecfd8f8cfcbc6ed5392ea5cf559","size":8532,"noattachment":false,"key":"/pixl-xml/-/pixl-xml-1.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/pixl-xml/download/pixl-xml-1.0.5.tgz"},"_npmOperationalInternal":{"host":"packages-9-west.internal.npmjs.com","tmp":"tmp/pixl-xml-1.0.5.tgz_1456028128038_0.29940573405474424"},"directories":{},"publish_time":1456028131342,"_cnpm_publish_time":1456028131342,"_hasShrinkwrap":false},"1.0.4":{"name":"pixl-xml","version":"1.0.4","description":"A simple module for parsing and composing XML.","author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"homepage":"https://github.com/jhuckaby/pixl-xml","license":"MIT","main":"xml.js","repository":{"type":"git","url":"git+https://github.com/jhuckaby/pixl-xml.git"},"bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"keywords":["xml"],"dependencies":{},"devDependencies":{},"gitHead":"86bb4a98d8ee769228822ef9f614f5e1f84a0fdf","_id":"pixl-xml@1.0.4","scripts":{},"_shasum":"936080616c0b77eb8310b58beba851e733d34160","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"jhuckaby","email":"jhuckaby+npm@gmail.com"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"dist":{"shasum":"936080616c0b77eb8310b58beba851e733d34160","size":8506,"noattachment":false,"key":"/pixl-xml/-/pixl-xml-1.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/pixl-xml/download/pixl-xml-1.0.4.tgz"},"directories":{},"publish_time":1438995749840,"_cnpm_publish_time":1438995749840,"_hasShrinkwrap":false},"1.0.3":{"name":"pixl-xml","version":"1.0.3","description":"A simple module for parsing and composing XML.","author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"homepage":"https://github.com/jhuckaby/pixl-xml","license":"MIT","main":"xml.js","repository":{"type":"git","url":"git+https://github.com/jhuckaby/pixl-xml.git"},"bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"keywords":["xml"],"dependencies":{},"devDependencies":{},"gitHead":"fe78843eb1bbd14822b91f7996f7f9a4d5d2f50f","_id":"pixl-xml@1.0.3","scripts":{},"_shasum":"7230a5c7758bc8974004cfd30816387016390681","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"jhuckaby","email":"jhuckaby+npm@gmail.com"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"dist":{"shasum":"7230a5c7758bc8974004cfd30816387016390681","size":8450,"noattachment":false,"key":"/pixl-xml/-/pixl-xml-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/pixl-xml/download/pixl-xml-1.0.3.tgz"},"directories":{},"publish_time":1435118163683,"_cnpm_publish_time":1435118163683,"_hasShrinkwrap":false},"1.0.2":{"name":"pixl-xml","version":"1.0.2","description":"A simple module for parsing and composing XML.","author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"homepage":"https://github.com/jhuckaby/pixl-xml","license":"MIT","main":"xml.js","repository":{"type":"git","url":"https://github.com/jhuckaby/pixl-xml"},"bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"keywords":["xml"],"dependencies":{},"devDependencies":{},"gitHead":"7e443bd122cf44839839cc369fdef9bd05528100","_id":"pixl-xml@1.0.2","scripts":{},"_shasum":"397ddaed4a387e7f7df85380ef48bcb68f38e14e","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"jhuckaby","email":"jhuckaby+npm@gmail.com"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"dist":{"shasum":"397ddaed4a387e7f7df85380ef48bcb68f38e14e","size":8437,"noattachment":false,"key":"/pixl-xml/-/pixl-xml-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/pixl-xml/download/pixl-xml-1.0.2.tgz"},"directories":{},"publish_time":1432914145707,"_cnpm_publish_time":1432914145707,"_hasShrinkwrap":false},"1.0.1":{"name":"pixl-xml","version":"1.0.1","description":"A simple module for parsing and composing XML.","author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"homepage":"https://github.com/jhuckaby/pixl-xml","license":"MIT","main":"xml.js","repository":{"type":"git","url":"https://github.com/jhuckaby/pixl-xml"},"bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"keywords":["xml"],"dependencies":{},"devDependencies":{},"gitHead":"c28626e289b3baba9d75cf58333c6438475c4574","_id":"pixl-xml@1.0.1","scripts":{},"_shasum":"a86817112bcfd3764fb9963ec41eec3b3113f25e","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"jhuckaby","email":"jhuckaby+npm@gmail.com"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"dist":{"shasum":"a86817112bcfd3764fb9963ec41eec3b3113f25e","size":8410,"noattachment":false,"key":"/pixl-xml/-/pixl-xml-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/pixl-xml/download/pixl-xml-1.0.1.tgz"},"directories":{},"publish_time":1432912196871,"_cnpm_publish_time":1432912196871,"_hasShrinkwrap":false},"1.0.0":{"name":"pixl-xml","version":"1.0.0","description":"A simple module for parsing and composing XML.","author":{"name":"Joseph Huckaby","email":"jhuckaby@gmail.com"},"homepage":"https://github.com/jhuckaby/pixl-xml","license":"MIT","main":"xml.js","repository":{"type":"git","url":"https://github.com/jhuckaby/pixl-xml"},"bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"keywords":["xml"],"dependencies":{},"devDependencies":{},"gitHead":"ac785e52a8581b72c1f0076feffe4b2af8416749","_id":"pixl-xml@1.0.0","scripts":{},"_shasum":"6395178eae91808c6b9b0089c65b94b6d73730ec","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"jhuckaby","email":"jhuckaby+npm@gmail.com"},"maintainers":[{"name":"jhuckaby","email":"jhuckaby@gmail.com"}],"dist":{"shasum":"6395178eae91808c6b9b0089c65b94b6d73730ec","size":8361,"noattachment":false,"key":"/pixl-xml/-/pixl-xml-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/pixl-xml/download/pixl-xml-1.0.0.tgz"},"directories":{},"publish_time":1432880962323,"_cnpm_publish_time":1432880962323,"_hasShrinkwrap":false}},"readme":"# Overview\n\nThis module provides a lightweight, fast, easy-to-use XML parser which generates a simplified object / array tree.  This can be very useful for parsing XML configuration files and the like.  It is 100% pure JavaScript and has no dependencies.\n\n* Pure JavaScript, no dependencies\n* Very fast parser (About 6X faster than [xml2js](https://www.npmjs.com/package/xml2js))\n* Low memory usage (About 60% less than [xml2js](https://www.npmjs.com/package/xml2js))\n* Fully synchronous operation, no callbacks\n* Can parse XML strings, Buffers or load from files\n* Can preserve or flatten attributes\n* Can convert all keys to lower-case\n* Can serialize objects back to pretty-printed or compact XML\n\n# Usage\n\nUse [npm](https://www.npmjs.com/) to install the module:\n\n```\nnpm install pixl-xml\n```\n\nThen use `require()` to load it in your code:\n\n```javascript\nvar XML = require('pixl-xml');\n```\n\n# Simplified API\n\nThe simplified API provides basic `XML.parse()` and `XML.stringify()` standalone functions for parsing and serializing XML.  Also see the [Object-Oriented API](#object-oriented-api) below, for more control over your XML.\n\nParse some XML by passing a string to `XML.parse()`:\n\n```javascript\nvar xml_string = '<?xml version=\"1.0\"?><Document>' + \n\t'<Simple>Hello</Simple>' + \n\t'<Node Key=\"Value\">Complex</Node>' + \n\t'</Document>';\n\nvar doc = XML.parse( xml_string );\nconsole.log( doc );\n```\n\nThat would produce an object like the following:\n\n```javascript\n{\n  \"Simple\": \"Hello\",\n  \"Node\": {\n    \"Key\": \"Value\",\n    \"_Data\": \"Complex\"\n  }\n}\n```\n\nNote that the outermost element is omitted from the object (`<Document>` in this case).  Also, for complex elements that have both attributes (or sub-elements) *and* plain data, the plain data goes into a `_Data` property.  Multiple elements with the same name at the same level are converted to an array.\n\nYou can also pass in a path to an XML file on disk, and it'll be loaded, then parsed:\n\n```javascript\nvar config = XML.parse( 'conf/config.xml' );\nconsole.log( config );\n```\n\nParsing errors will be thrown as exceptions, so you'd better wrap `parse()` calls in a try/catch for safety:\n\n```javascript\nvar doc = null;\ntry {\n\tdoc = XML.parse( 'my_xml_file.xml' );\n}\ncatch (err) {\n\tconsole.log(\"XML Parser Error: \" + err);\n}\nconsole.log( doc );\n```\n\n## Options\n\nYou can pass an optional 2nd argument to `parse()`, which can be an object containing any of the following properties:\n\n### preserveAttributes\n\nThis optional property, when set to `true`, will cause all XML attributes to be kept separate in their own sub-object called `_Attribs` for each element.  For example, consider this snippet:\n\n```javascript\nvar xml_string = '<?xml version=\"1.0\"?><Document>' + \n\t'<Simple>Hello</Simple>' + \n\t'<Node Key=\"Value\">Complex</Node>' + \n\t'</Document>';\n\nvar doc = XML.parse( xml_string, { preserveAttributes: true } );\nconsole.log( doc );\n```\n\nWith the `preserveAttributes` flag set to true, this would produce the following object:\n\n```javascript\n{\n  \"Simple\": \"Hello\",\n  \"Node\": {\n    \"_Attribs\": {\n      \"Key\": \"Value\"\n    },\n    \"_Data\": \"Content\"\n  }\n}\n```\n\nNotice the `Key` attribute of the `<Node>` element is now kept in an `_Attribs` sub-object.  The only real purpose for this is if you expect to write the XML back out again (see [Composing XML](#composing-xml) below).\n\n### lowerCase\n\nThis optional property, when set to `true`, will cause all keys to be lower-cased as the XML is parsed.  This affects both elements and attributes.  Example:\n\n```javascript\nvar xml_string = '<?xml version=\"1.0\"?><Document>' + \n\t'<Simple>Hello</Simple>' + \n\t'<Node Key=\"Value\">Complex</Node>' + \n\t'</Document>';\n\nvar doc = XML.parse( xml_string, { lowerCase: true } );\nconsole.log( doc );\n```\n\nWith the `lowerCase` flag set to true, this would produce the following object:\n\n```javascript\n{\n  \"simple\": \"Hello\",\n  \"node\": {\n    \"key\": \"Value\",\n    \"_data\": \"Content\"\n  }\n}\n```\n\nNote that the values themselves are not touched -- only the keys are lower-cased.\n\n### preserveDocumentNode\n\nIf you want the outermost root node (also called the document node) preserved when parsing, set the `preserveDocumentNode` property to true when parsing.  Example:\n\n```js\nvar xml_string = '<?xml version=\"1.0\"?><Document>' + \n\t'<Simple>Hello</Simple>' + \n\t'<Node Key=\"Value\">Complex</Node>' + \n\t'</Document>';\n\nvar doc = XML.parse( xml_string, { preserveDocumentNode: true } );\nconsole.log( doc );\n```\n\nWith the `preserveDocumentNode` flag set to true, this would produce the following object:\n\n```js\n{\n\t\"Document\": {\n\t\t\"Simple\": \"Hello\",\n\t\t\"Node\": {\n\t\t\t\"Key\": \"Value\",\n\t\t\t\"_Data\": \"Complex\"\n\t\t}\n\t}\n}\n```\n\n### preserveWhitespace\n\nIf you want to preserve whitespace before and after text inside elements, set the `preserveWhitespace` flag to a true value.  Note that this has no effect on attributes (whitespace is always preserved there), nor does it effect whitespace *between* complex elements.  Example:\n\n```js\nvar xml_string = '<?xml version=\"1.0\"?> <Document> ' + \n\t' <Simple>  Hello  </Simple> ' + \n\t' <Node Key=\"  Value  \">  Complex  </Node> ' + \n\t' </Document> ';\n\nvar doc = XML.parse( xml_string, { preserveWhitespace: true } );\nconsole.log( doc );\n```\n\nWith the `preserveWhitespace` flag set to true, this would produce the following object:\n\n```js\n{\n\t\"Simple\": \"  Hello  \",\n\t\"Node\": {\n\t\t\"Key\": \"  Value  \",\n\t\t\"_Data\": \"  Complex  \"\n\t}\n}\n```\n\nNotice that the whitespace before/after all the opening and closing tags has no effect on the parsed object.  It only has effect *inside* elements that also contain a text value.\n\n### forceArrays\n\nBy default single elements are not represented as arrays, until another element with the same appears at the same level in the XML tree.  However, if you want to force every element into an array all the time, even when there is only a single element with a given name, set the `forceArrays` property to true.  Example:\n\n```js\nvar xml_string = '<?xml version=\"1.0\"?><Document>' + \n\t'<Simple>Hello</Simple>' + \n\t'<Node Key=\"Value\">Complex</Node>' + \n\t'</Document>';\n\nvar doc = XML.parse( xml_string, { forceArrays: true } );\nconsole.log( doc );\n```\n\nWith the `forceArrays` flag set to true, this would produce the following object:\n\n```js\n{\n\t\"Simple\": [\n\t\t\"Hello\"\n\t],\n\t\"Node\": [\n\t\t{\n\t\t\t\"Key\": \"Value\",\n\t\t\t\"_Data\": \"Complex\"\n\t\t}\n\t]\n}\n```\n\nPlease note that this feature applies only to elements, not attributes.\n\n## Composing XML\n\nTo compose XML back to a string, call `XML.stringify()` and pass in your pre-parsed XML object, and an outer wrapper element name.  It helps to parse using the [preserveAttributes](#preserveattributes) option for this, as it will honor the `_Attribs` sub-objects and convert them back into real XML attributes.  Example:\n\n```javascript\nvar xml_string = XML.stringify( doc, 'Document' );\nconsole.log( xml_string );\n```\n\nThis would produce something like:\n\n```xml\n<?xml version=\"1.0\"?>\n<Document>\n\t<Node Key=\"Value\">Content</Node>\n\t<Simple>Hello</Simple>\n</Document>\n```\n\nNote that elements and attributes may lose their original ordering, as hashes have an undefined key order.  However, to keep things consistent, they are both alphabetically sorted when serialized.  See [Preserve Sort Order](#preserve-sort-order) below for a possible workaround.\n\nIf you are composing an XML document which has the document root node preserved (see [preserveDocumentNode](#preserveDocumentNode) above), simply omit the name parameter, and only pass in the object.  Example:\n\n```js\nvar xml_string = XML.stringify( doc );\n```\n\n### Compact XML\n\nTo produce compact XML output (i.e. without indentation nor EOLs) you simply have to call `stringify()` with three additional arguments.  Pass in `0` indicating a zero indent level, and then two empty strings, one representing the indentation character (defaults to `\\t`) and finally the EOL character (defaults to `\\n`).  Example:\n\n```javascript\nvar xml_string = XML.stringify( doc, 'Document', 0, \"\", \"\" );\nconsole.log( xml_string );\n```\n\nThis would produce something like:\n\n```xml\n<?xml version=\"1.0\"?><Document><Node Key=\"Value\">Content</Node><Simple>Hello</Simple></Document>\n```\n\nIf you are composing an XML document which has the document root node preserved (see [preserveDocumentNode](#preserveDocumentNode) above), simply pass in an empty string for the name parameter.  Example:\n\n```js\nvar xml_string = XML.stringify( doc, \"\", 0, \"\", \"\" );\n```\n\n### Preserve Sort Order\n\nMost modern JavaScript engines including Node.js seem to magically preserve hash key order, although this goes against the ECMAScript specification.  If you want to take your chances and skip the alphabetic sort, and instead rely on natural key order, pass `false` as the 6th parameter when composing:\n\n```js\nvar xml_string = XML.stringify( doc, 'Document', 0, \"\\t\", \"\\n\", false );\n```\n\nThis will render elements and attributes in whatever order they come out of their hashes, which is up to your JavaScript runtime engine.\n\n# Object-Oriented API\n\nIn addition to the [Simplified API](#simplified-api), an object-oriented API is also available.  Using this, you instantiate an `XML.Parser` class instance, and use that to parse, manipulate and serialize XML.  The constructor accepts up to two arguments, the raw XML string, and an optional object with configuration options.\n\nAfter constructing the `XML.Parser` object, and no error was thrown, call `getTree()` to get a reference to the simplified XML structure in memory, manipulate it if you want, then call `compose()` to serialize the object tree back into XML.\n\nThe main reason for using this API is that it preserves any PI ([Processing Instruction](https://en.wikipedia.org/wiki/Processing_Instruction)) and DTD ([Document Type Definition](https://en.wikipedia.org/wiki/Document_type_definition)) elements in the source XML file, and they will be serialized into the output.  Example:\n\n```js\nvar xml_string = '<?xml version=\"1.0\" encoding=\"UTF-8\"?><Document>' + \n\t'<Simple>Hello</Simple>' + \n\t'<Node Key=\"Value\">Complex</Node>' + \n\t'</Document>';\n\nvar parser = null;\ntry {\n\tparser = new XML.Parser( xml_string, { preserveAttributes: true } );\n}\ncatch (err) {\n\tthrow err;\n}\n\nvar doc = parser.getTree();\ndoc.Simple = \"Hello, I changed this.\";\n\nconsole.log( parser.compose() );\n```\n\nThis would produce the following output:\n\n```xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Document>\n\t<Node Key=\"Value\">Complex</Node>\n\t<Simple>Hello, I changed this.</Simple>\n</Document>\n```\n\nNotice that the PI element with its `encoding` attribute was preserved and serialized.\n\nTo manipulate the PI nodes, access the `piNodeList` property on your parser object.  It is an array of strings, each one representing one raw PI node sans the surrounding angle brackets, e.g. `?xml version=\"1.0\"?`.  Similarly, any DTD nodes are stored in a `dtdNodeList` property (also an array).  Feel free to change these to customize your serialized XML documents.\n\n```js\nparser.piNodeList = [ '?xml version=\"1.0\" encoding=\"UTF-8\"?' ];\nparser.dtdNodeList = [ '!DOCTYPE MyAppConfig SYSTEM \"/dtds/AppConfig.dtd\"' ];\n\nconsole.log( parser.compose() );\n```\n\n## Custom XML Formatting\n\nTo produce custom XML formatting using the object-oriented API, you can pass two arguments to the `compose()` method.  The first argument represents the indentation character (defaults to `\\t`) and the second argument represents the EOL character (defaults to `\\n`).\n\nFor example, to produce compact XML (i.e. all crammed onto one line) set both arguments to empty strings.  Example:\n\n```js\nconsole.log( parser.compose(\"\", \"\") );\n```\n\nThis would produce the following output:\n\n```xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?><Document><Node Key=\"Value\">Complex</Node><Simple>Hello, I changed this.</Simple></Document>\n```\n\n# Utility Functions\n\nHere are a few utility functions that are provided in the package:\n\n## encodeEntities\n\n```\nSTRING encodeEntities( STRING )\n```\n\nThis function will take a string, and encode the three standard XML entities, ampersand (`&`), left-angle-bracket (`<`) and right-angle-bracket (`>`), into their XML-safe counterparts.  It returns the result.  Example:\n\n```javascript\nvar text = '<Hello>&<There>';\nconsole.log( XML.encodeEntities(text) );\n// Would output: &lt;Hello&gt;&amp;&lt;There&gt;\n```\n\n## encodeAttribEntities\n\n```\nSTRING encodeAttribEntities( STRING )\n```\n\nThis function does basically the same thing as [encodeEntities](#encodeentities), but it also includes encoding for single-quotes (`'`) and double-quotes (`\"`).  It is used for encoding an XML string for composing into an attribute value.  It returns the result.  Example:\n\n```javascript\nvar text = '<Hello>\"&\"<There>';\nconsole.log( XML.encodeAttribEntities(text) );\n// Would output: &lt;Hello&gt;&quot;&amp;&quot;&lt;There&gt;\n```\n\n## decodeEntities\n\n```\nSTRING decodeEntities( STRING )\n```\n\nThis function decodes all the standard XML entities back into their original characters.  This includes ampersand (`&`), left-angle-bracket (`<`), right-angle-bracket (`>`), single-quote (`'`) and double-quote (`\"`).  It is used when parsing XML element and attribute values.  Example:\n\n```javascript\nvar text = '&lt;Hello&gt;&quot;&amp;&quot;&lt;There&gt;';\nconsole.log( XML.decodeEntities(text) );\n// Would output: <Hello>\"&\"<There>\n```\n\n## alwaysArray\n\n```\nARRAY alwaysArray( MIXED )\n```\n\nThis function will wrap anything passed to it into an array and return the array, unless the item passed is already an array, in which case it is simply returned verbatim.\n\n```javascript\nvar arr = XML.alwaysArray( maybe_array );\n```\n\n## hashKeysToArray\n\n```\nARRAY hashKeysToArray( OBJECT )\n```\n\nThis function returns all the hash keys as an array.  Useful for sorting and then iterating over the sorted list.\n\n```javascript\nvar my_hash = { foo: \"bar\", baz: 12345 };\nvar keys = XML.hashKeysToArray( my_hash ).sort();\n\nfor (var idx = 0, len = keys.length; idx < len; idx++) {\n\tvar key = keys[idx];\n\t// do something with key and my_hash[key]\n}\n```\n\n## isaHash\n\n```\nBOOLEAN isaHash( MIXED )\n```\n\nThis function returns `true` if the provided argument is a hash (object), `false` otherwise.\n\n```javascript\nvar my_hash = { foo: \"bar\", baz: 12345 };\nvar is_hash = XML.isaHash( my_hash );\n```\n\n## isaArray\n\n```\nBOOLEAN isaArray( MIXED )\n```\n\nThis function returns `true` if the provided argument is an array (or is array-like), `false` otherwise.\n\n```javascript\nvar my_arr = [ \"foo\", \"bar\", 12345 ];\nvar is_arr = XML.isaArray( my_arr );\n```\n\n## numKeys\n\n```\nINTEGER numKeys( OBJECT )\n```\n\nThis function returns the number of keys in the specified hash.\n\n```javascript\nvar my_hash = { foo: \"bar\", baz: 12345 };\nvar num = XML.numKeys( my_hash ); // 2\n```\n\n## firstKey\n\n```\nSTRING firstKey( OBJECT )\n```\n\nThis function returns the first key of the hash when iterating over it.  Note that hash keys are stored in an undefined order.\n\n```javascript\nvar my_hash = { foo: \"bar\", baz: 12345 };\nvar key = XML.firstKey( my_hash ); // foo or baz\n```\n\n# Known Issues\n\n* Serialized XML doesn't exactly match parsed XML.\n* Unicode XML entities are not decoded when parsed.\n\n# License\n\nThe MIT License\n\nCopyright (c) 2004 - 2016 Joseph Huckaby\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","_attachments":{},"homepage":"https://github.com/jhuckaby/pixl-xml","bugs":{"url":"https://github.com/jhuckaby/pixl-xml/issues"},"license":"MIT"}