[Pkg-javascript-commits] [node-expat] 10/34: moving back to astro github account

Jonas Smedegaard dr at jones.dk
Wed Aug 31 10:46:48 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository node-expat.

commit ce4db56d89c619cbbb22f568c6066b8395a32564
Author: Sonny Piers <sonny at fastmail.net>
Date:   Wed Mar 30 18:08:59 2016 +0200

    moving back to astro github account
---
 README.md    | 105 +++++++++++++++++++++++++++++++++++++++++++++++++----------
 package.json |  16 +++------
 2 files changed, 93 insertions(+), 28 deletions(-)

diff --git a/README.md b/README.md
index 5dbe8c4..9023948 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,11 @@
 # node-expat
 
-[![build status](https://img.shields.io/travis/node-xmpp/node-expat/master.svg?style=flat-square)](https://travis-ci.org/node-xmpp/node-expat/branches)
+[![build status](https://img.shields.io/travis/astro/node-expat/master.svg?style=flat-square)](https://travis-ci.org/astro/node-expat/branches)
 [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)
 
 ## Motivation
 
-You use [Node.js](https://nodejs.org) for speed? You process
-XML streams? Then you want the fastest XML parser: [libexpat](http://expat.sourceforge.net/)!
-
-## Manual
-
-Please see the [node-expat manual](http://node-xmpp.org/doc/expat.html)
+You use [Node.js](https://nodejs.org) for speed? You process XML streams? Then you want the fastest XML parser: [libexpat](http://expat.sourceforge.net/)!
 
 ## Install
 
@@ -18,12 +13,69 @@ Please see the [node-expat manual](http://node-xmpp.org/doc/expat.html)
 npm install node-expat
 ```
 
-## Testing
+## Usage
+
+Important events emitted by a parser:
+
+```javascript
+(function () {
+  "use strict";
+
+  var expat = require('node-expat')
+  var parser = new expat.Parser('UTF-8')
+
+  parser.on('startElement', function (name, attrs) {
+    console.log(name, attrs)
+  })
+
+  parser.on('endElement', function (name) {
+    console.log(name)
+  })
+
+  parser.on('text', function (text) {
+    console.log(text)
+  })
+
+  parser.on('error', function (error) {
+    console.error(error)
+  })
+
+  parser.write('<html><head><title>Hello World</title></head><body><p>Foobar</p></body></html>')
+
+}())
 
 ```
-npm install -g standard
-npm test
-```
+
+## API
+
+* `#on('startElement' function (name, attrs) {})`
+* `#on('endElement' function (name) {})`
+* `#on('text' function (text) {})`
+* `#on('processingInstruction', function (target, data) {})`
+* `#on('comment', function (s) {})`
+* `#on('xmlDecl', function (version, encoding, standalone) {})`
+* `#on('startCdata', function () {})`
+* `#on('startCdata', function () {})`
+* `#on('endCdata', function () {})`
+* `#on('entityDecl', function (entityName, isParameterEntity, value, base, systemId, publicId, notationName) {})`
+* `#on('error', function (e) {})`
+* `#stop()` pauses
+* `#resume()` resumes
+
+## Error handling
+
+We don't emit an error event because libexpat doesn't use a callback
+either. Instead, check that `parse()` returns `true`. A descriptive
+string can be obtained via `getError()` to provide user feedback.
+
+Alternatively, use the Parser like a node Stream. `write()` will emit
+error events.
+
+## Namespace handling
+
+A word about special parsing of *xmlns:* this is not necessary in a
+bare SAX parser like this, given that the DOM replacement you are
+using (if any) is not relevant to the parser.
 
 ## Benchmark
 
@@ -31,15 +83,34 @@ npm test
 
 | module                                                                                | ops/sec | native | XML compliant | stream         |
 |---------------------------------------------------------------------------------------|--------:|:------:|:-------------:|:--------------:|
-| [sax-js](https://github.com/isaacs/sax-js)                                            |  65,853 | ☐      | ☑             | ☑              |
-| [node-xml](https://github.com/dylang/node-xml)                                        | 106,374 | ☐      | ☑             | ☑              |
-| [libxmljs](https://github.com/polotek/libxmljs)                                       | 194,386 | ☑      | ☑             | ☐              |
-| **node-expat**                                                                        | 222,707 | ☑      | ☑             | ☑              |
-| [ltx/lib/parsers/ltx](https://github.com/node-xmpp/ltx/blob/master/lib/parsers/ltx.js)| 473,628 | ☐      | ☐             | ☑              |
+| [sax-js](https://github.com/isaacs/sax-js)                                            |  99,412 | ☐      | ☑             | ☑              |
+| [node-xml](https://github.com/dylang/node-xml)                                        | 130,631 | ☐      | ☑             | ☑              |
+| [libxmljs](https://github.com/polotek/libxmljs)                                       | 276,136 | ☑      | ☑             | ☐              |
+| **node-expat**                                                                        | 322,769 | ☑      | ☑             | ☑              |
 
 Higher is better.
 
+## Testing
+
+```
+npm install -g standard
+npm test
+```
 
 ## Windows
 
-If you fail to install node-expat as a dependency of node-xmpp, please update node-xmpp as it doesn't use node-expat anymore. Help is welcome as none of the maintainers are currently interested in Windows support. See https://github.com/node-xmpp/node-expat/issues/132 .
+If you fail to install node-expat as a dependency of node-xmpp, please update node-xmpp as it doesn't use node-expat anymore.
+
+Dependencies for `node-gyp` https://github.com/TooTallNate/node-gyp#installation
+
+See https://github.com/astro/node-expat/issues/78 if you are getting errors about not finding `nan.h`.
+
+### expat.vcproj
+
+```
+VCBUILD : error : project file 'node-expat\build\deps\libexpat\expat.vcproj' was not found or not a valid proj
+ect file. [C:\Users\admin\AppData\Roaming\npm\node_modules\node-expat\build\bin
+ding.sln]
+```
+
+Install [Visual Studio C++ 2012](http://go.microsoft.com/?linkid=9816758) and run npm with the [`--msvs_version=2012` flag](http://stackoverflow.com/a/16854333/937891).
diff --git a/package.json b/package.json
index 8a65695..f569869 100644
--- a/package.json
+++ b/package.json
@@ -32,21 +32,14 @@
     "sax": "^1.2.1",
     "vows": "^0.8.1"
   },
-  "repository": "github:node-xmpp/node-expat",
-  "homepage": "http://github.com/node-xmpp/node-expat",
-  "bugs": "https://github.com/node-xmpp/node-expat/issues",
+  "repository": "github:astro/node-expat",
+  "homepage": "http://github.com/astro/node-expat",
+  "bugs": "https://github.com/astro/node-expat/issues",
   "author": {
     "name": "Astro",
     "email": "astro at spaceboyz.net",
     "web": "http://spaceboyz.net/~astro/"
   },
-  "maintainers": [
-    {
-      "name": "Lloyd Watkin",
-      "email": "lloyd at evilprofessor.co.uk",
-      "web": "http://www.evilprofessor.co.uk"
-    }
-  ],
   "contributors": [
     "Stephan Maka",
     "Derek Hammer",
@@ -61,7 +54,8 @@
     "Tom Hughes-Croucher",
     "Nathan Rajlich",
     "Julien Genestoux",
-    "Sonny Piers"
+    "Sonny Piers",
+    "Lloyd Watkin"
   ],
   "license": "MIT"
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-expat.git



More information about the Pkg-javascript-commits mailing list