{ "_args": [ [ { "raw": "sax@~1.1.1", "scope": null, "escapedName": "sax", "name": "sax", "rawSpec": "~1.1.1", "spec": ">=1.1.1 <1.2.0", "type": "range" }, "/home/jdaugherty/work/GT2/GT2-Android/node_modules/xmldoc" ] ], "_from": "sax@>=1.1.1 <1.2.0", "_id": "sax@1.1.6", "_inCache": true, "_location": "/sax", "_nodeVersion": "5.6.0", "_npmOperationalInternal": { "host": "packages-12-west.internal.npmjs.com", "tmp": "tmp/sax-1.1.6.tgz_1457169236375_0.0688094305805862" }, "_npmUser": { "name": "isaacs", "email": "i@izs.me" }, "_npmVersion": "3.7.3", "_phantomChildren": {}, "_requested": { "raw": "sax@~1.1.1", "scope": null, "escapedName": "sax", "name": "sax", "rawSpec": "~1.1.1", "spec": ">=1.1.1 <1.2.0", "type": "range" }, "_requiredBy": [ "/xmldoc" ], "_resolved": "https://registry.npmjs.org/sax/-/sax-1.1.6.tgz", "_shasum": "5d616be8a5e607d54e114afae55b7eaf2fcc3240", "_shrinkwrap": null, "_spec": "sax@~1.1.1", "_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/xmldoc", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", "url": "http://blog.izs.me/" }, "bugs": { "url": "https://github.com/isaacs/sax-js/issues" }, "contributors": [ { "name": "Isaac Z. Schlueter", "email": "i@izs.me" }, { "name": "Stein Martin Hustad", "email": "stein@hustad.com" }, { "name": "Mikeal Rogers", "email": "mikeal.rogers@gmail.com" }, { "name": "Laurie Harper", "email": "laurie@holoweb.net" }, { "name": "Jann Horn", "email": "jann@Jann-PC.fritz.box" }, { "name": "Elijah Insua", "email": "tmpvar@gmail.com" }, { "name": "Henry Rawas", "email": "henryr@schakra.com" }, { "name": "Justin Makeig", "email": "jmpublic@makeig.com" }, { "name": "Mike Schilling", "email": "mike@emotive.com" } ], "dependencies": {}, "description": "An evented streaming XML parser in JavaScript", "devDependencies": { "standard": "^5.3.1", "tap": "^5.2.0" }, "directories": {}, "dist": { "shasum": "5d616be8a5e607d54e114afae55b7eaf2fcc3240", "tarball": "https://registry.npmjs.org/sax/-/sax-1.1.6.tgz" }, "files": [ "lib/sax.js", "LICENSE", "LICENSE-W3C.html", "README.md" ], "gitHead": "8dc23406a83992a22b8240abdd91185db2b4fb0c", "homepage": "https://github.com/isaacs/sax-js#readme", "license": "ISC", "main": "lib/sax.js", "maintainers": [ { "name": "isaacs", "email": "i@izs.me" } ], "name": "sax", "optionalDependencies": {}, "readme": "# sax js\n\nA sax-style parser for XML and HTML.\n\nDesigned with [node](http://nodejs.org/) in mind, but should work fine in\nthe browser or other CommonJS implementations.\n\n## What This Is\n\n* A very simple tool to parse through an XML string.\n* A stepping stone to a streaming HTML parser.\n* A handy way to deal with RSS and other mostly-ok-but-kinda-broken XML\n docs.\n\n## What This Is (probably) Not\n\n* An HTML Parser - That's a fine goal, but this isn't it. It's just\n XML.\n* A DOM Builder - You can use it to build an object model out of XML,\n but it doesn't do that out of the box.\n* XSLT - No DOM = no querying.\n* 100% Compliant with (some other SAX implementation) - Most SAX\n implementations are in Java and do a lot more than this does.\n* An XML Validator - It does a little validation when in strict mode, but\n not much.\n* A Schema-Aware XSD Thing - Schemas are an exercise in fetishistic\n masochism.\n* A DTD-aware Thing - Fetching DTDs is a much bigger job.\n\n## Regarding `Hello, world!').close();\n\n// stream usage\n// takes the same options as the parser\nvar saxStream = require(\"sax\").createStream(strict, options)\nsaxStream.on(\"error\", function (e) {\n // unhandled errors will throw, since this is a proper node\n // event emitter.\n console.error(\"error!\", e)\n // clear the error\n this._parser.error = null\n this._parser.resume()\n})\nsaxStream.on(\"opentag\", function (node) {\n // same object as above\n})\n// pipe is supported, and it's readable/writable\n// same chunks coming in also go out.\nfs.createReadStream(\"file.xml\")\n .pipe(saxStream)\n .pipe(fs.createWriteStream(\"file-copy.xml\"))\n```\n\n\n## Arguments\n\nPass the following arguments to the parser function. All are optional.\n\n`strict` - Boolean. Whether or not to be a jerk. Default: `false`.\n\n`opt` - Object bag of settings regarding string formatting. All default to `false`.\n\nSettings supported:\n\n* `trim` - Boolean. Whether or not to trim text and comment nodes.\n* `normalize` - Boolean. If true, then turn any whitespace into a single\n space.\n* `lowercase` - Boolean. If true, then lowercase tag names and attribute names\n in loose mode, rather than uppercasing them.\n* `xmlns` - Boolean. If true, then namespaces are supported.\n* `position` - Boolean. If false, then don't track line/col/position.\n* `strictEntities` - Boolean. If true, only parse [predefined XML\n entities](http://www.w3.org/TR/REC-xml/#sec-predefined-ent)\n (`&`, `'`, `>`, `<`, and `"`)\n\n## Methods\n\n`write` - Write bytes onto the stream. You don't have to do this all at\nonce. You can keep writing as much as you want.\n\n`close` - Close the stream. Once closed, no more data may be written until\nit is done processing the buffer, which is signaled by the `end` event.\n\n`resume` - To gracefully handle errors, assign a listener to the `error`\nevent. Then, when the error is taken care of, you can call `resume` to\ncontinue parsing. Otherwise, the parser will not continue while in an error\nstate.\n\n## Members\n\nAt all times, the parser object will have the following members:\n\n`line`, `column`, `position` - Indications of the position in the XML\ndocument where the parser currently is looking.\n\n`startTagPosition` - Indicates the position where the current tag starts.\n\n`closed` - Boolean indicating whether or not the parser can be written to.\nIf it's `true`, then wait for the `ready` event to write again.\n\n`strict` - Boolean indicating whether or not the parser is a jerk.\n\n`opt` - Any options passed into the constructor.\n\n`tag` - The current tag being dealt with.\n\nAnd a bunch of other stuff that you probably shouldn't touch.\n\n## Events\n\nAll events emit with a single argument. To listen to an event, assign a\nfunction to `on`. Functions get executed in the this-context of\nthe parser object. The list of supported events are also in the exported\n`EVENTS` array.\n\nWhen using the stream interface, assign handlers using the EventEmitter\n`on` function in the normal fashion.\n\n`error` - Indication that something bad happened. The error will be hanging\nout on `parser.error`, and must be deleted before parsing can continue. By\nlistening to this event, you can keep an eye on that kind of stuff. Note:\nthis happens *much* more in strict mode. Argument: instance of `Error`.\n\n`text` - Text node. Argument: string of text.\n\n`doctype` - The ``. Argument:\nobject with `name` and `body` members. Attributes are not parsed, as\nprocessing instructions have implementation dependent semantics.\n\n`sgmldeclaration` - Random SGML declarations. Stuff like ``\nwould trigger this kind of event. This is a weird thing to support, so it\nmight go away at some point. SAX isn't intended to be used to parse SGML,\nafter all.\n\n`opentag` - An opening tag. Argument: object with `name` and `attributes`.\nIn non-strict mode, tag names are uppercased, unless the `lowercase`\noption is set. If the `xmlns` option is set, then it will contain\nnamespace binding information on the `ns` member, and will have a\n`local`, `prefix`, and `uri` member.\n\n`closetag` - A closing tag. In loose mode, tags are auto-closed if their\nparent closes. In strict mode, well-formedness is enforced. Note that\nself-closing tags will have `closeTag` emitted immediately after `openTag`.\nArgument: tag name.\n\n`attribute` - An attribute node. Argument: object with `name` and `value`.\nIn non-strict mode, attribute names are uppercased, unless the `lowercase`\noption is set. If the `xmlns` option is set, it will also contains namespace\ninformation.\n\n`comment` - A comment node. Argument: the string of the comment.\n\n`opencdata` - The opening tag of a ``) of a `` tags trigger a `\"script\"`\nevent, and their contents are not checked for special xml characters.\nIf you pass `noscript: true`, then this behavior is suppressed.\n\n## Reporting Problems\n\nIt's best to write a failing test if you find an issue. I will always\naccept pull requests with failing tests if they demonstrate intended\nbehavior, but it is very hard to figure out what issue you're describing\nwithout a test. Writing a test is also the best way for you yourself\nto figure out if you really understand the issue you think you have with\nsax-js.\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git://github.com/isaacs/sax-js.git" }, "scripts": { "posttest": "standard -F test/*.js lib/*.js", "test": "tap test/*.js --cov" }, "version": "1.1.6" }