&tag(nokogiri);
html=<<__EOM__
<html>
<head><title>デモサイト</title></head>
<body>
<h1>見出し</h1>
<div class="container">
<div class="row">行1
</div>
<div class="row">行2
</div>
</div>
</body>
</html>
__EOM__
doc = Nokogiri::HTML.parse(html, nil, 'utf-8')
p doc.title
nodesets = doc.xpath("//div[@class='row']")
p nodesets.class
p nodesets.text
p nodesets.first.class
p nodesets.first.text
$ ruby demo.rb "デモサイト" Nokogiri::XML::NodeSet "行1\n 行2\n " Nokogiri::XML::Element "行1\n "
gem install nokogiri -v '1.6.5'
checking for xmlParseDoc() in -llibxml2... no ----- libxml2 is missing. Please locate mkmf.log to investigate how it is failing. -----
Undefined symbols for architecture x86_64:
"_iconv", referenced from:
_main in conftest-a4367a.o
"_iconv_open", referenced from:
_main in conftest-a4367a.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
export NOKOGIRI_USE_SYSTEM_LIBRARIES=1
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install --path vendor/bundle/
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. }}