OSS TanbouSign in with GitHub

A Ruby library for parsing, querying, validating, and transforming HTML and XML documents

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
6,284
Primary language
C
License
MIT
Repository last updated
Oct 3, 2026
On this page

Overview

Nokogiri reads and writes HTML4, HTML5, and XML from Ruby and queries elements with CSS selectors or XPath. Its APIs cover DOM and SAX parsing, XSD validation, and XSLT transformation.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Process HTML and XML through several parsing models

Nokogiri provides DOM parsing for HTML4, HTML5, and XML; SAX and push parsing for XML and HTML4; CSS3 selectors; XPath 1.0; XSD validation; and XSLT transformation.

Sources: [1][5]

Best fit

Embed extraction, transformation, and validation in Ruby

It fits jobs that extract selected elements from pages, ingest XML APIs or feeds, and validate document formats. Parsing local HTML and XML strings demonstrates the core APIs without network access.

Sources: [5]

Before adoption

Test the actual Ruby and native-parser combination

Version 1.19.4 requires Ruby 3.2 or later or JRuby 10 or later, and the underlying parsers differ between CRuby and JRuby. The HTML5 API is unavailable on JRuby. The project deliberately surfaces meaningful parser differences, so validation should match the production implementation and platform.

Sources: [1]

Official sources

  1. [1]sparklemotion/nokogiri README (1.19.4)(2026-10-04)
  2. [2]sparklemotion/nokogiri GitHub repository metadata(2026-10-04)
  3. [3]sparklemotion/nokogiri license (1.19.4)(2026-10-04)
  4. [4]Nokogiri 1.19.4 release(2026-10-04)
  5. [5]Nokogiri official documentation(2026-10-04)
Supplemental curator note

Its uses extend beyond screen scraping to XML integrations, feed processing, and document validation. Treat input as untrusted and test with the same Ruby implementation, native gem, and underlying parser combination used in production.

Try it in 3 steps

  1. 1

    Check CRuby and Bundler, then add the fixed version

    Require CRuby 3.2 or later for the HTML5 API, verify Bundler, and install v1.19.4 in an isolated bundle.

    ruby -e 'abort "CRuby 3.2+ required for HTML5" unless RUBY_ENGINE=="ruby" && Gem::Version.new(RUBY_VERSION)>=Gem::Version.new("3.2")' && bundle --version && mkdir nokogiri-local && cd nokogiri-local && bundle init && bundle add nokogiri --version 1.19.4
  2. 2

    Create a local HTML and XML check

    Parse an in-memory HTML5 document with a CSS selector and XML with XPath.

    printf '%s\n' 'require "nokogiri"' 'html = Nokogiri::HTML5("<main><h1>OSS探訪</h1></main>")' 'xml = Nokogiri::XML("<items><item id=\"1\">local</item></items>") { |config| config.strict }' 'puts [html.at_css("h1").text, xml.at_xpath("//item[@id=\"1\"]").text].join(" | ")' > parse.rb
  3. 3

    Verify the parsed values

    Confirm that OSS探訪 | local is printed from the two documents.

    bundle exec ruby parse.rb
Check the official README

Growth

Growth trends · Last 30 days

6,284 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
7
Open PRs
44

Development activity is still being collected.

Built with

Categories and tags

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • ruby
  • nokogiri
  • xml
  • sax
  • ruby-gem
  • xslt
  • xerces
  • libxml2
  • libxslt
Stars
6,284
Forks
950
Watchers
150
Open issues
88
Contributors
241
Owner type
Organization
Primary language
C
License
MIT
Repository last updated
Oct 3, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?