Giter VIP home page Giter VIP logo

libxmljs-dom's Introduction

libxmljs

npm version Downloads monthly Downloads total Test & Upload

npm install libxmljs

NodeJS bindings for libxml2 written in Typescript

Documentation

https://libxmljs.github.io/libxmljs/

Examples

For more examples, check out the test suite.

import libxmljs from "libxmljs";

libxmljs
    .parseXmlAsync(
        `
        <?xml version="1.0" encoding="UTF-8"?>
        <root>
            <child foo="bar">
            <grandchild baz="fizbuzz">grandchild content</grandchild>
            </child>
            <sibling>with content!</sibling>
        </root>
        `
    )
    .then((xmlDoc) => {
        const gchild = xmlDoc.find("//grandchild")[0];

        console.log(gchild.text()); // prints "grandchild content"

        const child = xmlDoc.root()?.child(0);

        console.log(child?.getAttribute("foo")?.value()); // prints "bar"
    });

Package Scripts

npm run init-submodules

Clones libxml2 source code to vendor/libxml2

npm run configure

Generate new cmake config headers with cmake in vendor/libxml2.config. Used when updating to a new libxml2 version.

npm run build

Build the C++ source code using node-gyp

npm run swig

Generate a new src/libxml2.cc and swig.xml file by processing the native code using SWIG. Used when making changes to native code or any of the SWIG interface files (src/*.i)

npm run tsgenerate

Generates typescript definitons for native bindings exports. Used when changes are made to native exports. Auto-generates constants.ts, functions.ts, types.ts, and variables.ts within lib/bindings/

npm run tsc

Compiles Typescript within lib/ and outputs it to dist/ Use npm run dev to put Typescript compiler into watch mode.

npm run test

Runs all tests in test/ using nodeunit. Use npm run test -- -t TEST_NAME to run a specific test.

npm run docs

Generates docs/ using Typedoc

libxmljs-dom's People

Contributors

croqaz avatar ejhayes avatar modiohealthadmin avatar rchipka avatar samogot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

libxmljs-dom's Issues

Can not install package 404 error

I get an error when I try to install.

Looks like it's trying to download a file that doesn't exist.

node-pre-gyp http GET https://github.com/libxmljs/libxmljs/releases/download/v0.18.7/node-v64-darwin-x64.tar.gz
node-pre-gyp http 404 https://github.com/libxmljs/libxmljs/releases/download/v0.18.7/node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download(404): https://github.com/libxmljs/libxmljs/releases/download/v0.18.7/node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://github.com/libxmljs/libxmljs/releases/download/v0.18.7/node-v64-darwin-x64.tar.gz

Not Multi-thread safe

The libxmljs library is not multithread safe and as such this cannot be used in anything other than the main thread.

I want to use a package which depends on this library, but I cannot make it run in a worker thread which I am trying to do so it doesn't block the rest of the event handlers.

Any chance this can be updated to include libxmljs-mt which is supposed to be multi-thread safe?

Release v0.0.11

Latest version available on https://www.npmjs.com/package/libxmljs-dom is 0.0.10, whereas latest osmosis NPM package which depends on this package requires v0.0.11 (as per rchipka/node-osmosis@2ac8b8d).

This is causing following issue.

npm ERR! code ETARGET
npm ERR! notarget No matching version found for libxmljs-dom@~0.0.11
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'osmosis'
npm ERR! notarget

Missing libxmljs reference

Hi,
if i try:
npm i libxmljs-dom --save

I catch the error:

node-pre-gyp http GET https://github.com/libxmljs/libxmljs/releases/download/v0.18.9-pre0/node-v64-win32-x64.tar.gz
node-pre-gyp http 404 https://github.com/libxmljs/libxmljs/releases/download/v0.18.9-pre0/node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Tried to download(404): https://github.com/libxmljs/libxmljs/releases/download/v0.18.9-pre0/node-v64-win32-x64.tar.gz

The libxmljs version v0.18.9-pre0 is unavailable.
The new version v0.19.0 as been released.

needle v2.4.0 issue

If use [email protected] will get the error.

Error: Invalid property for defaults:compressed
    at Function.module.exports.defaults (D:\tmp\n0use-api-heroku-nodejs\node_modules\needle\lib\needle.js:776:13)
    at Object.<anonymous> (D:\tmp\n0use-api-heroku-nodejs\node_modules\libxmljs-dom\lib\HttpRequest.js:5:8)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (D:\tmp\n0use-api-heroku-nodejs\node_modules\libxmljs-dom\lib\Window.js:8:22)

I try to change needle to v2.3.0 and work fine.

Update jQuery to 2.2.x

Hi.

I made a custom jQuery build on "2.2-stable" branch with:

grunt custom:-ajax,-css,-deprecated

I tested the jQuery-v2.2.4 build, in "lib/jquery.js" and everything works.

I want to make a PR and submit this update, is that OK ?

I want to use this library, but it needs a bit of love :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.