Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

libxml.wasm

Package Overview
Dependencies
Maintainers
0
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libxml.wasm

[Demo](https://libxmlwasm.github.io/)

  • 1.0.1-develop-a0bb5ef1caf1d52d0c60e2a9a949e5f10e523f6f
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-87.72%
Maintainers
0
Weekly downloads
 
Created
Source

libxml.wasm

Demo

Installation

npm install libxml.wasm

Alternatively, you can install from GitHub Package Registry

(Optional) Build mnually

# Build also libraries
docker compose up ci
# Build only bindings
docker compose up wasm

Usage

import init from "libxml.wasm"
// or "libxml.wasm/esm", "libxml.wasm/cjs"

const libxml = await init()

const html = `
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Document</title>
</head>
<body>
  <div class="container">
    <h1 class="title">Hello world</h1>
    <p>Text</p>
  </div>
</body>
</html>
`.trim()

const doc = libxml.parseHTML(html)     // Create a document
const nodes = doc.getNode("//div/h1")  // Get a node by xpath
const h1 = nodes[0]                    // Get the first node
console.log(h1.name)                   // "h1"
console.log(h1.content)                // "Hello world"
console.log(h1.attr.class)             // "title"

Keywords

FAQs

Package last updated on 02 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc