Code Monkey home page Code Monkey logo

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's Projects

libxmljs doesnโ€™t have any public repositories yet.

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.