Should Nokogiri replace REXML?

This is probably more suited to the ruby-core mailing list, but as I
am not following that list regularly any longer I'll bring it up here.

REXML is starting to look pretty dated. I find myself no longer using
REXML for anything and use Nokogiri instead. I suspect other
developers are doing the same. Aaron (and Mike) have done an
incredible job with Nokogiri. And so I think it's not unreasonable to
suggest that it replace REXML as a standard library.

The only downside I see that Nokogiri is not a pure Ruby library, but
depends on libxml2. But given the advantages, speed, and uptake of
Nokogiri, I would not expect that to be any sort of show-stopper.

I have always thought a good XML library was important to Ruby. I kept
libxml-ruby on life support for many years hoping someone would
eventually come along and carry on development (it was the best I
could do not being a C coder). That did happen eventutally and we can
thank Dan and Charlie for all their hard work for making libxml-ruby
an excellent library, and of course we should thank Sean who started
the project.

But Aaron came along and upped the ante with Nokogiri.

So any way. I've had this thought in the back of my mind for a while,
and just wanted to put it out there.

0
Intransition
1/21/2010 4:32:09 PM
comp.lang.ruby 48881 articles. 0 followers. Post Follow

4 Replies
388 Views

Similar Articles

[PageSpeed] 48
Wouldn't that make it really hard for the non C-based Ruby implementations?

On Thu, Jan 21, 2010 at 11:32 AM, Intransition <transfire@gmail.com> wrote:
> This is probably more suited to the ruby-core mailing list, but as I
> am not following that list regularly any longer I'll bring it up here.
>
> REXML is starting to look pretty dated. I find myself no longer using
> REXML for anything and use Nokogiri instead. I suspect other
> developers are doing the same. Aaron (and Mike) have done an
> incredible job with Nokogiri. And so I think it's not unreasonable to
> suggest that it replace REXML as a standard library.
>
> The only downside I see that Nokogiri is not a pure Ruby library, but
> depends on libxml2. But given the advantages, speed, and uptake of
> Nokogiri, I would not expect that to be any sort of show-stopper.
>
> I have always thought a good XML library was important to Ruby. I kept
> libxml-ruby on life support for many years hoping someone would
> eventually come along and carry on development (it was the best I
> could do not being a C coder). That did happen eventutally and we can
> thank Dan and Charlie for all their hard work for making libxml-ruby
> an excellent library, and of course we should thank Sean who started
> the project.
>
> But Aaron came along and upped the ante with Nokogiri.
>
> So any way. I've had this thought in the back of my mind for a while,
> and just wanted to put it out there.
>
>

0
Jordi
1/21/2010 7:17:01 PM
On Jan 21, 4:17=A0pm, Jordi Bunster <jo...@bunster.org> wrote:
> Wouldn't that make it really hard for the non C-based Ruby implementation=
s?

Well, Nokogiri was ported to JRuby using FFI. Which means can work on
MacRuby and MagLev possibly.

http://github.com/tenderlove/nokogiri/tree/java

Dunno it's status but seems pretty doable.

--
Luis Lavena
0
Luis
1/21/2010 8:29:38 PM
On Thu, Jan 21, 2010 at 1:17 PM, Jordi Bunster <jordi@bunster.org> wrote:
> Wouldn't that make it really hard for the non C-based Ruby implementations?

Yes, it would. But if someone wants to help implement the remaining
bits of the pure-Java Nokogiri, we'll be pretty close in JRuby.

http://www.serabe.com/2009/12/31/helping-nokogiri-take-ii/

Unfortunately libxml encompasses a *lot* of functionality not
typically included in the many Java XML parser (like bad HTML
scrubbing), so including all of Nokogiri would introduce a lot of
dependencies. Ideally I'd like to see a Nokogiri "lite" that just
provides the W3C APIs for DOM, SAX, and pull parsing, and allows you
to pull in "Nokogiri HTML" or some other library for doing HTML
scrubbing.

- Charlie

0
Charles
1/21/2010 8:35:11 PM
On Thu, Jan 21, 2010 at 2:31 PM, Luis Lavena <luislavena@gmail.com> wrote:
> On Jan 21, 4:17=C2=A0pm, Jordi Bunster <jo...@bunster.org> wrote:
>> Wouldn't that make it really hard for the non C-based Ruby implementatio=
ns?
>
> Well, Nokogiri was ported to JRuby using FFI. Which means can work on
> MacRuby and MagLev possibly.
>
> http://github.com/tenderlove/nokogiri/tree/java
>
> Dunno it's status but seems pretty doable.

FFI is great, but it's only usable where you have libxml available (a
problem for the C ext as well) and where you are allowed to use it (a
big problem for JRuby users on Google App Engine, Android, or secure
environments where native libraries are forbidden).

The only perfect solution for JRuby is a pure-Java Nokogiri.

- Charlie

0
Charles
1/21/2010 8:43:35 PM
Reply:
Similar Artilces:

Nokogiri bug?
Hi Folks - Having some trouble w/ Nokogiri & its handling of xpaths and nodesets, wondering if anyone here knows about possible existing issues. (Apologies if this is a bit off-topic, but I am working in Ruby...) So I'm trying to access a form's action URL so that I can construct my own query string to GET via mechanize. I've tested just about every possible xpath to get to the form's action property, and Nokogiri is behaving as if it doesn't exist. What I've discovered is that, once I hit a particular div tag, which happens to be the parent node of the form, Nok...

[News] Open Source Management Tools Increasingly Replace Proprietary Ones
Open source management software breaks into the data center ,----[ Quote | When a Linux rollout cuts costs, proprietary IT management software is the | next budget item on the chopping block. | | [...] | | However, the displacement of many proprietary products by the open source | movement may enter the equation for enterprise management tools as well. | Using open source to manage open source, with products such as GroundWork | Open Source, Puppet, and Zenoss, might be the answer to this dilemma. `---- http://www.linuxworld.com/news/2008/042408-opensource-management.html From th...

Replacing multi-line expression
Hi there, I am trying to replace a multi-line expression in a text file without much success so far. I am looking to replace "string1\nstring2" with "string3\nstring4". For this I tried: cat input.dump | sed -e '{ N s/^string1\nstring2$/string3\nstring4/ }' > output.dump But depending whether string1 is on odd or even line, sed works or not. I then tried with awk: cat input.dump | awk -v RS= 'sub(/ string1\nstring2/,"string3\nstring4")' > output.dump But this one simply gives an empty output file. I did check that ...

Desktop replacement?
Are there desktop replacements for Macs? I'm not talking new looks, I mean different control possibilities, such as changing what drives/files/folders/shortcuts show up. My real desk is kinda messy, and I like my computer desktop kinda messy, too. TIA. -- Wolf 'Just because it's true doesn't mean it's the right answer.' In article <469eb423$0$29454$9a6e19ea@news.newshosting.com>, Wolf <ElLoboViejo@ruddy.moss> wrote: > Are there desktop replacements for Macs? I'm not talking new looks, I > mean different control possibilities, such as chan...

Multi Frame Page Does not replace back button function.
I have a multiframe page that when you click on a button on the page it changes the content in one of the other frames. This function works and I am using: parent.fraControl.location.replace(sHref) To change the content. But the Back button in Firefox keeps track of each of the pages. So that when the user does a Back button it only redirects them back through each of the different content pages instead of back to the Lookup Page that got things started. Can anybody tell me what I am doing wrong? Thanks dbl doh. I found one reference that was still setting location.href instead of l...

Using Nokogiri
I'm trying to scrape some data off websites using nokogiri require 'rubygems' require 'open-uri' require 'nokogiri' #using the latest 1.4.0 url = 'http://www.whateverwebsitenameis.org' doc = Nokogiri::HTML(open(url)) This gets me data off the website I want to scrape. The segment of the site I want looks like this (from FF 'view source' ) ------------------------------------------------------------------------- <h2>Association Detail</h2> <div class="sectionHeaderText" style="padding-bottom: 6pt;">DET...

RS485 is too expansive: any replacement?
Hi, I'm called to design a multi drop network where the nodes communicate using 2 wires. The distance from 2 nodes is maximum 20 meters. The wires will run along the mains (220 V). I requested a quotation for the following part: MAX3483ECSA (3 Volt, ESD protetected, transceiver) and they told me that 4000 parts cost 1.90 Euros each... amazing! Are there any cheaper pin-to-pin part replacement? Does, using CAN transceivers instead of RS485 ones, make any sense? thanks for any help, Enrico zigbee@libero.it wrote: > Hi, > > I'm called to des...

search and replace end of line?
Hi, I have browsed old messages but I have not found any good answer to how to substitute a end of line character. This is what I want to do: I have a file that ends like.... myArray[someBigSize] = { .. .. 0x78u, 0x0f }; So I want sed to find the eol and replace it so that the file looks like... 0x78u, 0x0fu }; i.e. the 'u' is added but the rest is keept intact. This is what I tried to do.. sed "s/\n\}\;/u\n\}\;/" < myFile.c But this wont do it for me?? Why? di98mase wrote: > Hi, > > I have browsed old messages but I have not found any good answer to...

Linux replaces Windows in Amsterdam, rest of Holland to follow soon
http://www.google.com/translate?u=http%3A%2F%2Fwww.elsevier.nl%2Fnieuws%2Finternet_en_gadgets%2Fartikel%2Fasp%2Fartnr%2F183201%2Findex.html&langpair=nl%7Cen&hl=en&ie=UTF8 Please use Linux, drop Windows like a sack of SH*T ...

C replacement for Queue module
I'm working on an application that makes heavy use of Queue objects in a multithreaded environment. By "heavy" I mean "millions of calls to put and get, constituting ~20% of the app's run time." The profiler thinks that a significant amount of time is spent in this code -- not just a consumer waiting for a producer, but actual _empty, notify calls, etc. Would it be worth the time to write a CQueue module with pthread_cond instead of Python Condition objects, etc? I don't really have a gut feeling for how much bang-for-the-loc C optimization might give: twice...

HP48SX replacement UI?
Hi there Is their any replacement UI available for the HP48SX (with HP 128K RAM Card) that I could use? Seems all are for the 48GX+RAM Card? Owned the 48SX+RAM Card for 20 years since College and am loathe to change it (sentimental value is huge). Many thanks. Ed Austin On 3/25/2014 8:42 PM, Edward Austin wrote: > Hi there > > Is their any replacement UI available for the HP48SX (with HP 128K RAM Card) that I could use? > Seems all are for the 48GX+RAM Card? > Owned the 48SX+RAM Card for 20 years since College and am loathe to change it (sentimental value is ...

How to replace line break characters?
Hello, What am I doing wrong in my regular expression? I'm trying to replace line break characters by responseText = responseText.replace(/(\r|\n)/, ""); However my response still contains characters with ASCII values of 10. How can I rewrite the above? Thanks, - Dave Did you try something like this: responseText =3DresponseText.replace(/[\r\n]+/g, ""); This is explained token: [\r\n]+ Match a single character present in the list below =C2=AB[\r\n]+=C2=BB Between one and unlimited times, as many times as possible, giving bac...

gsub (replace path)
Hello, How can I cut out piece from path in ruby ? For example I have path like that: path = /dir/dir/.../dir/content/dir/dir/.../dir/ ,where "dir" should be anything and I need to cut off all before content/dir/dir/.../dir/ Thank you in advance ! <pustoi@spils.lv> schrieb im Newsbeitrag news:1104338672.146157.103190@f14g2000cwb.googlegroups.com... > Hello, > > How can I cut out piece from path in ruby ? > For example I have path like that: > > path = /dir/dir/.../dir/content/dir/dir/.../dir/ > > ,where "dir" should be anything > >...

Re: simple question: replacing one dataset with another #9 1563514
michaelraithel@WESTAT.COM replied: > >Dear SAS-L-ers, > >Jens posted the following: > > > I have a sas dataset and its name in &a which should be replaced by > > another dataset, its name is in &b. > > > > data &a; > > set &b; > > run; > > > > is not sufficient because it would not copy the index. > > > > PROC COPY does not change the name while copying, also the libname and > > > dataset name must be separate. > > > > What to do? > > > >Jens, well, if you replace a SAS...

TurboTax replacement?
The good news is that my annual delivery of TurboTax arrived today. The bad news is that it requires OSX and I am still on OS9. No problem getting the refund, but now I need somethiong else that runs on ancient versions of the MAC OS -- like 9.2.2. Any suggestions? Upgrading the OS is not a good choice for me because, having tried it on my G3 Pismo laptop when OSX first came out, it is dog slow and won't run my normal applications :-( -- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Brian Gordon -->briang@panix.com<-- brian.gordon...

Nokogiri usage
Hi, In one of my Rails app, I have a content attribute that hosts some html code. I want to parse this content and replace <img> tags by something else. I used to do Nokogiri::HTML(content), and then do my parsing, then return the content. The problem is that nokogiri injects the doctype and <html><body> tags which obviously messes up my final html page because of these duplicate tags. So how to perform the parsing without having to first initialize the content with Nokogiri::HTML, or how to not initialize a full html page from my content? Cheers, -- Posted via http://ww...

Replacing LMGetTopMapHndl() in Carbon
Hi, Does anyone know how I could replace unsupported call to LMGetTopMapHndl() in porting my app to Carbon? The code is as follows: short sRefFile; ResMap** hResMap; .... hResMap = (ResMap**)LMGetTopMapHndl(); // Illegal in Carbon! sRefFile = (*hResMap)->refNum; UseResFile(sRefFile); .... Thanks in advance for your help :-) Look in <Resources.h> for lots of new functions to manipulate the resource file chain. GetTopResourceFile would seem to solve this particular problem. /Bo Lindbergh Too easy! :-D Thank you very much for your help! Bo Lindb...

Replacing negative values with "0"
Hi all- I have a 5 column array: = [1, 2, 3, 4, 5] Can anyone give an efficient command that will find all values less than 0 in columns 3 and 5 and replace them with 0? Working on this one for a long time now and can't get it going:( Thanks in advance:) "Tom M" <tomam17@gmail.com> wrote in message <fe6pcq$maf$1@fred.mathworks.com>... > Hi all- > > I have a 5 column array: = [1, 2, 3, 4, 5] > > Can anyone give an efficient command that will find all > values less than 0 in columns 3 and 5 and replace them with 0? > > Working on this...

A31p Flexview replacement
Replacements for the Flexview 1600 x 1200 used in the A31p Thinkpad rarely show up on eBay, and the IBM price is exorbitant. Pricing by 3d party LCD suppliers are almost as bad. UXGA LCDs regularly show up on eBay. Does anyone know of a suitable replacement for the original A31p LCD, even if it doesn't have the full Flexview viewing angle? Would the Samsung UXGA LCD work? ...

Find / Replace utillity
1. Is there such a thing as a utillity that can go through your scripts and formulas and do a find/replace? 2. How can I get rid of field names that I have deleted from the fields & functions choice box? Any herlp appreciated, thanks. Craig, Can't help with no 2, but TeamStudio do a product called Configurator which will do a find and replace throughout all design elements. HTH Jason. "Craig" <rechjcg@bigpond.com> wrote in message news:m5Pib.150429$bo1.148415@news-server.bigpond.net.au... > 1. Is there such a thing as a utillity that ca...

s/$match/$replace/ fails when $replace has backreferences
I need to store my match and replace strings in variables. This fails when my match string uses back references to groupings. Here for example I try to replace "foo" with "foobar" using a back reference: #!/usr/bin/perl $content = "this is my foo"; $match = "(foo)"; $replace = "\1bar"; #$replace = "\\1bar"; # this doesn't work either #$replace = "$1bar"; # neither does this $content =~ s/$match/$replace/; print "$content\n" Any ideas how to get this to work? I need the match and replace strings in variab...

Update Statement
Hi, I am trying to create an update statement that will replace values based on a wild card and only replace the wild card data (not the entire field). Does anyone have any suggestions? Is this even possible? Here is my code: UPDATE UPDATE MyTable SET MyField = replace(MyField, '*[0-9][0-9][0-9][0-9][0-9]*' , 'XXXXX') WHERE (MyTable.MyField) Like '*[0-9][0-9][0-9][0-9][0-9]*' bcap wrote: > Hi, > > I am trying to create an update statement that will replace values > based on a wild card and only replace the wild card data (not th...

Nokogiri help
I keep getting this error "encoding error : output conversion failed due to conv error, bytes 0xA0 0x69 0x64 0xC2 I/O error : encoder error" whenever I try to append my html string to Nokogiri::HTML. When I write that doc to a file, some of the spaces, or possibly letters are weird looking characters. Here is my (partial) output in irb: ... >> templates = templates_page.search('/html/body/table[3]/tr[2]/td[2]//a') => <a href="CAyxDAAO?e=footer">footer</a><a href="CAyxDAAO?e=has-sub-sections">has-sub-sections</a><a hre...

New SSD to replace the 160G harddrive
Can I simply clone the windows to the new SSD? or need to install by the windows vista again? -- Lin_ux Most image backup software titles have the "Hardware Independent = Restore" feature, i.e. patching of restored Windows image to be runnable = on a new HW. You can also do this manually, but this is a long process with = registry tweaks and MBR signature tweaks. --=20 Maxim S. Shatskih Windows DDK MVP maxim@storagecraft.com http://www.storagecraft.com "Lin_ux" <Lin_ux.af44877@hardwarebanter.com> wrote in message = news:Lin_ux.af44...

[Tungsten E] Replace battery?
Hello I bought a second-hand Tungsten E on eBay. Although it works well, the battery no longer holds the charge. There are cheap batteries for sale on eBay and a video on YouTube shows how to change it: http://www.youtube.com/watch?v=JkF9ex8ZDCU Can someone confirm that those batteries are reliable and that even someone with two left hands like myself can perform this operation? :-) Thank you. Gilles Ganault wrote: > Hello > > I bought a second-hand Tungsten E on eBay. Although it works well, the > battery no longer holds the charge. > > There are...