Ruby 的 XML/HTML 解析器 Oga

码农软件 · 软件分类 · HTML解析器 · 2019-04-02 17:41:24

软件介绍

Oga 是一个 Ruby 的 XML/HTML 解析器。

示例代码1:

require 'oga'
require 'net/http'

body     = Net::HTTP.get(URI.parse('http://www.reddit.com/'))
document = Oga.parse_html(body)
titles   = document.xpath('//div[contains(@class, "entry")]/p[@class="title"]/a/text()')

titles.each do |title|
  puts title.text
end

示例代码2:

Oga.parse_xml('<people>foo</people>', :strict => true) # works fine
Oga.parse_xml('<people>foo', :strict => true)          # throws an error

本文地址:https://codercto.com/soft/d/2714.html

Web ReDesign 2.0

Web ReDesign 2.0

Kelly Goto、Emily Cotler / Peachpit Press / 2004-12-10 / USD 45.00

If anything, this volume's premise--that the business of Web design is one of constant change-has only proven truer over time. So much so, in fact, that the 12-month design cycles cited in the last ed......一起来看看 《Web ReDesign 2.0》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具