sax-js | A sax style parser for JS | Parser library
kandi X-RAY | sax-js Summary
kandi X-RAY | sax-js Summary
A sax-style parser for XML and HTML. Designed with node in mind, but should work fine in the browser or other CommonJS implementations.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Read a chunk .
sax-js Key Features
sax-js Examples and Code Snippets
"dependencies": {
"benchmark": "~1.0.0",
"dr-sax": "~1.0.7",
"hammerdown": "0.0.18",
"html-md": "~3.0.2",
"html2markdown": "~1.1.0",
"pdc": "~0.1.2",
"to-markdown": "0.0.2",
"unmarked": "0.0.12",
"upndown": "~0.0.7"
}
> dr-sax-b
$ git clone https://github.com/matteodelabre/saxophone.git
$ cd saxophone
$ npm install
$ npm install --no-save easysax node-expat libxmljs sax
$ npm run benchmark
var sax = require('../lib/sax'),
printer = sax.createStream(false, {lowercasetags: true, trim: true}),
fs = require('fs')
function entity (str) {
return str.replace('"', '"')
}
printer.tabstop = 2
printer.level = 0
printer.indent = function (
// pull out /GeneralSearchResponse/categories/category/items/product tags
// the rest we don't care about.
var sax = require('../lib/sax.js')
var fs = require('fs')
var path = require('path')
var xmlFile = path.resolve(__dirname, 'shopping.xml')
var
var fs = require('fs'),
util = require('util'),
path = require('path'),
xml = fs.readFileSync(path.join(__dirname, 'test.xml'), 'utf8'),
sax = require('../lib/sax'),
strict = sax.parser(true),
loose = sax.parser(false, {trim: true}),
in
Community Discussions
Trending Discussions on sax-js
QUESTION
Here's my source tree at the exact moment of the problem:
https://github.com/lucaszanella/jscam/tree/cf29b3cc90df7c5c7bb2d27c2205264d52b0715d/src/jscam
I believe npm install
, npm start
and npm run android
will make it launch (note that onvif is not installed from npm but cloned in npm post-install
script and then installed, but it gets installed in node_modules
with a symlink to the place where it cloned. I even tried to put everything in node_modules
just in case, but the error persists). Also don't mind the extra docker things I have in the folder
Anyways, the problem is:
I'm trying to use the nodejs module onvif in React Native, so I used this technique to translate the require methods using babel and installed browserfy modules to implement the core nodejs modules. I've tested with simple examples like crypto and it worked. However, when I try to simply import the onvif module I get this:
Here's device.js line 30, looks like Cam
is undefined here
When I import the onvif.js
which imports cam.js
, nothing happens. But then it imports device.js
which seems to be getting undefined when importing cam.js
again
I also tried this method which seems to avoid all the babel translation but surprisingly the problem persists.
UPDATE:
Here's the new source tree: https://github.com/lucaszanella/jscam/tree/98b714219ed25b9d91ea3af275177f66fdb74fa2/src/jscam
I'm now using extraNodeModules which is the official way to do. You can see my dependencies here: https://github.com/lucaszanella/jscam/blob/98b714219ed25b9d91ea3af275177f66fdb74fa2/src/jscam/rn-cli.config.js
It's on this line: https://github.com/isaacs/sax-js/blob/d65e3bb5049893aaab4aba05198b9cd335b5a1ad/lib/sax.js#L222
It still looks like the same type of error though
Update: if you get dgram not found, try
...ANSWER
Answered 2018-Apr-12 at 08:12So there are three issues I found
react-native-dgram-shim
needs to be copied asdgram
innode_modules
stream: require.resolve('stream-browserify')
needs to be used inrn-cli.config.js
. The stream module you had used didn't seems to defineStream
object andStream.prototype
access caused an error- The
onvif
module hascam -> device -> cam
, this is handled well inbrowserify
,webpack
andnodejs
. But themetro
packer thatreact-native
seems not like the cyclic imported. It means therequire.js
of the same needs to be fixed or the cyclic dependency needs to be removed
So you either make a fix to the require.js
polyfill at jscam/src/jscam/node_modules/metro/src/lib/polyfills/require.js
or you change your files to remove cyclic imports by passing the required objects like below
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sax-js
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page