{
  "name": "xml2js",
  "description": "Simple XML to JavaScript object converter.",
  "keywords": [
    "xml",
    "json"
  ],
  "homepage": "https://github.com/Leonidas-from-XIV/node-xml2js",
  "version": "0.4.2",
  "author": {
    "name": "Marek Kubica",
    "email": "marek@xivilization.net",
    "url": "http://xivilization.net"
  },
  "contributors": [
    {
      "name": "maqr",
      "email": "maqr.lollerskates@gmail.com",
      "url": "https://github.com/maqr"
    },
    {
      "name": "Ben Weaver",
      "url": "http://benweaver.com/"
    },
    {
      "name": "Jae Kwon",
      "url": "https://github.com/jaekwon"
    },
    {
      "name": "Jim Robert"
    },
    {
      "name": "Ștefan Rusu",
      "url": "http://www.saltwaterc.eu/"
    },
    {
      "name": "Carter Cole",
      "email": "carter.cole@cartercole.com",
      "url": "http://cartercole.com/"
    },
    {
      "name": "Kurt Raschke",
      "email": "kurt@kurtraschke.com",
      "url": "http://www.kurtraschke.com/"
    },
    {
      "name": "Contra",
      "email": "contra@australia.edu",
      "url": "https://github.com/Contra"
    },
    {
      "name": "Marcelo Diniz",
      "email": "marudiniz@gmail.com",
      "url": "https://github.com/mdiniz"
    },
    {
      "name": "Michael Hart",
      "url": "https://github.com/mhart"
    },
    {
      "name": "Zachary Scott",
      "email": "zachary@zacharyscott.net",
      "url": "http://zacharyscott.net/"
    },
    {
      "name": "Raoul Millais",
      "url": "https://github.com/raoulmillais"
    },
    {
      "name": "Salsita Software",
      "url": "http://www.salsitasoft.com/"
    },
    {
      "name": "Mike Schilling",
      "email": "mike@emotive.com",
      "url": "http://www.emotive.com/"
    },
    {
      "name": "Jackson Tian",
      "email": "shyvo1987@gmail.com",
      "url": "http://weibo.com/shyvo"
    },
    {
      "name": "Mikhail Zyatin",
      "email": "mikhail.zyatin@gmail.com",
      "url": "https://github.com/Sitin"
    },
    {
      "name": "Chris Tavares",
      "email": "ctavares@microsoft.com",
      "url": "https://github.com/christav"
    },
    {
      "name": "Frank Xu",
      "email": "yyfrankyy@gmail.com",
      "url": "http://f2e.us/"
    },
    {
      "name": "Guido D'Albore",
      "email": "guido@bitstorm.it",
      "url": "http://www.bitstorm.it/"
    },
    {
      "name": "Jack Senechal",
      "url": "http://jacksenechal.com/"
    },
    {
      "name": "Matthias Hölzl",
      "email": "tc@xantira.com",
      "url": "https://github.com/hoelzl"
    },
    {
      "name": "Camille Reynders",
      "email": "info@creynders.be",
      "url": "http://www.creynders.be/"
    },
    {
      "name": "Taylor Gautier",
      "url": "https://github.com/tsgautier"
    },
    {
      "name": "Todd Bryan",
      "url": "https://github.com/toddrbryan"
    }
  ],
  "main": "./lib/xml2js",
  "directories": {
    "lib": "./lib"
  },
  "scripts": {
    "test": "zap"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/Leonidas-from-XIV/node-xml2js.git"
  },
  "dependencies": {
    "sax": "0.5.x",
    "xmlbuilder": ">=0.4.2"
  },
  "devDependencies": {
    "coffee-script": ">=1.7.1",
    "zap": ">=0.2.6",
    "docco": ">=0.6.2",
    "diff": ">=1.0.8"
  },
  "licenses": [
    {
      "type": "MIT",
      "url": "https://raw.github.com/Leonidas-from-XIV/node-xml2js/master/LICENSE"
    }
  ],
  "readme": "node-xml2js\n===========\n\nEver had the urge to parse XML? And wanted to access the data in some sane,\neasy way? Don't want to compile a C parser, for whatever reason? Then xml2js is\nwhat you're looking for!\n\nDescription\n===========\n\nSimple XML to JavaScript object converter. It supports bi-directional conversion.\nUses [sax-js](https://github.com/isaacs/sax-js/) and\n[xmlbuilder-js](https://github.com/oozcitak/xmlbuilder-js/).\n\nNote: If you're looking for a full DOM parser, you probably want\n[JSDom](https://github.com/tmpvar/jsdom).\n\nInstallation\n============\n\nSimplest way to install `xml2js` is to use [npm](http://npmjs.org), just `npm\ninstall xml2js` which will download xml2js and all dependencies.\n\nUsage\n=====\n\nNo extensive tutorials required because you are a smart developer! The task of\nparsing XML should be an easy one, so let's make it so! Here's some examples.\n\nShoot-and-forget usage\n----------------------\n\nYou want to parse XML as simple and easy as possible? It's dangerous to go\nalone, take this:\n\n```javascript\nvar parseString = require('xml2js').parseString;\nvar xml = \"<root>Hello xml2js!</root>\"\nparseString(xml, function (err, result) {\n    console.dir(result);\n});\n```\n\nCan't get easier than this, right? This works starting with `xml2js` 0.2.3.\nWith CoffeeScript it looks like this:\n\n```coffeescript\n{parseString} = require 'xml2js'\nxml = \"<root>Hello xml2js!</root>\"\nparseString xml, (err, result) ->\n    console.dir result\n```\n\nIf you need some special options, fear not, `xml2js` supports a number of\noptions (see below), you can specify these as second argument:\n\n```javascript\nparseString(xml, {trim: true}, function (err, result) {\n});\n```\n\nSimple as pie usage\n-------------------\n\nThat's right, if you have been using xml-simple or a home-grown\nwrapper, this was added in 0.1.11 just for you:\n\n```javascript\nvar fs = require('fs'),\n    xml2js = require('xml2js');\n\nvar parser = new xml2js.Parser();\nfs.readFile(__dirname + '/foo.xml', function(err, data) {\n    parser.parseString(data, function (err, result) {\n        console.dir(result);\n        console.log('Done');\n    });\n});\n```\n\nLook ma, no event listeners!\n\nYou can also use `xml2js` from\n[CoffeeScript](http://jashkenas.github.com/coffee-script/), further reducing\nthe clutter:\n\n```coffeescript\nfs = require 'fs',\nxml2js = require 'xml2js'\n\nparser = new xml2js.Parser()\nfs.readFile __dirname + '/foo.xml', (err, data) ->\n  parser.parseString data, (err, result) ->\n    console.dir result\n    console.log 'Done.'\n```\n\nBut what happens if you forget the `new` keyword to create a new `Parser`? In\nthe middle of a nightly coding session, it might get lost, after all. Worry\nnot, we got you covered! Starting with 0.2.8 you can also leave it out, in\nwhich case `xml2js` will helpfully add it for you, no bad surprises and\ninexplicable bugs!\n\n\"Traditional\" usage\n-------------------\n\nAlternatively you can still use the traditional `addListener` variant that was\nsupported since forever:\n\n```javascript\nvar fs = require('fs'),\n    xml2js = require('xml2js');\n\nvar parser = new xml2js.Parser();\nparser.addListener('end', function(result) {\n    console.dir(result);\n    console.log('Done.');\n});\nfs.readFile(__dirname + '/foo.xml', function(err, data) {\n    parser.parseString(data);\n});\n```\n\nIf you want to parse multiple files, you have multiple possibilites:\n\n  * You can create one `xml2js.Parser` per file. That's the recommended one\n    and is promised to always *just work*.\n  * You can call `reset()` on your parser object.\n  * You can hope everything goes well anyway. This behaviour is not\n    guaranteed work always, if ever. Use option #1 if possible. Thanks!\n\nSo you wanna some JSON?\n-----------------------\n\nJust wrap the `result` object in a call to `JSON.stringify` like this\n`JSON.stringify(result)`. You get a string containing the JSON representation\nof the parsed object that you can feed to JSON-hungry consumers.\n\nDisplaying results\n------------------\n\nYou might wonder why, using `console.dir` or `console.log` the output at some\nlevel is only `[Object]`. Don't worry, this is not because xml2js got lazy.\nThat's because Node uses `util.inspect` to convert the object into strings and\nthat function stops after `depth=2` which is a bit low for most XML.\n\nTo display the whole deal, you can use `console.log(util.inspect(result, false,\nnull))`, which displays the whole result.\n\nSo much for that, but what if you use\n[eyes](https://github.com/cloudhead/eyes.js) for nice colored output and it\ntruncates the output with `…`? Don't fear, there's also a solution for that,\nyou just need to increase the `maxLength` limit by creating a custom inspector\n`var inspect = require('eyes').inspector({maxLength: false})` and then you can\neasily `inspect(result)`.\n\nXML builder usage\n-----------------\n\nSince 0.4.0, objects can be also be used to build XML:\n\n```javascript\nvar fs = require('fs'),\n    xml2js = require('xml2js');\n\nvar obj = {name: \"Super\", Surname: \"Man\", age: 23};\n\nvar builder = new xml2js.Builder();\nvar xml = builder.buildObject(obj);\n```\n\nAt the moment, a one to one bi-directional conversion is guaranteed only for\ndefault configuration, except for `attrkey`, `charkey` and `explicitArray` options\nyou can redefine to your taste. Writing CDATA is not currently supported.\n\nProcessing attribute and tag names\n----------------------------------\n\nSince 0.4.1 you can optionally provide the parser with attribute and tag name processors:\n\n```javascript\n\nfunction nameToUpperCase(name){\n    return name.toUpperCase();\n}\n\n//transform all attribute and tag names to uppercase\nparseString(xml, {tagNameProcessors: [nameToUpperCase], attrNameProcessors: [nameToUpperCase]}, function (err, result) {\n});\n```\n\nThe `tagNameProcessors` and `attrNameProcessors` options both accept an `Array` of functions with the following signature:\n```javascript\nfunction (name){\n  //do something with `name`\n  return name\n}\n```\n\nSome processors are provided out-of-the-box and can be found in `lib/processors.js`:\n\n- `normalize`: transforms the name to lowercase.\n(Automatically used when `options.normalize` is set to `true`)\n\n- `firstCharLowerCase`: transforms the first character to lower case.\nE.g. 'MyTagName' becomes 'myTagName'\n\n- `stripPrefix`: strips the xml namespace prefix. E.g `<foo:Bar/>` will become 'Bar'.\n(N.B.: the `xmlns` prefix is NOT stripped.)\n\nOptions\n=======\n\nApart from the default settings, there are a number of options that can be\nspecified for the parser. Options are specified by ``new Parser({optionName:\nvalue})``. Possible options are:\n\n  * `attrkey` (default: `$`): Prefix that is used to access the attributes.\n    Version 0.1 default was `@`.\n  * `charkey` (default: `_`): Prefix that is used to access the character\n    content. Version 0.1 default was `#`.\n  * `explicitCharkey` (default: `false`)\n  * `trim` (default: `false`): Trim the whitespace at the beginning and end of\n    text nodes.\n  * `normalizeTags` (default: `false`): Normalize all tag names to lowercase.\n  * `normalize` (default: `false`): Trim whitespaces inside text nodes.\n  * `explicitRoot` (default: `true`): Set this if you want to get the root\n    node in the resulting object.\n  * `emptyTag` (default: `undefined`): what will the value of empty nodes be.\n    Default is `{}`.\n  * `explicitArray` (default: `true`): Always put child nodes in an array if\n    true; otherwise an array is created only if there is more than one.\n  * `ignoreAttrs` (default: `false`): Ignore all XML attributes and only create\n    text nodes.\n  * `mergeAttrs` (default: `false`): Merge attributes and child elements as\n    properties of the parent, instead of keying attributes off a child\n    attribute object. This option is ignored if `ignoreAttrs` is `false`.\n  * `validator` (default `null`): You can specify a callable that validates\n    the resulting structure somehow, however you want. See unit tests\n    for an example.\n  * `xmlns` (default `false`): Give each element a field usually called '$ns'\n    (the first character is the same as attrkey) that contains its local name\n    and namespace URI.\n  * `explicitChildren` (default `false`): Put child elements to separate\n    property. Doesn't work with `mergeAttrs = true`. If element has no children\n    then \"children\" won't be created. Added in 0.2.5.\n  * `childkey` (default `$$`): Prefix that is used to access child elements if\n    `explicitChildren` is set to `true`. Added in 0.2.5.\n  * `charsAsChildren` (default `false`): Determines whether chars should be\n    considered children if `explicitChildren` is on. Added in 0.2.5.\n  * `async` (default `false`): Should the callbacks be async? This *might* be\n    an incompatible change if your code depends on sync execution of callbacks.\n    xml2js 0.3 might change this default, so the recommendation is to not\n    depend on sync execution anyway. Added in 0.2.6.\n  * `strict` (default `true`): Set sax-js to strict or non-strict parsing mode.\n    Defaults to `true` which is *highly* recommended, since parsing HTML which\n    is not well-formed XML might yield just about anything. Added in 0.2.7.\n  * `attrNameProcessors` (default: `null`): Allows the addition of attribute name processing functions.\n    Accepts an `Array` of functions with following signature:\n    ```javascript\n    function (name){\n        //do something with `name`\n        return name\n    }\n    ```\n    Added in 0.4.1\n  * `tagNameProcessors` (default: `null`):Allows the addition of tag name processing functions.\n    Accepts an `Array` of functions with following signature:\n    ```javascript\n    function (name){\n      //do something with `name`\n      return name\n    }\n    ```\n    Added in 0.4.1\n\nOptions for the `Builder` class\n-------------------------------\n\n  * `rootName` (default `root`): root element name to be used in case\n     `explicitRoot` is `false` or to override the root element name.\n  * `renderOpts` (default `{ 'pretty': true, 'indent': '  ', 'newline': '\\n' }`):\n    Rendering options for xmlbuilder-js.\n    * pretty: prettify generated XML\n    * indent: whitespace for indentation (only when pretty)\n    * newline: newline char (only when pretty)\n  * `xmldec` (default `{ 'version': '1.0', 'encoding': 'UTF-8', 'standalone': true }`:\n    XML declaration attributes.\n    * `xmldec.version` A version number string, e.g. 1.0\n    * `xmldec.encoding` Encoding declaration, e.g. UTF-8\n    * `xmldec.standalone` standalone document declaration: true or false\n  * `doctype` (default `null`): optional DTD. Eg. `{'ext': 'hello.dtd'}`\n\nrenderOpts, xmldec and doctype pass through to [xmlbuilder-js](https://github.com/oozcitak/xmlbuilder-js)\n\nUpdating to new version\n=======================\n\nVersion 0.2 changed the default parsing settings, but version 0.1.14 introduced\nthe default settings for version 0.2, so these settings can be tried before the\nmigration.\n\n```javascript\nvar xml2js = require('xml2js');\nvar parser = new xml2js.Parser(xml2js.defaults[\"0.2\"]);\n```\n\nTo get the 0.1 defaults in version 0.2 you can just use\n`xml2js.defaults[\"0.1\"]` in the same place. This provides you with enough time\nto migrate to the saner way of parsing in xml2js 0.2. We try to make the\nmigration as simple and gentle as possible, but some breakage cannot be\navoided.\n\nSo, what exactly did change and why? In 0.2 we changed some defaults to parse\nthe XML in a more universal and sane way. So we disabled `normalize` and `trim`\nso xml2js does not cut out any text content. You can reenable this at will of\ncourse. A more important change is that we return the root tag in the resulting\nJavaScript structure via the `explicitRoot` setting, so you need to access the\nfirst element. This is useful for anybody who wants to know what the root node\nis and preserves more information. The last major change was to enable\n`explicitArray`, so everytime it is possible that one might embed more than one\nsub-tag into a tag, xml2js >= 0.2 returns an array even if the array just\nincludes one element. This is useful when dealing with APIs that return\nvariable amounts of subtags.\n\nRunning tests, development\n==========================\n\n[![Build Status](https://secure.travis-ci.org/Leonidas-from-XIV/node-xml2js.png?branch=master)](https://travis-ci.org/Leonidas-from-XIV/node-xml2js)\n[![Dependency Status](https://david-dm.org/Leonidas-from-XIV/node-xml2js.png)](https://david-dm.org/Leonidas-from-XIV/node-xml2js)\n\nThe development requirements are handled by npm, you just need to install them.\nWe also have a number of unit tests, they can be run using `npm test` directly\nfrom the project root. This runs zap to discover all the tests and execute\nthem.\n\nIf you like to contribute, keep in mind that xml2js is written in CoffeeScript,\nso don't develop on the JavaScript files that are checked into the repository\nfor convenience reasons. Also, please write some unit test to check your\nbehaviour and if it is some user-facing thing, add some documentation to this\nREADME, so people will know it exists. Thanks in advance!\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/Leonidas-from-XIV/node-xml2js/issues"
  },
  "_id": "xml2js@0.4.2",
  "dist": {
    "shasum": "10d72a5fc9bf35ecd7a8f892f6d1b996617f4525"
  },
  "_from": "xml2js@",
  "_resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.2.tgz"
}
