node-expat
Advanced tools
Comparing version 2.3.13 to 2.3.14
@@ -9,3 +9,3 @@ # This file is copyrighted under the BSD-license for buildsystem files of KDE | ||
set(PACKAGE_NAME "expat") | ||
set(PACKAGE_VERSION "2.1.0") | ||
set(PACKAGE_VERSION "2.2.0") | ||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") | ||
@@ -45,2 +45,6 @@ set(PACKAGE_TARNAME "${PACKAGE_NAME}") | ||
endif(MSVC) | ||
if(WIN32) | ||
add_definitions(-DWIN32) | ||
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Add a suffix, usually d on Windows") | ||
endif(WIN32) | ||
@@ -55,10 +59,12 @@ set(expat_SRCS | ||
if(WIN32 AND BUILD_shared) | ||
set(expat_SRCS ${expat_SRCS} lib/libexpat.def) | ||
endif(WIN32 AND BUILD_shared) | ||
if(BUILD_shared) | ||
set(_SHARED SHARED) | ||
if(WIN32) | ||
set(expat_SRCS ${expat_SRCS} lib/libexpat.def) | ||
endif(WIN32) | ||
else(BUILD_shared) | ||
set(_SHARED STATIC) | ||
if(WIN32) | ||
add_definitions(-DXML_STATIC) | ||
endif(WIN32) | ||
endif(BUILD_shared) | ||
@@ -68,2 +74,13 @@ | ||
set(LIBCURRENT 7) # sync | ||
set(LIBREVISION 2) # with | ||
set(LIBAGE 6) # configure.ac! | ||
math(EXPR LIBCURRENT_MINUS_AGE "${LIBCURRENT} - ${LIBAGE}") | ||
if(NOT WIN32) | ||
set_property(TARGET expat PROPERTY VERSION ${LIBCURRENT_MINUS_AGE}.${LIBAGE}.${LIBREVISION}) | ||
set_property(TARGET expat PROPERTY SOVERSION ${LIBCURRENT_MINUS_AGE}) | ||
set_property(TARGET expat PROPERTY NO_SONAME ${NO_SONAME}) | ||
endif(NOT WIN32) | ||
install(TARGETS expat RUNTIME DESTINATION bin | ||
@@ -83,2 +100,3 @@ LIBRARY DESTINATION lib | ||
add_custom_command(TARGET expat PRE_BUILD COMMAND $(MAKE) -C doc xmlwf.1) | ||
@@ -94,2 +112,3 @@ if(BUILD_tools AND NOT WINCE) | ||
add_executable(xmlwf ${xmlwf_SRCS}) | ||
set_property(TARGET xmlwf PROPERTY RUNTIME_OUTPUT_DIRECTORY xmlwf) | ||
target_link_libraries(xmlwf expat) | ||
@@ -102,5 +121,7 @@ install(TARGETS xmlwf DESTINATION bin) | ||
add_executable(elements examples/elements.c) | ||
set_property(TARGET elements PROPERTY RUNTIME_OUTPUT_DIRECTORY examples) | ||
target_link_libraries(elements expat) | ||
add_executable(outline examples/outline.c) | ||
set_property(TARGET outline PROPERTY RUNTIME_OUTPUT_DIRECTORY examples) | ||
target_link_libraries(outline expat) | ||
@@ -112,8 +133,10 @@ endif(BUILD_examples) | ||
add_executable(runtests tests/runtests.c tests/chardata.c tests/minicheck.c) | ||
set_property(TARGET runtests PROPERTY RUNTIME_OUTPUT_DIRECTORY tests) | ||
target_link_libraries(runtests expat) | ||
add_test(runtests runtests) | ||
add_test(runtests tests/runtests) | ||
add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c) | ||
set_property(TARGET runtestspp PROPERTY RUNTIME_OUTPUT_DIRECTORY tests) | ||
target_link_libraries(runtestspp expat) | ||
add_test(runtestspp runtestspp) | ||
add_test(runtestspp tests/runtestspp) | ||
endif(BUILD_tests) |
@@ -16,2 +16,2 @@ Use this benchmark command line utility as follows: | ||
The time (in seconds) it takes to parse the test file, | ||
averaged over the number of iterations. | ||
averaged over the number of iterations.@ |
@@ -19,2 +19,10 @@ | ||
can be opened and imported in VS.NET without problems. | ||
Note: Tests have their own *.dsw files. | ||
* MS Visual Studio 2013 and 2015: | ||
A solution file for Visual Studio 2013 is provided: expat.sln. | ||
The associated project files (*.vcxproj) reside in the appropriate | ||
project directories. This solution file can be opened in VS 2015 | ||
and should be upgraded automatically if VS 2013 is not also installed. | ||
Note: Tests have their own solution files. | ||
@@ -21,0 +29,0 @@ * All MS C/C++ compilers: |
{ | ||
"name": "node-expat", | ||
"version": "2.3.13", | ||
"version": "2.3.14", | ||
"main": "./lib/node-expat", | ||
@@ -18,7 +18,8 @@ "description": "NodeJS binding for fast XML parsing.", | ||
"unit": "vows --spec ./test/**/*.js", | ||
"test": "npm run unit && npm run lint" | ||
"test": "npm run unit && npm run lint", | ||
"benchmark": "node ./benchmark.js" | ||
}, | ||
"dependencies": { | ||
"bindings": "^1.2.1", | ||
"nan": "^2.2.0" | ||
"nan": "^2.2.1" | ||
}, | ||
@@ -29,11 +30,12 @@ "devDependencies": { | ||
"iconv": "^2.1.11", | ||
"libxmljs": "^0.17.0", | ||
"ltx": "^2.2.0", | ||
"libxmljs": "^0.17.1", | ||
"ltx": "^2.2.2", | ||
"node-xml": "^1.0.2", | ||
"sax": "^1.1.5", | ||
"sax": "^1.2.1", | ||
"standard": "^7.1.2", | ||
"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": { | ||
@@ -44,9 +46,2 @@ "name": "Astro", | ||
}, | ||
"maintainers": [ | ||
{ | ||
"name": "Lloyd Watkin", | ||
"email": "lloyd@evilprofessor.co.uk", | ||
"web": "http://www.evilprofessor.co.uk" | ||
} | ||
], | ||
"contributors": [ | ||
@@ -66,5 +61,18 @@ "Stephan Maka", | ||
"Julien Genestoux", | ||
"Sonny Piers" | ||
"Sonny Piers", | ||
"Lloyd Watkin", | ||
"AJ ONeal", | ||
"Rod Vagg", | ||
"Christoph Hartmann", | ||
"Corbin Uselton", | ||
"Julian Duque", | ||
"Lovell Fuller", | ||
"Antonio Bustos" | ||
], | ||
"licenses": [ | ||
{ | ||
"type": "MIT" | ||
} | ||
], | ||
"license": "MIT" | ||
} |
110
README.md
# 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/) | ||
@@ -8,9 +8,4 @@ | ||
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/)! | ||
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) | ||
## Install | ||
@@ -22,2 +17,79 @@ | ||
## 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>') | ||
}()) | ||
``` | ||
## 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 | ||
`npm run benchmark` | ||
| module | ops/sec | native | XML compliant | stream | | ||
|---------------------------------------------------------------------------------------|--------:|:------:|:-------------:|:--------------:| | ||
| [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 | ||
@@ -30,14 +102,18 @@ | ||
## Benchmark | ||
## Windows | ||
```node benchmark.js``` | ||
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. | ||
| module | ops/sec | native | XML compliant | | ||
|---------------------------------------------------------------------------------------|--------:|:------:|:-------------:| | ||
| [sax-js](https://github.com/isaacs/sax-js) | 18,641 | ☐ | ☑ | | ||
| [node-xml](https://github.com/dylang/node-xml) | 49,257 | ☐ | ☑ | | ||
| [libxmljs](https://github.com/polotek/libxmljs) | 95,169 | ☑ | ☑ | | ||
| **node-expat** | 130,776 | ☑ | ☑ | | ||
| [ltx/lib/parsers/ltx](https://github.com/node-xmpp/ltx/blob/master/lib/parsers/ltx.js)| 172,596 | ☐ | ☐ | | ||
Dependencies for `node-gyp` https://github.com/TooTallNate/node-gyp#installation | ||
Higher is better. | ||
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). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 6 instances in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
117
1
2579691
9
150
Updatednan@^2.2.1