{
  "name": "xmldoc",
  "description": "A lightweight XML Document class for JavaScript.",
  "author": {
    "name": "Nick Farina",
    "email": "nfarina@gmail.com",
    "url": "http://nfarina.com"
  },
  "version": "0.1.2",
  "main": "./index",
  "dependencies": {
    "sax": "0.4.2"
  },
  "license": {
    "type": "MIT",
    "url": "https://raw.github.com/nfarina/xmldoc-js/master/LICENSE"
  },
  "repository": {
    "type": "git",
    "url": "git://github.com/nfarina/xmldoc-js.git"
  },
  "contributors": [
    {
      "name": "Nick Farina",
      "email": "nfarina@gmail.com"
    }
  ],
  "readmeFilename": "README.md",
  "readme": "\n## Introduction\n\n`xmldoc` lets you parse XML documents with ease. It's a pure-JavaScript, one-file XML document class with a single dependency on the excellent [`sax`][sax] parser.\n\nFor more on why I wrote this class, see the [blog post][blog].\n\n  [blog]: http://nfarina.com/post/34302964969/a-lightweight-xml-document-class-for-nodejs-javascript\n\n## Installation\n\n    npm install xmldoc\n\nOr just download the repository and include it in your `node_modules` directly. Or just download the [single JS file][blob]!\n\n  [blob]: https://github.com/nfarina/xmldoc/blob/master/lib/xmldoc.js\n\n## Usage\n\n    var xmldoc = require('../lib/xmldoc');\n\n    var document = new xmldoc.XmlDocument(\"<some>xml</some>\");\n\n    ... do things\n\n## Classes\n\nThe primary exported class is `XmlDocument`, which you'll use to consume your XML text. `XmlDocument` contains a hierarchy of `XmlElement` instances representing the XML structure.\n\nBoth `XmlElement` and `XmlDocument` contain the same members and methods you can call to traverse the document or a subtree.\n\n## Members\n\n* `name` - the node name, like \"tat\" for `<tat>`.\n* `attr` - an object dict containing attribute properties, like `bookNode.attr.title` for `<book title=\"...\">`.\n* `val` - the string \"value\" of the node, if any, like \"world\" for `<hello>world</hello>`.\n* `children` - an array of `XmlElement` children of the node.\n\nEach member defaults to a sensible \"empty\" value like `{}` for `attr`, `[]` for `children`, and `\"\"` for `val`.\n\n## Methods\n\nAll methods with `child` in the name operate only on direct children; they do not do a deep/recursive search.\n\n### eachChild(func)\n\nSimilar to [underscore's][underscore] `each` method, it will call `func(child, index, array)` for each child of the given node.\n\n### childNamed(name)\n\nPass it the name of a child node and it will search for and return the first one found, or `undefined`.\n\n### childrenNamed(name)\n\nLike `childNamed` but returns all matching children in an array, or `[]`.\n\n### childWithAttribute(name,value)\n\nSearches for the first child with the given attribute value. You can omit `value` to just find the first node with the given attribute defined at all.\n\n### descendantWithPath(path)\n\nSearches for a specific \"path\" uses dot notation. Example:\n\n    <book>\n      <author>\n        <name isProper=\"true\">George R. R. Martin</name>\n        ...\n      </author>\n      ...\n    </book>\n\nIf you just want the `<name>` node and you have the `XmlElement` for the `<book>` node, you can say:\n\n    var nameNode = bookNode.descendantWithPath(\"author.name\"); // return <name> node\n\n### valueWithPath(path)\n\nJust like `descendantWithPath`, but goes deeper and extracts the `val` of the node. Example:\n\n    var authorName = bookNode.valueWithPath(\"author.name\"); // return \"George R. R. Martin\"\n\nYou can also use the `@` character to request the value of a particular _attribute_ instead:\n\n    var authorIsProper = bookNode.valueWithPath(\"author.name@isProper\"); // return \"true\"\n\nThis is not [XPath][]! It's just a thing I made up, OK?\n\n### toString()\n\nThis is just an override of the standard JavaScript method, it will give you the pretty-printed string representation of your XML document or element. Note that this is for debugging only! It will truncate any long node values.\n  \n    var xml = \"<author><name>looooooong value</name></author>\";\n    console.log(\"My document: \\n\" + new XmlDocument(xml))\n\nPrints:\n\n    My Document:\n    <hello>\n      loooooooo…\n    </hello>\n\n## Feedback\n\nFeel free to file issues or hit me up on [Twitter][twitter].\n\n  [underscore]: http://underscorejs.org\n  [XPath]: http://en.wikipedia.org/wiki/XPath\n  [twitter]: http://twitter.com/nfarina\n  [sax]: https://github.com/isaacs/sax-js\n",
  "bugs": {
    "url": "https://github.com/nfarina/xmldoc-js/issues"
  },
  "_id": "xmldoc@0.1.2",
  "_from": "xmldoc@*"
}
