nokogiri

Installing nokogiri Mac OS X 10.8.2 XCode installed

假装没事ソ 提交于 2019-12-20 10:52:20
问题 Trying to install nokogiri on Mountain Lion. I was using ruby 1.8.7 but just upgraded to 1.9.3 but it stopped the bundle install from working. Incidentally, I could get round this problem by uninstalling ruby 1.9.3 and reverting to 1.8.7. however this is obviously a suboptimal solution since I don't want to be stuck on 1.8.7 for the rest of time... Users-MacBook-Pro:sample_app user$ ls Gemfile app doc script Gemfile.lock config lib spec README.md config.ru log tmp Rakefile db public vendor

Rails Tutorial: nokogiri-1.5.2 error on bundle install

坚强是说给别人听的谎言 提交于 2019-12-20 10:33:45
问题 After working through the RVM setup, rspec and guard sections of chapter 3 of the Ruby on Rails Tutorial, whenever I run bundle install I get the following error dump: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from extconf.rb:5:in `<main>' Gem files

Error about nokogiri while capistrano deployment on ubuntu server

三世轮回 提交于 2019-12-20 09:49:52
问题 While bundle:install phase after deploy:finalize_update ,i'm getting an error about nokogiri. It suggests , ** [out :: *******] Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling. So i tried to install nokogiri by myself on server.But it gives following error, Building native extensions. This could take a while... ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension. /home/deployer/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb Extracting libxml2

How to install Nokogiri on Mac OS Sierra 10.12

早过忘川 提交于 2019-12-20 07:59:07
问题 I'm having troubles installing Nokogiri (1.6.8.1) on Mac OS Sierra 10.12. I tried using brew install libxml2 libxslt and then referencing the install directories using command line options but it didn't help. 回答1: Open Xcode and, from the menu XCode -> Preferences update your Command Line Tools (Xcode 8.0). Then do: bundle config build.nokogiri --use-system-libraries=true --with-xml2-include="$(xcrun --show-sdk-path)"/usr/include/libxml2 bundle install or just: gem install nokogiri -v 1.6.8.1

XPath to select between two HTML comments is not working?

一个人想着一个人 提交于 2019-12-20 07:13:35
问题 I'm trying to select some content between two HTML comments, but having some trouble getting it right (as seen in "XPath to select between two HTML comments?"). There seems to be a problem when new comments that are on the same line. My HTML: <html> ........ <!-- begin content --> <div>some text</div> <div> <p>Some more elements</p> </div> <!-- end content --><!-- begin content --> <div>more text</div> <!-- end content --> ....... </html> I use: doc.xpath("//node()[preceding-sibling::comment(

How can I make empty tags self-closing with Nokogiri?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-19 19:57:05
问题 I've created an XML template in ERB. I fill it in with data from a database during an export process. In some cases, there is a null value, in which case an element may be empty, like this: <someitem> </someitem> In that case, the client receiving the export wants it to be converted into a self-closing tag: <someitem/> I'm trying to see how to get Nokogiri to do this, but I don't see it yet. Does anybody know how to make empty XML tags self-closing with Nokogiri? Update A regex was sufficient

Remove a tag but keep the text

a 夏天 提交于 2019-12-19 11:41:29
问题 So I have this <a> tag in a xml file <a href="/www.somethinggggg.com">Something 123</a> My desired result is to use Nokogiri and completely remove its tag so it is no longer a clickable link e.g Something 123 My attempt: content = Nokogiri::XML.fragment(page_content) content.search('.//a').remove But this removes the text too. Any suggestions on how to achieve my desired result using Nokogiri? 回答1: Here is what I would do : require 'nokogiri' doc = Nokogiri::HTML.parse <<-eot <a href="/www

Is it possible to 'unload' ('un-require') a Ruby library?

最后都变了- 提交于 2019-12-19 05:18:26
问题 I'm looking to load a few libraries, have them do some work, and then do the opposite of require to avoid compatibility errors later. I don't want to have to dump to a file and restart a shell, as the objects created (such as data ) could be processed well by my other libraries, just not in the presence of the early ones I'm seeking to unload. Anyone got any suggestions or know if this is possible? A conversation from 2006 didn't come to much conclusion-wise other than that 'it looks like

How to use SAX with Nokogiri?

允我心安 提交于 2019-12-19 04:00:15
问题 I want to parse a very big file 240Mb, and have to SAX to avoid to load the file in memory. My XML looks like: <?xml version="1.0" encoding="utf-8"?> <hotels> <hotel> <hotelId>1568054</hotelId> <hotelFileName>Der_Obere_Wirt_zum_Queri</hotelFileName> <hotelName>"Der Obere Wirt" zum Queri</hotelName> <rating>3</rating> <cityId>34633</cityId> <cityFileName>Andechs</cityFileName> <cityName>Andechs</cityName> <stateId>212</stateId> <stateFileName>Bavaria</stateFileName> <stateName>Bavaria<

Nokogiri requires Ruby version < 2.3

烈酒焚心 提交于 2019-12-19 03:25:10
问题 I am trying to get Rails to work on Windows 10. I am using Ruby 2.3.0, and Rails 4.2.6, and am temporarily using Nokogiri 1.6.3. When I try running rails new demo , it returns an error: An error occurred while installing nokogiri (1.6.7.2), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.6.7.2'` succeeds before bundling. When I run gem install nokogiri -v '1.6.7.2 I get: ERROR: Error installing nokogiri: nokogiri requires Ruby version < 2.3, >= 1.9.2. How do I update