Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

NodeJS bindings for libxml2 written in Typescript

License

NotificationsYou must be signed in to change notification settings

libxmljs/libxmljs

Repository files navigation

npm versionDownloads monthlyDownloads totalTest & Upload

npm install libxmljs

NodeJS bindings forlibxml2 written inTypescript

Documentation

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

Examples

For more examples, check out thetest suite.

importlibxmljsfrom"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)=>{constgchild=xmlDoc.find("//grandchild")[0];console.log(gchild.text());// prints "grandchild content"constchild=xmlDoc.root()?.child(0);console.log(child?.getAttribute("foo")?.value());// prints "bar"});

Package Scripts

npm run init-submodules

Clones libxml2 source code tovendor/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 newsrc/libxml2.cc andswig.xml file by processing the native code using SWIG. Used when making changesto 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-generatesconstants.ts,functions.ts,types.ts, andvariables.ts withinlib/bindings/

npm run tsc

Compiles Typescript withinlib/ and outputs it todist/ Usenpm run dev to put Typescript compiler into watchmode.

npm run test

Runs all tests intest/ using nodeunit. Usenpm run test -- -t TEST_NAME to run a specific test.

npm run docs

Generatesdocs/ using Typedoc


[8]ページ先頭

©2009-2026 Movatter.jp