Nokogiri (software)

{{Short description|Software library for the Ruby programming language}}

{{Infobox software

| name = Nokogiri, an XML and HTML Parser

| logo = Nokogiri (software) logo.png

| screenshot =

| caption =

| author = Aaron Patterson, Mike Dalessio

| developer = Aaron Patterson, Mike Dalessio, Yoko Harada, Timothy Elliott, John Shahid, Akinori MUSHA

| released = {{release date|2008|10|30}}

| latest release version = 1.16.5

| latest release date = {{release date and age|2024|05|13}}{{cite web|url=https://github.com/sparklemotion/nokogiri/releases|title=Releases - sparklemotion/nokogiri|via=GitHub|accessdate=18 May 2024}}

| latest preview version = 1.16.0.rc1

| latest preview date = {{release date and age|2023|12|13}}

| operating system = Linux, FreeBSD, OpenBSD, Windows, macOS

| platform = Cross-platform

| language = Ruby, Java

| genre = Parser

| license = MIT License{{cite web |title=LICENSE |url=https://github.com/sparklemotion/nokogiri/blob/master/LICENSE.md |website=Github |accessdate=5 September 2019}}

}}

Nokogiri is an open source software library to parse HTML and XML in Ruby.{{cite book|author=Peter Cooper|title=Beginning Ruby: From Novice to Professional|url=https://books.google.com/books?id=A78bYfzYKZ4C&pg=PA528|accessdate=15 May 2011|date=20 July 2009|publisher=Apress|isbn=978-1-4302-2363-4|pages=528–529}}{{cite book|author1=Chad Pytel|author2=Tammer Saleh|title=Rails AntiPatterns: Best Practice Ruby on Rails Refactoring|url=https://books.google.com/books?id=i6mZ0HBDPzsC&pg=PA199|accessdate=15 May 2011|date=9 November 2010|publisher=Addison-Wesley|isbn=978-0-321-60481-1|page=199}}{{cite book|author=Mark Watson|title=Scripting Intelligence: Web 3.0 Information, Gathering and Processing|url=https://books.google.com/books?id=ElSxSLsc3M0C&pg=PA22|accessdate=15 May 2011|year=2009|publisher=Springer|isbn=978-1-4302-2351-1|page=22}}{{Cite web|title = Tutorials - Nokogiri 鋸|url = http://www.nokogiri.org/|website = www.nokogiri.org|access-date = 2016-02-04|first = Team|last = Sparklemotion}} It depends on libxml2 and libxslt to provide its functionality.{{cite web|url=https://github.com/sparklemotion/nokogiri/blob/master/README.md|title=Nokogiri (README.md)|via=GitHub|accessdate=22 November 2018}}

Overview

It markets itself as providing a sensible, easy-to-understand API for reading, writing, modifying, and querying documents. It is available for ruby as well as Java through JRuby.

It provides fast and standards-compliant parser by relying on native parsers like libxml2 (CRuby) and xerces (JRuby).

It is one of the most downloaded Ruby gems, having been downloaded over 700 million times from the rubygems.org repository.{{Cite web|title=nokogiri|url=https://rubygems.org/gems/nokogiri|access-date=26 December 2023|website=RubyGems repository}}

Features

  • DOM Parser for XML, HTML4, and HTML5
  • SAX Parser for XML and HTML4
  • Push Parser for XML and HTML4
  • Document search via XPath 1.0
  • Document search via CSS3 selectors
  • XSD Schema validation
  • XSLT transformation
  • XML and HTML Builder

Enterprise support is available through tidelift,{{cite web| title=nokogiri rubygems via the Tidelift Subscription| url=https://tidelift.com/subscription/pkg/rubygems-nokogiri| website=tidelift| access-date=3 February 2022 }} a paid subscription model, offering commercial support for open source applications.

References

{{Reflist}}