From aaron at tenderlovemaking.com Sun Jun 7 19:03:00 2009 From: aaron at tenderlovemaking.com (Aaron Patterson) Date: Sun, 7 Jun 2009 16:03:00 -0700 Subject: [Nokogiri-talk] [ANN] nokogiri 1.3.1 Released Message-ID: <20090607230300.GB34188@Jordan2.local> nokogiri version 1.3.1 has been released! * * * * * Nokogiri (?) is an HTML, XML, SAX, and Reader parser. Among Nokogiri's many features is the ability to search documents via XPath or CSS3 selectors. XML is like violence - if it doesn?t solve your problems, you are not using enough of it. ## SUPPORT: The Nokogiri mailing list is available here: * http://rubyforge.org/mailman/listinfo/nokogiri-talk The bug tracker is available here: * http://github.com/tenderlove/nokogiri/issues The IRC channel is #nokogiri on freenode. ## SYNOPSIS: require 'nokogiri' require 'open-uri' # Get a Nokogiri::HTML:Document for the page we?re interested in... doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove')) # Do funky things with it using Nokogiri::XML::Node methods... #### # Search for nodes by css doc.css('h3.r a.l').each do |link| puts link.content end #### # Search for nodes by xpath doc.xpath('//h3/a[@class="l"]').each do |link| puts link.content end #### # Or mix and match. doc.search('h3.r a.l', '//h3/a[@class="l"]').each do |link| puts link.content end ## REQUIREMENTS: * ruby 1.8 or 1.9 * libxml2 * libxml2-dev * libxslt * libxslt-dev ## INSTALL: * sudo gem install nokogiri Changes: ### 1.3.1 / 2009-06-07 * Bugfixes * extconf.rb checks for optional RelaxNG and Schema functions * Namespace nodes are added to the Document node cache * * * * * -- Aaron Patterson http://tenderlovemaking.com/ From joe at joetify.com Tue Jun 9 21:17:40 2009 From: joe at joetify.com (Joe Williams) Date: Tue, 9 Jun 2009 18:17:40 -0700 Subject: [Nokogiri-talk] parsing html with tabs Message-ID: <20090609181740.3c218afe@der-dieb> I have some html that looks like the following.
jeos-8.04.1-jeos-i386.iso
01-Jul-2008 04:59           104361984 ubuntu-8.10-desktop-amd64.iso
14-Nov-2008 14:53           732989440 
A basic directory listing with links to the files, timestamp and size. I did the following to get the file names: doc.search('a').map { |link| link['href'] } But I also need to get the size which is essentially in the third column. How would I go about doing this in nokogiri? Any/all advice would be appreciated. Thanks! -Joe -- Name: Joseph A. Williams Email: joe at joetify.com Blog: http://www.joeandmotorboat.com/ From mike.tracy at gmail.com Tue Jun 9 23:12:23 2009 From: mike.tracy at gmail.com (Mike Tracy) Date: Tue, 9 Jun 2009 22:12:23 -0500 Subject: [Nokogiri-talk] parsing html with tabs In-Reply-To: <20090609181740.3c218afe@der-dieb> References: <20090609181740.3c218afe@der-dieb> Message-ID: <3dd5da120906092012h62f72c71icd74a4fcf4f92af0@mail.gmail.com> use .next_sibling something like: irb(main):015:0> doc.search('a').map { |l| [ l['href'],l.next_sibling.to_s.split(" ")[-1] ] } => [["jeos-8.04.1-jeos-i386.iso", "104361984"], ["ubuntu-8.10-desktop-amd64.iso", "732989440"]] -mt On Tue, Jun 9, 2009 at 8:17 PM, Joe Williams wrote: > > > I have some html that looks like the following. > >
> jeos-8.04.1-jeos-i386.iso
> 01-Jul-2008 04:59 ? ? ? ? ? 104361984  href="ubuntu-8.10-desktop-amd64.iso">ubuntu-8.10-desktop-amd64.iso
> 14-Nov-2008 14:53 ? ? ? ? ? 732989440
> 
> > A basic directory listing with links to the files, timestamp and > size. I did the following to get the file names: > > doc.search('a').map { |link| link['href'] } > > But I also need to get the size which is essentially in the third > column. How would I go about doing this in nokogiri? Any/all advice > would be appreciated. > > Thanks! > > -Joe > > > -- > Name: Joseph A. Williams > Email: joe at joetify.com > Blog: http://www.joeandmotorboat.com/ > _______________________________________________ > Nokogiri-talk mailing list > Nokogiri-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/nokogiri-talk > From joe at joetify.com Wed Jun 10 01:28:24 2009 From: joe at joetify.com (Joe Williams) Date: Tue, 9 Jun 2009 22:28:24 -0700 Subject: [Nokogiri-talk] parsing html with tabs In-Reply-To: <3dd5da120906092012h62f72c71icd74a4fcf4f92af0@mail.gmail.com> References: <20090609181740.3c218afe@der-dieb> <3dd5da120906092012h62f72c71icd74a4fcf4f92af0@mail.gmail.com> Message-ID: <20090609222824.1db11d69@der-dieb> Thanks guys, both solutions worked well. -Joe On Tue, 9 Jun 2009 22:12:23 -0500 Mike Tracy wrote: > use .next_sibling something like: > > irb(main):015:0> doc.search('a').map { |l| [ > l['href'],l.next_sibling.to_s.split(" ")[-1] ] } > => [["jeos-8.04.1-jeos-i386.iso", "104361984"], > ["ubuntu-8.10-desktop-amd64.iso", "732989440"]] > > -mt > > On Tue, Jun 9, 2009 at 8:17 PM, Joe Williams wrote: > > > > > > I have some html that looks like the following. > > > >
> > jeos-8.04.1-jeos-i386.iso
> > 01-Jul-2008 04:59 ? ? ? ? ? 104361984  > href="ubuntu-8.10-desktop-amd64.iso">ubuntu-8.10-desktop-amd64.iso
> > 14-Nov-2008 14:53 ? ? ? ? ? 732989440
> > 
> > > > A basic directory listing with links to the files, timestamp and > > size. I did the following to get the file names: > > > > doc.search('a').map { |link| link['href'] } > > > > But I also need to get the size which is essentially in the third > > column. How would I go about doing this in nokogiri? Any/all advice > > would be appreciated. > > > > Thanks! > > > > -Joe > > > > > > -- > > Name: Joseph A. Williams > > Email: joe at joetify.com > > Blog: http://www.joeandmotorboat.com/ > > _______________________________________________ > > Nokogiri-talk mailing list > > Nokogiri-talk at rubyforge.org > > http://rubyforge.org/mailman/listinfo/nokogiri-talk > > > _______________________________________________ > Nokogiri-talk mailing list > Nokogiri-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/nokogiri-talk -- Name: Joseph A. Williams Email: joe at joetify.com Blog: http://www.joeandmotorboat.com/ From vamlists at gmail.com Thu Jun 11 19:40:56 2009 From: vamlists at gmail.com (Vamsee Kanakala) Date: Fri, 12 Jun 2009 05:10:56 +0530 Subject: [Nokogiri-talk] style, script and comments getting scrubbed in before/after Message-ID: <4A319608.2080601@gmail.com> Hi, I'm trying to add a chunk of html to the beginning/end of a node with before/after methods in Node or NodeSet any style,script tags are scrubbed of their contents, though attributes are still available. Also, I noticed that html comments are also ignored. Something like this: |doc.xpath("//head/*[1]").before("") And I try to display it, this is what I get: ||hdoc.xpath("//head/*[1]") => | Am I missing something? Thanks, Vamsee. From aaron.patterson at gmail.com Sat Jun 13 16:31:21 2009 From: aaron.patterson at gmail.com (Aaron Patterson) Date: Sat, 13 Jun 2009 13:31:21 -0700 Subject: [Nokogiri-talk] Trouble with xpath In-Reply-To: <42dc968d0906131301v61a5e149pa8abd6c10f4f5a1@mail.gmail.com> References: <42dc968d0906131301v61a5e149pa8abd6c10f4f5a1@mail.gmail.com> Message-ID: <6959e1680906131331p5e6514dek8720480c4d8b1cf5@mail.gmail.com> Hi Alf, On Sat, Jun 13, 2009 at 1:01 PM, Alf Mikula wrote: > Sorry if this email goes through twice...the first email I sent was before I > confirmed my email on the list, so it's probably stuck in moderation. > > I'm having trouble getting xpath queries to work...I'm not sure what I'm > doing wrong.? I'd appreciate any pointers. > > I'm parsing the XML file like this: > ? ? doc = > Nokogiri::XML.parse(open('http://www.britgo.org/clublist/clublist.xml')) > > ...then trying to query like this: > ? ? doc.xpath('//club') > > That gives me no results...yet css selectors soom to work fine: > ??? doc.css('club').length? # => 80 > > > Am I doing something wrong?? I can't seem to find much information or > examples with nokogiri and xpath... Your xml file probably has a default namespace declared in the root node. When you're using XPath queries, you *must* specify the namespace. The same is not true for css selectors. CSS selectors will add the namespace for you. Try comparing this: doc.xpath('//xmlns:club') to this: doc.css('club') Hope that helps. -- Aaron Patterson http://tenderlovemaking.com/ From aaron.patterson at gmail.com Sat Jun 13 19:45:24 2009 From: aaron.patterson at gmail.com (Aaron Patterson) Date: Sat, 13 Jun 2009 16:45:24 -0700 Subject: [Nokogiri-talk] move to google groups Message-ID: <6959e1680906131645l321af42ax852227f0c1fdddfd@mail.gmail.com> I've been thinking about moving this list to google groups. Does anyone have any thoughts, opinions, objections, or the opposite of objections? -- Aaron Patterson http://tenderlovemaking.com/ From sprsquish at gmail.com Sat Jun 13 21:55:46 2009 From: sprsquish at gmail.com (Jeff Smick) Date: Sat, 13 Jun 2009 18:55:46 -0700 Subject: [Nokogiri-talk] move to google groups In-Reply-To: <6959e1680906131645l321af42ax852227f0c1fdddfd@mail.gmail.com> References: <6959e1680906131645l321af42ax852227f0c1fdddfd@mail.gmail.com> Message-ID: <669ac2d0906131855k3bdb2d04mb76750fba5c89cb@mail.gmail.com> +1 for opposite of objection On Sat, Jun 13, 2009 at 4:45 PM, Aaron Patterson wrote: > I've been thinking about moving this list to google groups. > > Does anyone have any thoughts, opinions, objections, or the opposite > of objections? > > -- > Aaron Patterson > http://tenderlovemaking.com/ > _______________________________________________ > Nokogiri-talk mailing list > Nokogiri-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/nokogiri-talk > From jeff at somethingsimilar.com Sat Jun 13 23:22:30 2009 From: jeff at somethingsimilar.com (Jeff Hodges) Date: Sat, 13 Jun 2009 20:22:30 -0700 Subject: [Nokogiri-talk] move to google groups In-Reply-To: <6959e1680906131645l321af42ax852227f0c1fdddfd@mail.gmail.com> References: <6959e1680906131645l321af42ax852227f0c1fdddfd@mail.gmail.com> Message-ID: I'm down. On Sat, Jun 13, 2009 at 4:45 PM, Aaron Patterson wrote: > I've been thinking about moving this list to google groups. > > Does anyone have any thoughts, opinions, objections, or the opposite > of objections? > > -- > Aaron Patterson > http://tenderlovemaking.com/ > _______________________________________________ > Nokogiri-talk mailing list > Nokogiri-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/nokogiri-talk > From jeff at somethingsimilar.com Sat Jun 13 23:22:46 2009 From: jeff at somethingsimilar.com (Jeff Hodges) Date: Sat, 13 Jun 2009 20:22:46 -0700 Subject: [Nokogiri-talk] move to google groups In-Reply-To: References: <6959e1680906131645l321af42ax852227f0c1fdddfd@mail.gmail.com> Message-ID: Er, meaning that's fine. On Sat, Jun 13, 2009 at 8:22 PM, Jeff Hodges wrote: > I'm down. > > On Sat, Jun 13, 2009 at 4:45 PM, Aaron > Patterson wrote: >> I've been thinking about moving this list to google groups. >> >> Does anyone have any thoughts, opinions, objections, or the opposite >> of objections? >> >> -- >> Aaron Patterson >> http://tenderlovemaking.com/ >> _______________________________________________ >> Nokogiri-talk mailing list >> Nokogiri-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/nokogiri-talk >> > From m.zecko at gmail.com Sun Jun 14 17:50:24 2009 From: m.zecko at gmail.com (m.zeckinger) Date: Sun, 14 Jun 2009 23:50:24 +0200 Subject: [Nokogiri-talk] writing attributes to a nokogiri doc Message-ID: <8be6656c0906141450r6d72660avba65f21ddf0f3a03@mail.gmail.com> hi list, i have a question on how to actually write attributes to nodes with nokogiri. i found a way on how this was done in hpricot http://seancribbs.com/tech/2008/05/19/modifying-attributes-with-hpricot/ what would be the nokogiri way of doing this? especially how to alter and re-read the doc? thanks! mz From vamlists at gmail.com Mon Jun 15 03:51:16 2009 From: vamlists at gmail.com (Vamsee Kanakala) Date: Mon, 15 Jun 2009 13:21:16 +0530 Subject: [Nokogiri-talk] [*bump*] Node/NodeSet.before/after cleaning out script, style tags Message-ID: <4A35FD74.4000504@gmail.com> Hi, I reported this issue on GitHub, and also asked on this list and even on stackoverflow. I didn't even get one reply. I'm mystified by the silence. Can anybody answer me why Node and NodeSet.before and after are cleaning out all the content within script and style tags in the supplied raw html? Also, the supplied html doesn't get processed properly if it has html comments embedded in it. Thanks, Vamsee. From vamlists at gmail.com Mon Jun 15 11:08:39 2009 From: vamlists at gmail.com (Vamsee Kanakala) Date: Mon, 15 Jun 2009 20:38:39 +0530 Subject: [Nokogiri-talk] [*bump*] Node/NodeSet.before/after cleaning out script, style tags In-Reply-To: <618c07250906150659h22eeb4ddv55734516005b12e@mail.gmail.com> References: <4A35FD74.4000504@gmail.com> <618c07250906150659h22eeb4ddv55734516005b12e@mail.gmail.com> Message-ID: <4A3663F7.9050001@gmail.com> Mike Dalessio wrote: > This has been fixed in master. Will be in the next release. > Thanks Mike, I appreciate your spending time on it. Sorry for being a nag. Vamsee. From byrnejb at harte-lyne.ca Mon Jun 15 11:30:25 2009 From: byrnejb at harte-lyne.ca (James B. Byrne) Date: Mon, 15 Jun 2009 11:30:25 -0400 (EDT) Subject: [Nokogiri-talk] Parsing an HTML document In-Reply-To: <618c07250906141954h19f64434k7d7839751baca94e@mail.gmail.com> References: <8be6656c0906141450r6d72660avba65f21ddf0f3a03@mail.gmail.com> <618c07250906141954h19f64434k7d7839751baca94e@mail.gmail.com> Message-ID: <52555.216.185.71.24.1245079825.squirrel@webmail.harte-lyne.ca> I have been reading about xpath and xml and I have a small amount of experience with it. However, I clearly lack sufficient exposure and experience with xml to discover the answer to my questions on my own so I would appreciate any help that this list can provide. I am testing a Rails project and I wish to extract from a displayed page the contents of a set of particular td cells in a row. The page layout, abbreviated, looks somewhat like this: ...... ... USD ... ... that gives me the document body next I load the table as a node t = doc.at('table') => ... this seems to work as I imagine I have looked at the #traverse method and I suppose nesting the the rows something starting like this might produce something useful t.traverse do |r| ... But at this point I have no clue as to how to process the rows so as to obtain those containing cells whose class matches the requirements. Once I have these then, assuming that c contains the requisite td node then c.text should give me the data. But getting them seems to hinge on the value of the class attributes. On the other hand, I greatly fear that I am totally blind to a more direct way of accomplishing the same thing. At the moment, my only requirement for xml is to assist in testing. I can brute force this into a form that I can test using other means but i would very much like to use this opportunity to discover how this is supposed to work. If I am asking too basic a question for this list then I would appreciate a reference to an online group that can walk me through this. I pretty sure that this sort of processing is not very sophisticated and that it is my ignorance that is the problem. -- *** E-Mail is NOT a SECURE channel *** James B. Byrne mailto:ByrneJB at Harte-Lyne.ca Harte & Lyne Limited http://www.harte-lyne.ca 9 Brockley Drive vox: +1 905 561 1241 Hamilton, Ontario fax: +1 905 561 0757 Canada L8E 3C3 From aaron.patterson at gmail.com Mon Jun 15 12:19:38 2009 From: aaron.patterson at gmail.com (Aaron Patterson) Date: Mon, 15 Jun 2009 09:19:38 -0700 Subject: [Nokogiri-talk] Parsing an HTML document In-Reply-To: <52555.216.185.71.24.1245079825.squirrel@webmail.harte-lyne.ca> References: <8be6656c0906141450r6d72660avba65f21ddf0f3a03@mail.gmail.com> <618c07250906141954h19f64434k7d7839751baca94e@mail.gmail.com> <52555.216.185.71.24.1245079825.squirrel@webmail.harte-lyne.ca> Message-ID: <6959e1680906150919h47ee4faer70da0822cb876a4@mail.gmail.com> On Mon, Jun 15, 2009 at 8:30 AM, James B. Byrne wrote: > I have been reading about xpath and xml and I have a small amount of > experience with it. ?However, I clearly lack sufficient exposure and > experience with xml to discover the answer to my questions on my own > so I would appreciate any help that this list can provide. > > I am testing a Rails project and I wish to extract from a displayed > page the contents of a set of particular td cells in a row. ?The > page layout, abbreviated, looks somewhat like this: > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > > ?
2009-04-01 CABC
> ?... > ?... > ? > ? ? > ? ?... > ? ?USD > ? ? ? > ? ? ? > ? ? ?... > ? ? > I am trying to thread my way through nokogiri's documentation to see > how I parse this. ?What I wish to do is to check the .text of each > tr node that contains td nodes with class attributes set to > 'currency_quote', 'effective_date', and 'source', obtain the text > values associated with each and decide from that combination whether > this row needs to be considered further. Okay. We can translate what you just said in to an XPath query. What you're asking for is more difficult with CSS than with XPath, so we'll stick with XPath for this one. You want all tr nodes, so start off with this path for selecting all tr nodes: //tr But you need it to have a td child: //tr[td] Further, you need that td child to have a class attribute equal to "currency_quote": //tr[td[@class = "currency_quote"]] Finally, you actually need three td children to exist each with different class attributes (I've broken this one up on to several lines for readability): //tr[ td[@class = "currency_quote"] and td[@class = "effective_date"] and td[@class = "source"] ] Just feed that in to Nokogiri's xpath method, and you should have the tr tags you're looking for: doc = Nokogiri::HTML DATA.read tr_tags = doc.xpath(<<-eoxpath) //tr[ td[@class = "currency_quote"] and td[@class = "effective_date"] and td[@class = "source"] ] eoxpath tr_tags.each { |tr| .... } You can find pretty much anything in your tree using xpath or css. Most of my traversal through XML/HTML trees is via XPath or CSS. I would suggest reading up on XPath here: http://www.w3schools.com/Xpath/default.asp http://www.w3.org/TR/xpath Hope that helps! -- Aaron Patterson http://tenderlovemaking.com/ From aaron.patterson at gmail.com Mon Jun 15 12:21:50 2009 From: aaron.patterson at gmail.com (Aaron Patterson) Date: Mon, 15 Jun 2009 09:21:50 -0700 Subject: [Nokogiri-talk] move to google groups In-Reply-To: References: <6959e1680906131645l321af42ax852227f0c1fdddfd@mail.gmail.com> Message-ID: <6959e1680906150921j710051ccgc81304da9e77e2f1@mail.gmail.com> This is enough plus ones for me. I will migrate the email addresses from the rubyforge list to the google groups list. Once I'm done updating everything, I'll email this list with the announcement. On Sun, Jun 14, 2009 at 6:45 PM, Antel wrote: > as actual users it will not hurt, but new users will have easier time to > come and register here, also google is a little(<.<) more reliable than > rubyforge, so do it, send a final message about the change with the > instructions > > _______________________________________________ > Nokogiri-talk mailing list > Nokogiri-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/nokogiri-talk > > -- Aaron Patterson http://tenderlovemaking.com/ From transfire at gmail.com Mon Jun 15 12:54:08 2009 From: transfire at gmail.com (Trans) Date: Mon, 15 Jun 2009 12:54:08 -0400 Subject: [Nokogiri-talk] Replace Node w/ Children Message-ID: <4b6f054f0906150954q4d6c1397g606c2660ef3ef735@mail.gmail.com> How would I replace a node with it's children? node.replace(node.children) does not work. In other words I need to "unwrap a node", eg. if I wanted to unwrap in: "C" I'd get: "C" Thanks, T. From aaron.patterson at gmail.com Mon Jun 15 13:28:22 2009 From: aaron.patterson at gmail.com (Aaron Patterson) Date: Mon, 15 Jun 2009 10:28:22 -0700 Subject: [Nokogiri-talk] Replace Node w/ Children In-Reply-To: <4b6f054f0906150954q4d6c1397g606c2660ef3ef735@mail.gmail.com> References: <4b6f054f0906150954q4d6c1397g606c2660ef3ef735@mail.gmail.com> Message-ID: <6959e1680906151028g57a3be91t590f598ba624ac9f@mail.gmail.com> On Mon, Jun 15, 2009 at 9:54 AM, Trans wrote: > How would I replace a node with it's children? > > ?node.replace(node.children) > > does not work. > > In other words I need to "unwrap a node", eg. if I wanted to unwrap in: > > ?"C" > > I'd get: > > ?"C" > > Thanks, I would do this: require 'nokogiri' doc = Nokogiri.XML(DATA.read) { |cfg| cfg.noblanks } node = doc.at('b') node.children.each do |child| node.parent << child end node.remove puts doc __END__ C Hope that helps! -- Aaron Patterson http://tenderlovemaking.com/ From aaron.patterson at gmail.com Mon Jun 15 13:57:12 2009 From: aaron.patterson at gmail.com (Aaron Patterson) Date: Mon, 15 Jun 2009 10:57:12 -0700 Subject: [Nokogiri-talk] Running/installing gem on 64 bit OSX 10.6 In-Reply-To: <6ffb72010906151024u1c3150ccv3722e3356e41522b@mail.gmail.com> References: <6ffb72010906151024u1c3150ccv3722e3356e41522b@mail.gmail.com> Message-ID: <6959e1680906151057x44316a74x266c1cc615be1c20@mail.gmail.com> On Mon, Jun 15, 2009 at 10:24 AM, Ben Lovell wrote: > Hey, > I've gem installed nokogiri on OS X 10.6 (64bit) and I get the following > message in irb when trying to require: >>> require "nokogiri" > LoadError: > dlopen(/Library/Ruby/Gems/1.8/gems/nokogiri-1.3.1/lib/nokogiri/nokogiri.bundle, > 9): no suitable image found. ?Did find: > /Library/Ruby/Gems/1.8/gems/nokogiri-1.3.1/lib/nokogiri/nokogiri.bundle: > mach-o, but wrong architecture - > /Library/Ruby/Gems/1.8/gems/nokogiri-1.3.1/lib/nokogiri/nokogiri.bundle > from /Library/Ruby/Gems/1.8/gems/nokogiri-1.3.1/lib/nokogiri/nokogiri.bundle > from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' > from /Library/Ruby/Gems/1.8/gems/nokogiri-1.3.1/lib/nokogiri.rb:12 > from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in > `gem_original_require' > from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require' > from (irb):3 > How can I build/run this on x64 which I am assuming is the issue. We have a ticket open for this now. I think I've fixed it, but since I don't have Snow Leopard, do you mind being the guinea pig for this one? Just install nokogiri like this: $ sudo gem install nokogiri -s http://tenderlovemaking.com/ You should get version 1.3.1.20090615105405. That has my Snow Leopard fix in it. If it works, I'll commit and close the ticket. Thanks! -- Aaron Patterson http://tenderlovemaking.com/ From byrnejb at harte-lyne.ca Mon Jun 15 14:05:41 2009 From: byrnejb at harte-lyne.ca (James B. Byrne) Date: Mon, 15 Jun 2009 14:05:41 -0400 (EDT) Subject: [Nokogiri-talk] Parsing an HTML document In-Reply-To: <6959e1680906150919h47ee4faer70da0822cb876a4@mail.gmail.com> References: <8be6656c0906141450r6d72660avba65f21ddf0f3a03@mail.gmail.com> <618c07250906141954h19f64434k7d7839751baca94e@mail.gmail.com> <52555.216.185.71.24.1245079825.squirrel@webmail.harte-lyne.ca> <6959e1680906150919h47ee4faer70da0822cb876a4@mail.gmail.com> Message-ID: <34494.216.185.71.24.1245089141.squirrel@webmail.harte-lyne.ca> On Mon, June 15, 2009 12:19, Aaron Patterson wrote: > Just feed that in to Nokogiri's xpath method, and you should have > the tr tags you're looking for: > > doc = Nokogiri::HTML DATA.read > > tr_tags = doc.xpath(<<-eoxpath) > //tr[ > td[@class = "currency_quote"] > and td[@class = "effective_date"] > and td[@class = "source"] > ] > eoxpath > Now I am simple trying to ape what you have told me at the moment. I suppose this is the consciously incompetent stage of learning. In any case this is what I am trying to do in the console: >> doc = Nokogire::HTML(app.doc) ... stream of consciousness text => nil >> ?> tr_tags = doc.xpath(<<-eoxpath) //tr[ td[@class = "currency_quote"] and td[@class = "effective_date"] and td[@class = "source"] ] eoxpath => nil >> tr_tags.each do |tr| ?> puts tr >> end => 0 >> y tr_tags --- !ruby/object:Nokogiri::XML::NodeSet document: !ruby/object:Nokogiri::HTML::Document decorators: errors: [] node_cache: - !ruby/object:Nokogiri::XML::Element {} => nil It appears that for some reason this does not work as expected. The last time that I ran into this problem it revolved around the default name space xlmns, but I have no idea if that applies here or not. > > I would suggest reading up on XPath here: > > http://www.w3schools.com/Xpath/default.asp > http://www.w3.org/TR/xpath > I will return to these although I have a vague recollection of having been to both at sometime in the past. > Hope that helps! Your assistance is as invaluable as it is generous. I am very grateful. -- *** E-Mail is NOT a SECURE channel *** James B. Byrne mailto:ByrneJB at Harte-Lyne.ca Harte & Lyne Limited http://www.harte-lyne.ca 9 Brockley Drive vox: +1 905 561 1241 Hamilton, Ontario fax: +1 905 561 0757 Canada L8E 3C3 From aaron.patterson at gmail.com Mon Jun 15 14:28:03 2009 From: aaron.patterson at gmail.com (Aaron Patterson) Date: Mon, 15 Jun 2009 11:28:03 -0700 Subject: [Nokogiri-talk] Parsing an HTML document In-Reply-To: <34494.216.185.71.24.1245089141.squirrel@webmail.harte-lyne.ca> References: <8be6656c0906141450r6d72660avba65f21ddf0f3a03@mail.gmail.com> <618c07250906141954h19f64434k7d7839751baca94e@mail.gmail.com> <52555.216.185.71.24.1245079825.squirrel@webmail.harte-lyne.ca> <6959e1680906150919h47ee4faer70da0822cb876a4@mail.gmail.com> <34494.216.185.71.24.1245089141.squirrel@webmail.harte-lyne.ca> Message-ID: <6959e1680906151128x1c89695ata2919dd5527eab35@mail.gmail.com> On Mon, Jun 15, 2009 at 11:05 AM, James B. Byrne wrote: > > On Mon, June 15, 2009 12:19, Aaron Patterson wrote: > > >> Just feed that in to Nokogiri's xpath method, and you should have >> the tr tags you're looking for: >> >> doc = Nokogiri::HTML DATA.read >> >> tr_tags = doc.xpath(<<-eoxpath) >> ? //tr[ >> ? ? ? ? td[@class = "currency_quote"] >> ? ? and td[@class = "effective_date"] >> ? ? and td[@class = "source"] >> ? ] >> eoxpath >> > > Now I am simple trying to ape what you have told me at the moment. I > suppose this is the consciously incompetent stage of learning. ?In > any case this is what I am trying to do in the console: > >>> doc = Nokogire::HTML(app.doc) > ... stream of consciousness text > => nil >>> > ?> tr_tags = doc.xpath(<<-eoxpath) > ?//tr[ > ? ? ? ?td[@class = "currency_quote"] > ? ?and td[@class = "effective_date"] > ? ?and td[@class = "source"] > ?] > eoxpath > => nil >>> tr_tags.each do |tr| > ?> ? puts tr >>> end > => 0 Interesting. I tested that xpath against a slight modification of the example document you sent. Can you send along the actual document? >>> y tr_tags > --- !ruby/object:Nokogiri::XML::NodeSet > document: !ruby/object:Nokogiri::HTML::Document > ?decorators: > ?errors: [] > > ?node_cache: > ?- !ruby/object:Nokogiri::XML::Element {} > > => nil > > It appears that for some reason this does not work as expected. ?The > last time that I ran into this problem it revolved around the > default name space xlmns, but I have no idea if that applies here or > not. If you're using Nokogiri::HTML, namespaces should not bother you. Nokogiri::HTML is meant for HTML <= 4.01 (IIRC), and just strips out namespaces. >> I would suggest reading up on XPath here: >> >> ? http://www.w3schools.com/Xpath/default.asp >> ? http://www.w3.org/TR/xpath >> > > I will return to these although I have a vague recollection of > having been to both at sometime in the past. > >> Hope that helps! > > Your assistance is as invaluable as it is generous. ?I am very > grateful. I am glad to help. :-) -- Aaron Patterson http://tenderlovemaking.com/ From aaron.patterson at gmail.com Mon Jun 15 14:29:54 2009 From: aaron.patterson at gmail.com (Aaron Patterson) Date: Mon, 15 Jun 2009 11:29:54 -0700 Subject: [Nokogiri-talk] Running/installing gem on 64 bit OSX 10.6 In-Reply-To: <6ffb72010906151118j50655b9ay1b5a835110935edf@mail.gmail.com> References: <6ffb72010906151024u1c3150ccv3722e3356e41522b@mail.gmail.com> <6959e1680906151057x44316a74x266c1cc615be1c20@mail.gmail.com> <6ffb72010906151118j50655b9ay1b5a835110935edf@mail.gmail.com> Message-ID: <6959e1680906151129x6c85fe5en9e7dea6c0e95ebbb@mail.gmail.com> On Mon, Jun 15, 2009 at 11:18 AM, Ben Lovell wrote: > > > On Mon, Jun 15, 2009 at 6:57 PM, Aaron Patterson > wrote: >> >> On Mon, Jun 15, 2009 at 10:24 AM, Ben Lovell >> wrote: >> > Hey, >> > I've gem installed nokogiri on OS X 10.6 (64bit) and I get the following >> > message in irb when trying to require: >> >>> require "nokogiri" >> > LoadError: >> > >> > dlopen(/Library/Ruby/Gems/1.8/gems/nokogiri-1.3.1/lib/nokogiri/nokogiri.bundle, >> > 9): no suitable image found. ?Did find: >> > /Library/Ruby/Gems/1.8/gems/nokogiri-1.3.1/lib/nokogiri/nokogiri.bundle: >> > mach-o, but wrong architecture - >> > /Library/Ruby/Gems/1.8/gems/nokogiri-1.3.1/lib/nokogiri/nokogiri.bundle >> > from >> > /Library/Ruby/Gems/1.8/gems/nokogiri-1.3.1/lib/nokogiri/nokogiri.bundle >> > from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' >> > from /Library/Ruby/Gems/1.8/gems/nokogiri-1.3.1/lib/nokogiri.rb:12 >> > from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in >> > `gem_original_require' >> > from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require' >> > from (irb):3 >> > How can I build/run this on x64 which I am assuming is the issue. >> >> We have a ticket open for this now. ?I think I've fixed it, but since >> I don't have Snow Leopard, do you mind being the guinea pig for this >> one? >> >> Just install nokogiri like this: >> >> ?$ sudo gem install nokogiri -s http://tenderlovemaking.com/ >> >> You should get version 1.3.1.20090615105405. ?That has my Snow Leopard >> fix in it. ?If it works, I'll commit and close the ticket. >> >> Thanks! >> >> -- >> Aaron Patterson >> http://tenderlovemaking.com/ > > Aaron, you are "the man". Works fine now. Is this something I should look > out for on other gems (with native extensions)? Thanks! :-) Possibly. This came about from a hack to support ppc and i386 builds at the same time. I actually don't think that hack is necessary anymore, but I need to do some testing. -- Aaron Patterson http://tenderlovemaking.com/ From byrnejb at harte-lyne.ca Mon Jun 15 14:39:19 2009 From: byrnejb at harte-lyne.ca (James B. Byrne) Date: Mon, 15 Jun 2009 14:39:19 -0400 (EDT) Subject: [Nokogiri-talk] Parsing an HTML document In-Reply-To: <6959e1680906151128x1c89695ata2919dd5527eab35@mail.gmail.com> References: <8be6656c0906141450r6d72660avba65f21ddf0f3a03@mail.gmail.com> <618c07250906141954h19f64434k7d7839751baca94e@mail.gmail.com> <52555.216.185.71.24.1245079825.squirrel@webmail.harte-lyne.ca> <6959e1680906150919h47ee4faer70da0822cb876a4@mail.gmail.com> <34494.216.185.71.24.1245089141.squirrel@webmail.harte-lyne.ca> <6959e1680906151128x1c89695ata2919dd5527eab35@mail.gmail.com> Message-ID: <53577.216.185.71.24.1245091159.squirrel@webmail.harte-lyne.ca> On Mon, June 15, 2009 14:28, Aaron Patterson wrote: > Interesting. I tested that xpath against a slight modification of > the example document you sent. Can you send along the actual > document? > This is the screen dump from inside the console session. Doc is an instance of Nokogiri::HTML ?> print doc

Harte & Lyne Limited

theHeart - Transportation and Customs

1 user recently active ?? This session is authenticated by: User ID: 1 User Name: admin Connected From: 127.0.0.1 Since: 2009-06-15 10:39:38 -0400
Edit My Account Details | End Current Session

No Currency Exchange Rates found.

Listing Most Recent Foreign Exchange Rates for All Currencies

Add New Currency Exchange Rate | List Currencies
2009-04-01CABC
Currency Exchange Rates Listing
Base Quote Date Type Rate Source
CAD EUR 2009-06-05 CLSE 1.555452 CA: 0.6429 EUR = 1 CAD 2009-06-04 Bank of Canada closing rate
Show Edit Destroy
CAD GBP 2009-06-05 CLSE 1.774938 CA: 0.5634 GBP = 1 CAD 2009-06-04 Bank of Canada closing rate
Show Edit Destroy
CAD JPY 2009-06-05 CLSE 0.011340 CA: 88.1834 JPY = 1 CAD 2009-06-04 Bank of Canada closing rate
Show Edit Destroy
CAD MXN 2009-06-05 CLSE 0.082910 CA: 12.0613 MXN = 1 CAD 2009-06-04 Bank of Canada closing rate
Show Edit Destroy
CAD NZD 2009-06-05 CLSE 0.695700 CA: 1.4374 NZD = 1 CAD 2009-06-04 Bank of Canada closing rate
Show Edit Destroy
CAD USD 2009-06-05 CLSE 1.096852 CA: 0.9117 USD = 1 CAD 2009-06-04 Bank of Canada closing rate
Show Edit Destroy

Add New Currency Exchange Rate | List Currencies
--- |-
--- !map:HashWithIndifferentAccess
action: index
controller: currency_exchange_rates
=> nil >> -- *** E-Mail is NOT a SECURE channel *** James B. Byrne mailto:ByrneJB at Harte-Lyne.ca Harte & Lyne Limited http://www.harte-lyne.ca 9 Brockley Drive vox: +1 905 561 1241 Hamilton, Ontario fax: +1 905 561 0757 Canada L8E 3C3 From aaron.patterson at gmail.com Mon Jun 15 15:15:38 2009 From: aaron.patterson at gmail.com (Aaron Patterson) Date: Mon, 15 Jun 2009 12:15:38 -0700 Subject: [Nokogiri-talk] Parsing an HTML document In-Reply-To: <53577.216.185.71.24.1245091159.squirrel@webmail.harte-lyne.ca> References: <8be6656c0906141450r6d72660avba65f21ddf0f3a03@mail.gmail.com> <618c07250906141954h19f64434k7d7839751baca94e@mail.gmail.com> <52555.216.185.71.24.1245079825.squirrel@webmail.harte-lyne.ca> <6959e1680906150919h47ee4faer70da0822cb876a4@mail.gmail.com> <34494.216.185.71.24.1245089141.squirrel@webmail.harte-lyne.ca> <6959e1680906151128x1c89695ata2919dd5527eab35@mail.gmail.com> <53577.216.185.71.24.1245091159.squirrel@webmail.harte-lyne.ca> Message-ID: <6959e1680906151215p71f881r993cbac9f2d1323e@mail.gmail.com> On Mon, Jun 15, 2009 at 11:39 AM, James B. Byrne wrote: > > On Mon, June 15, 2009 14:28, Aaron Patterson wrote: > >> Interesting. ?I tested that xpath against a slight modification of >> the example document you sent. ?Can you send along the actual >> document? >> > This is the screen dump from inside the console session. ?Doc is an > instance of Nokogiri::HTML Ah, there are no td tags that contain the class "currenty_quote", or a td where the class = "source". This XPath seemed to work better for me: doc = Nokogiri::HTML DATA.read tr_tags = doc.xpath(<<-eoxpath) //tr[ td[@class = "quote_currency"] and td[@class = "effective_date"] ] eoxpath puts tr_tags.length -- Aaron Patterson http://tenderlovemaking.com/ From aaron.patterson at gmail.com Mon Jun 15 15:35:26 2009 From: aaron.patterson at gmail.com (Aaron Patterson) Date: Mon, 15 Jun 2009 12:35:26 -0700 Subject: [Nokogiri-talk] [ANN] Nokogiri mailing list is moving to Google Groups Message-ID: <6959e1680906151235m22986877u58b9586ecf072282@mail.gmail.com> I've migrated the list to google groups. The address is here: http://groups.google.com/group/nokogiri-talk I tried to add everyone from the current list to the google groups based list. Unfortunately, Google flagged me as attempting to spam, so they are moderating my migration of the list. So I think you should either add yourself, or just wait. I'm pretty sure google will approve my request. I will continue to respond to emails on this list until I see that Google has accepted my request. Once that happens, I will shut off mails for this list. Note to the digest subscribers: I did not migrate your email addresses as I don't know what your digest settings are. Please add yourself to the Google group. I've updated all documentation, including the website, and the IRC channel topic to point at the new list address. Thanks everyone! -- Aaron Patterson http://tenderlovemaking.com/ From byrnejb at harte-lyne.ca Mon Jun 15 15:53:58 2009 From: byrnejb at harte-lyne.ca (James B. Byrne) Date: Mon, 15 Jun 2009 15:53:58 -0400 (EDT) Subject: [Nokogiri-talk] Parsing an HTML document In-Reply-To: <6959e1680906151215p71f881r993cbac9f2d1323e@mail.gmail.com> References: <8be6656c0906141450r6d72660avba65f21ddf0f3a03@mail.gmail.com> <618c07250906141954h19f64434k7d7839751baca94e@mail.gmail.com> <52555.216.185.71.24.1245079825.squirrel@webmail.harte-lyne.ca> <6959e1680906150919h47ee4faer70da0822cb876a4@mail.gmail.com> <34494.216.185.71.24.1245089141.squirrel@webmail.harte-lyne.ca> <6959e1680906151128x1c89695ata2919dd5527eab35@mail.gmail.com> <53577.216.185.71.24.1245091159.squirrel@webmail.harte-lyne.ca> <6959e1680906151215p71f881r993cbac9f2d1323e@mail.gmail.com> Message-ID: <40556.216.185.71.24.1245095638.squirrel@webmail.harte-lyne.ca> On Mon, June 15, 2009 15:15, Aaron Patterson wrote: > > Ah, there are no td tags that contain the class "currenty_quote", or > a td where the class = "source". > Arggg! I am such a clot. Of course! I shortened a few things for the purpose of example and then failed to accommodate those changes when I received the answer. I am sorry. Thank you very much for this. If I may impose further, is the @class syntax described inside the nokogiri docs somewhere? I believe that my lack of facility with the nuts and bolts of forming syntactically correct expressions is what is limiting me. I have just gotten used to .xxxx meaning css class=xxxx and #xxxx meaning css id=xxxx. Where does the @ come from and what is the significance of the leading //? Again, many thanks. -- *** E-Mail is NOT a SECURE channel *** James B. Byrne mailto:ByrneJB at Harte-Lyne.ca Harte & Lyne Limited http://www.harte-lyne.ca 9 Brockley Drive vox: +1 905 561 1241 Hamilton, Ontario fax: +1 905 561 0757 Canada L8E 3C3 From aaron.patterson at gmail.com Mon Jun 15 16:09:28 2009 From: aaron.patterson at gmail.com (Aaron Patterson) Date: Mon, 15 Jun 2009 13:09:28 -0700 Subject: [Nokogiri-talk] Parsing an HTML document In-Reply-To: <40556.216.185.71.24.1245095638.squirrel@webmail.harte-lyne.ca> References: <8be6656c0906141450r6d72660avba65f21ddf0f3a03@mail.gmail.com> <618c07250906141954h19f64434k7d7839751baca94e@mail.gmail.com> <52555.216.185.71.24.1245079825.squirrel@webmail.harte-lyne.ca> <6959e1680906150919h47ee4faer70da0822cb876a4@mail.gmail.com> <34494.216.185.71.24.1245089141.squirrel@webmail.harte-lyne.ca> <6959e1680906151128x1c89695ata2919dd5527eab35@mail.gmail.com> <53577.216.185.71.24.1245091159.squirrel@webmail.harte-lyne.ca> <6959e1680906151215p71f881r993cbac9f2d1323e@mail.gmail.com> <40556.216.185.71.24.1245095638.squirrel@webmail.harte-lyne.ca> Message-ID: <6959e1680906151309j45c12e5i961feb9a00e882bd@mail.gmail.com> On Mon, Jun 15, 2009 at 12:53 PM, James B. Byrne wrote: > > On Mon, June 15, 2009 15:15, Aaron Patterson wrote: > >> >> Ah, there are no td tags that contain the class "currenty_quote", or >> a td where the class = "source". >> > > Arggg! I am such a clot. ?Of course! I shortened a few things for > the purpose of example and then failed to accommodate those changes > when I received the answer. ?I am sorry. > > Thank you very much for this. No problem. :-) > If I may impose further, is the @class syntax described inside the > nokogiri docs somewhere? ?I believe that my lack of facility with > the nuts and bolts of forming syntactically correct expressions is > what is limiting me. ?I have just gotten used to .xxxx meaning css > class=xxxx and #xxxx meaning css id=xxxx. ?Where does the @ come > from and what is the significance of the leading //? When you're doing xpath queries, @whatever refers to the attribute named "whatever". The leading "//" indicates that you want to search the entire document starting at the root. Try to think of xpath kind of like file paths. "//" is roughly equivalent to "/**/*". -- Aaron Patterson http://tenderlovemaking.com/ From greg at intelligentassistance.com Mon Jun 15 19:13:30 2009 From: greg at intelligentassistance.com (Gregory Clarke) Date: Mon, 15 Jun 2009 16:13:30 -0700 Subject: [Nokogiri-talk] Running/installing gem on 64 bit OSX 10.6 In-Reply-To: <6959e1680906151129x6c85fe5en9e7dea6c0e95ebbb@mail.gmail.com> References: <6ffb72010906151024u1c3150ccv3722e3356e41522b@mail.gmail.com> <6959e1680906151057x44316a74x266c1cc615be1c20@mail.gmail.com> <6ffb72010906151118j50655b9ay1b5a835110935edf@mail.gmail.com> <6959e1680906151129x6c85fe5en9e7dea6c0e95ebbb@mail.gmail.com> Message-ID: > Possibly. This came about from a hack to support ppc and i386 builds > at the same time. I actually don't think that hack is necessary > anymore, but I need to do some testing. > > -- Was that the line: ENV["ARCHFLAGS"] = "-arch #{`uname -p` =~ /powerpc/ ? 'ppc' : 'i386'}" in extconf.rb? Yeah, you shouldn't need that for Leopard. If you need to specify which architectures you want the gem to build for, it should be possible to specify on Leopard. Example: env ARCHFLAGS='-arch i386 -arch x86_64' gem install nokogiri See http://developer.apple.com/releasenotes/OpenSource/PerlExtensionsRelNotes/ for details. Greg From phlip2005 at gmail.com Wed Jun 17 16:00:49 2009 From: phlip2005 at gmail.com (Phlip) Date: Wed, 17 Jun 2009 13:00:49 -0700 Subject: [Nokogiri-talk] how to get to_xhtml to produce a fragment without the title? Message-ID: <4A394B71.1060401@gmail.com> Nokogirists: Yes, this is probably in there, and is probably documented. I will keep searching and report back if I find it. From vamlists at gmail.com Thu Jun 18 10:11:43 2009 From: vamlists at gmail.com (Vamsee Kanakala) Date: Thu, 18 Jun 2009 19:41:43 +0530 Subject: [Nokogiri-talk] writing attributes to a nokogiri doc In-Reply-To: <8be6656c0906141450r6d72660avba65f21ddf0f3a03@mail.gmail.com> References: <8be6656c0906141450r6d72660avba65f21ddf0f3a03@mail.gmail.com> Message-ID: <4A3A4B1F.4090302@gmail.com> m.zeckinger wrote: > hi list, i have a question on how to actually write attributes to > nodes with nokogiri. i found a way on how this was done in hpricot > http://seancribbs.com/tech/2008/05/19/modifying-attributes-with-hpricot/ > > what would be the nokogiri way of doing this? especially how to alter > and re-read the doc? > With nokogiri this is much simpler: doc.css('img').each do |element| element['src'] = new_src end Vamsee. From m.zecko at gmail.com Fri Jun 19 09:22:42 2009 From: m.zecko at gmail.com (m.zeckinger) Date: Fri, 19 Jun 2009 15:22:42 +0200 Subject: [Nokogiri-talk] writing attributes to a nokogiri doc In-Reply-To: <4A3A4B1F.4090302@gmail.com> References: <8be6656c0906141450r6d72660avba65f21ddf0f3a03@mail.gmail.com> <4A3A4B1F.4090302@gmail.com> Message-ID: <8be6656c0906190622w297613fbk45c313ea86c62de1@mail.gmail.com> hi again list; and thanks a lot for answering my previous question. another nokogiri question: i need to traverse a doc (XML) and not only change the node_type on some nodes, but also add some attributes. it seems when changing the node_name within the loop, the document seems to get f*cked up -- i think this is when a parent node name is changed and a child is edited... any workaround for this? On Thu, Jun 18, 2009 at 4:11 PM, Vamsee Kanakala wrote: > m.zeckinger wrote: >> >> hi list, i have a question on how to actually write attributes to >> nodes with nokogiri. i found a way on how this was done in hpricot >> http://seancribbs.com/tech/2008/05/19/modifying-attributes-with-hpricot/ >> >> what would be the nokogiri way of doing this? especially how to alter >> and re-read the doc? >> > > With nokogiri this is much simpler: > > doc.css('img').each do |element| > ?element['src'] = new_src > end > > > Vamsee. > _______________________________________________ > Nokogiri-talk mailing list > Nokogiri-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/nokogiri-talk > From aaron.patterson at gmail.com Fri Jun 19 11:49:34 2009 From: aaron.patterson at gmail.com (Aaron Patterson) Date: Fri, 19 Jun 2009 08:49:34 -0700 Subject: [Nokogiri-talk] writing attributes to a nokogiri doc In-Reply-To: <8be6656c0906190622w297613fbk45c313ea86c62de1@mail.gmail.com> References: <8be6656c0906141450r6d72660avba65f21ddf0f3a03@mail.gmail.com> <4A3A4B1F.4090302@gmail.com> <8be6656c0906190622w297613fbk45c313ea86c62de1@mail.gmail.com> Message-ID: <6959e1680906190849n472e700frd71d2faa3d7e1c11@mail.gmail.com> On Fri, Jun 19, 2009 at 6:22 AM, m.zeckinger wrote: > hi again list; and thanks a lot for answering my previous question. > > another nokogiri question: i need to traverse a doc (XML) and not only > change the node_type on some nodes, but also add some attributes. > it seems when changing the node_name within the loop, the document > seems to get f*cked up -- i think this is when a parent node name is > changed and a child is edited... > > any workaround for this? Can you provide some short sample code that demonstrates the problem? I can help more when I can actually see what's going on. Thanks! -- Aaron Patterson http://tenderlovemaking.com/ From phlip2005 at gmail.com Fri Jun 19 18:06:31 2009 From: phlip2005 at gmail.com (Phlip) Date: Fri, 19 Jun 2009 15:06:31 -0700 Subject: [Nokogiri-talk] How to configure xml.builder to call Nokogiri? Message-ID: <4A3C0BE7.5090204@gmail.com> Railsters: I'm still on the learning curve with exotic partials. I seem to understand that a file with the extension *.xml.builder will call Builder::XmlMarkup. If so, how to configure it to call Nokogiri::Builder instead? (CC'd to Nokogiri's mailing list, but I might get a faster turnaround here, + that list is now migrating to Google Groups...) -- Phlip From phlip2005 at gmail.com Mon Jun 22 16:12:44 2009 From: phlip2005 at gmail.com (Phlip) Date: Mon, 22 Jun 2009 13:12:44 -0700 Subject: [Nokogiri-talk] Enterprise Ruby! Message-ID: <4A3FE5BC.4030705@gmail.com> Two answers to the FAQ "is Ruby useful in the enterprise?" Aaron P: http://github.com/tenderlove/enterprise/tree/master Jay Levitt: If you're looking for global enterprise solutions to integrate distributed systems, at the end of the day, Ruby has the momentum to leverage the dynamic potential of synergies between your skillsets and its core competencies on Internet time. Achieving best-of-breed, mission-critical componentization utilizing standards-compliant scalability, it provides an adaptable, standards-based framework to add value via a fast-track, result-driven development process. I hope that helps answer your question.