From: Bob Hutchison Date: 2001-11-14T06:25:23+09:00 Subject: [ruby-talk:25077] Re: XML support in the standard lib; what exactly? Once again making no sense, let me complete my thoughts... Which may or may not improve things :-) On 01/11/13 4:13 PM, "Bob Hutchison" wrote: > On 01/11/13 1:41 PM, "Bob Gustafson" wrote: >> >> ---------------------------------- >> >> Striking out on a slightly different direction, maybe some discussion of >> the 'requirements' of a ruby xml processor would be in order. >> >> Requirements - i.e., what do you want to do with the XML documents? > > 0) parse an XML document and generate SAX-like events without having to have > the whole document in memory. (I'm getting boring :-) > > 0.1) parse an XML document and generate a DOM-like structure [I would never > use this, personally, but I think others want it]. > > 0.2) write an XML document using an event-like api. > > 0.3) write the XML corresponding to the DOM-like structure. > >> >> 1) extract data from certain fields? >> >> 2) convert documents from one DTD scheme to another? (Abiword -> Docbook?) > > These are probably both XSLT things. > >> >> 3) quickly create data scraps to send between computers, both having >> different database schemas? > > I think this requires either 0.0/0.2 or 0.1/0.3 from above. Is there more > you had in mind? > > Again, from my admittedly selfish point of view, do 0.0 and 0.2, then 3 will > follow naturally. Do 0.1 and 0.3, then 3 will follow almost as naturally :-) > >> >> 4) All of the above? > > Well, I normally use Java. To run XSLT over some small documents takes about > 27 seconds *each* using Xerces (Java XSLT from Apache). Using libxml (C Xalan not Xerces! > based GNU library) these documents take between 0.3 and 0.6 seconds. This is > not because the java translator is poorly written :-) Anyways, 50-100 times > faster is so significant that, well, it is like having a different tool. I suspect any tool like this written in Ruby won't be any quicker than Xalan. I think Ruby has something to offer but I don't know that all tools have to be native. If the c-based tools are going to blow away a ruby based one, why bother. There is a *significant* difference between native XML parsing in Ruby and XSLT processing in Ruby. Parsing is a facility that is mandatory for a Ruby application to work with XML. Even if it is slower than C there will be compensating factors, like the ease of building XML applications in Ruby. In the case of XSLT, extensions are not too often used, so we cannot gain by Ruby being in the mix (at least, I cannot see how we might). > >> >> 5) All of the above with the same tools or different tools. >> >> Which of these usages are most important to you folks? Is it ease of use, >> completeness with one tool? What? > > Given that this is Ruby, I'd say ease of use has to rank up there. > >> >> Would several tools (each adapted to a different use) be better than one >> mondo tool? > > Again, this strikes me as being more Ruby-like. 'This' being several tools. > >> >> BobG > Sorry about having to post to my own post. Cheers, Bob