[#32926] Re: smallest non-zero number (and other limits) — Bil Kleb <W.L.Kleb@...>
It looks like it has been a year since I first posed
[#32935] RDoc error(?) with template file — moontoeki@... (Sung Moon)
RDoc error(?) with template file
moontoeki@aol.com (Sung Moon) writes:
[#32948] Ruby + XML Proposal — Bryan Murphy <bryan@...>
The following is a sample application that will be included with the next revision
[#32950] for the FAQ maybe — "Aidan Mark" <ahumphr@...>
I didn't see this in the FAQ but its a frequently asked newbie question.
[#32995] RDoc parsing error — TAKAHASHI Masayoshi <maki@...>
Hello,
[#33003] Variable types — David Corbin <dcorbin@...>
I know I'm new to ruby, but I feel obligated to share my dislike for
[#33034] bash-like command splitting (for regexp wizards) — Massimiliano Mirra <info@...>
I am trying to split a command line containing several commands that
On Feb 3, Massimiliano Mirra said:
[#33039] range and modification — moontoeki@... (Sung Moon)
Two things to think about.
[#33048] Terminology (was: Soap4r/Webrick question) — " JamesBritt" <james@...>
[#33065] http://www.loveruby.net/ with Netscape 4.79 — Stephan K舂per <Stephan.Kaemper@...>
Hi all,
[#33076] Mixins and accessing earlier definitions. — Hugh Sasse Staff Elec Eng <hgs@...>
Having read in the archives that super can be used to go back in the
>>>>> "H" == Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:
On Tue, 5 Feb 2002, ts wrote:
>>>>> "H" == Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:
[#33093] CVS commit emails — Martin Man <Martin.Man@...>
hi all,
Hi,
On Tue, Feb 05, 2002 at 05:00:43PM +0900, Yukihiro Matsumoto wrote:
[#33094] Ruby bug? IO.close doesn't check for error — Matt Armstrong <matt@...>
It is possible for fclose() to fail (for example, when fclose() needs
[#33096] newbie: Array element conversion — Mark Probert <probertm@...>
On Tue, 5 Feb 2002, Mark Probert wrote:
[#33128] Progress with Ruby/Tk — Peter Hickman <peter@...>
Thanks for all the help and pointers that people have given me, as you
[#33129] Ruby and Swig?? — Markus Jais <mjais@...>
hello
[#33135] some dbi questions (probably postres specific) — fastjack@... (Martin Maciaszek)
I'm playing around with dbi and postgres. After a while two problems remained
[#33174] generating Ruby libs from XML Schemas — Tobias Reif <tobiasreif@...>
Hi,
[#33200] Regexp::Parser ported to Ruby...? — "Jeff 'japhy' Pinyan" <jeffp@...>
I'm writing a Perl module for the parsing and handling of regexes. It's
This would be very interesting and a way to play with RegExp's in Ruby in
[#33238] mkmf, extconf.rb — Hugh Sasse Staff Elec Eng <hgs@...>
Further to my suggestions in Ruby-Talk:31391, about adding methods to
Hi,
On Thu, 7 Feb 2002 nobu.nokada@softhome.net wrote:
[#33242] favicon.ico — Dave Thomas <Dave@...>
On Thu, 7 Feb 2002, I wrote:
Thomas Hurst wrote:
[#33281] MYSql on Windows - help! — Dave Thomas <Dave@...>
[#33286] returning multiple values from a method — ptkwt@...1.aracnet.com (Phil Tomson)
irb(main):001:0> def foo; return 1,2,3; end
[#33292] shuffle (all possible sequences) — Tobias Reif <tobiasreif@...>
Hi,
[#33309] XML::SAX2 critique — msergeant@... (Matt Sergeant)
This isn't exactly a critique of XML::SAX2 per-se, but more of the
[#33321] ruby and vim — fastjack@... (Martin Maciaszek)
To edit my ruby code I rediscovered the good old vim. vim6 even has
[#33324] Class variable bug — "Chr. Rippel" <chr_news@...>
It seems that the following class variable bug feel through the
Hi,
[#33344] Adding rockit power to Rdoc? — Bil Kleb <W.L.Kleb@...>
While researching the feasibility of teaching Rdoc to
[#33356] SMTP and attachments — Steve Tuckner <STUCKNER@...>
Does anyone know how to send an e-mail with attachments using net/smtp?
[#33381] Latest CVS/Win32 build error — "Bob Calco" <robert.calco@...>
Anyone:
[#33382] FXRuby: how to create a static status line? — Jos Backus <josb@...>
I'm trying to create a status line at the bottom of the application window
[#33396] Setting the Ruby — "Aidan Mark" <ahumphr@...>
Around 1994 I was writing a book on Perl. I mentioned this to an old timer.
[#33419] Re: NT Service — "Marty Alchin" <gulopine@...>
>I used FireDaemon some years back and it worked so well that if you
[#33421] iowa segfault — Paul Brannan <paul@...>
I know there used to be a mailing list for iowa, but listbot seems to be
[#33423] Need help with ruby-gimp please — Jim Freeze <jfreeze@...>
Hi:
[#33435] Reg: tiny contest: who's faster? (add_a_gram) — grady@... (Steven Grady)
> My current solution works correctly with various inputs.
grady@xcf.berkeley.edu (Steven Grady) writes:
[#33445] RE: Open3.popen3 in C? — Christophe Broult <cbroult@...>
> -----Original Message-----
[#33470] 'is a quine' is a quine — Thomas Hurst <tom.hurst@...>
In case anyone's bored, how about another of those nice challanges?
[#33499] SourceForge Foundry for Ruby ? — Richard Harlos <quadzero@...>
Hi, folks. I'm interested to know if any of you would support the
[#33500] Ruby Embedded Documentation — William Djaja Tjokroaminata <billtj@...>
Hi,
> Now, I am using Ruby on Linux, and I have downloaded Ruby version
>>>>> "L" == Lyle Johnson <ljohnson@resgen.com> writes:
In message "Re: Ruby Embedded Documentation"
[#33518] Ruby interpreter's stability (hosting companies etc.) — Tobias Reif <tobiasreif@...>
Hi,
[#33535] Class variable madness — stern@... (Alan Stern)
Can someone tell me what's going on here? Or has this already been fixed?
[#33556] ByteCodeRuby 0.1.0 — "triptych" <triptych@...>
The latest version of ByteCodeRuby is now available from the RubyVM project
[#33560] syntax across languages — Pixel <pixel@...>
http://merd.net/pixel/language-study/syntax-across-languages.html
[#33570] array diff — Tobias Reif <tobiasreif@...>
Hi,
[#33607] Ruby browser similar to Smalltalk browsers? — John Clarke <clarkej@...>
Hi,
[#33615] Name resolution in Ruby — stern@... (Alan Stern)
I've been struggling to understand how name resolution is supposed to
[#33617] choice of HTML templating system — Paul Brannan <paul@...>
I am not a web developer, nor do I pretend to be one.
[#33619] make first letter lowercase — sebi@... (sebi)
hello,
sebi wrote:
On Feb 11, Tobias Reif said:
[#33630] Help with i18n and RDoc, please.... — Dave Thomas <Dave@...>
[#33672] rubycentral.com down? — J Anthony <jeremy@...>
pardon me if this is the wrong place to ask, but what's up with
[#33695] Ruby/Tk reference — Nemesis@... (Nemesis)
Hi everyone, I'm searching for a free ruby/tk reference (I've found one
[#33702] eruby + apache and charset — Yuri Leikind <YuriLeikind@...>
Hello all,
[#33711] Ruby Developer's Guide has arrived :-) — David Alan Black <dblack@...>
Hi --
[#33712] Ruby performance on the Language Shootout — ptkwt@...1.aracnet.com (Phil Tomson)
I haven't taken a look at the Great Computer Language Shootout page for
[#33715] Possible bug -- ruby cvs (1.7.2 2002-02-10) interpreter seg fault — Matt Armstrong <matt@...>
If I run this script
[#33731] simple XML parsing (greedy / non-greedy — Ron Jeffries <ronjeffries@...>
Suppose I had this text
[#33743] qualms about respond_to? idiom — David Alan Black <dblack@...>
Hi --
David Alan Black <dblack@candle.superlink.net> writes:
Hi --
Paul Brannan <paul@atdesk.com> writes:
David Alan Black <dblack@candle.superlink.net> writes:
[#33761] (CSV) text file processing... — bobx@... (Bob)
I am looking for an example of (csv)text file processing. What I am
[#33848] "Powered by Ruby" banner — Yuri Leikind <YuriLeikind@...>
Hello Ruby folks,
On Thu, 14 Feb 2002, Yuri Leikind wrote:
A modest submission:
Kent Dahl wrote:
On 2/15/02 5:54 AM, "yet another bill smith" <bigbill.smith@verizon.net>
i just don't understand why it didn't show up! dhtml/javascript, ok, but a
On 2/15/02 7:16 AM, "Jack Dempsey" <dempsejn@georgetown.edu> wrote:
Chris Gehlker wrote:
Thomas Hurst wrote:
In message <3c6e5e01_1@spamkiller.newsgroups.com>,
* Rob Partington (rjp@browser.org) wrote:
In message <20020216140007.GB75585@voi.aagh.net>,
* Rob Partington (rjp@browser.org) wrote:
Thomas Hurst wrote:
In article <3C6CFCCA.5AD5CA67@scnsoft.com>, Yuri Leikind wrote:
On Fri, 15 Feb 2002, Martin Maciaszek wrote:
On 2/15/02 10:59 AM, "Leon Torres" <leon@ugcs.caltech.edu> wrote:
Chris Gehlker wrote:
hello ppl,
[#33851] Ruby and .NET — Patrik Sundberg <ps@...>
I have been reading a bit about .NET for the last couple of days and must say
Hi,
On Thu, Feb 14, 2002 at 10:22:31PM +0900, Stephan J. Schmidt wrote:
On Thu, 2002-02-14 at 14:27, Patrik Sundberg wrote:
Erik B虍fors wrote:
Javier Fontan wrote:
Sean Middleditch wrote:
[#33885] File.open weirdness — "Craig Files" <craig_files@...>
Hi,
[#33899] building ruby — Mark Probert <probertm@...>
[#33915] Keyword arguments (Was: File.open weirdness) — Martin Man <Martin.Man@...>
On Fri, Feb 15, 2002 at 04:59:23AM +0900, Craig Files wrote:
[#33923] SWIG/Ruby woes with g++ 3.0 — Luigi Ballabio <ballabio@...>
> I just found a problem with generated SWIG code and g++ 3.0.3 which
Lyle,
> I don't think that this is fixed yet. (I attempted to email
[#33943] CGI::Session problems — dmcnulty@... (Dan McNulty)
Argh!
[#33996] Ruby threading and GUI toolkits — "Rich Kilmer" <rich@...>
I've encountered a bit of a dilemma. I need to have a GUI application with
[#34013] hash as key in hash — Albert Wagner <alwagner@...>
I don't understand why this doesn't work. Can anyone help?
[#34024] Compiled companion language for Ruby? — Erik Terpstra <erik@...>
Hmmm, seems that my previous post was in a different thread, I'll try
[#34030] LocalJumpError when defining each — Matt Kussow <junk@...>
The following script seems to work with ruby version 1.6.5, but not with 1.6.6.
Hello --
[#34036] The GUI Returns — "Horacio Lopez" <vruz@...>
Hello all,
[#34037] dump/load a class that has C and Ruby data — Joel VanderWerf <vjoel@...>
[#34048] Formatting — David Corbin <dcorbin@...>
In C, people use printf to format data nicely for display. In Java,
[#34053] OOP overhead (Was: tiny contest...) — Albert Wagner <alwagner@...>
I got stuck in a tar baby re: the tiny contest proposed by Tobias. I was
Richard Harlos wrote:
On 2/17/02 3:45 PM, "Sean Russell" <ser@germane-software.com> wrote:
[#34077] Problems with Ruby in C — Joakim Andersson <tyrak@...>
Hi,
[#34099] net/http or webfetcher with pasworded urls — Ron Jeffries <ronjeffries@...>
Hi, some help please ...
[#34107] x =~ /pat/, "return type?" — David Corbin <dcorbin@...>
When I say:
[#34131] alias danger — Joel VanderWerf <vjoel@...>
[#34162] Epic4/Ruby — Thomas Hurst <tom.hurst@...>
Rejoice, for you no longer have to put up with that evil excuse for a
On Tue, Feb 19, 2002 at 01:31:01AM +0900, Thomas Hurst wrote:
Hi,
In article <1014312459.984378.27488.nullmailer@ev.netlab.jp>,
[#34179] expect.rb vs Expect (Tcl)... — Hugh Sasse Staff Elec Eng <hgs@...>
I have had a look at the expect.rb in the 1.6 library.
[#34183] Rinn and Perl CORBA::ORBit — Selander@...
Good evening,
On Tue, Feb 19, 2002 at 04:57:43AM +0900, Selander@thomases.com wrote:
[#34185] Operator overloading and multiple arguments — ptkwt@...1.aracnet.com (Phil Tomson)
I'm trying to overload the '<=' operator in a class in order to use it for
[#34189] FalseClass / TrueClass singleton methods? — Brad Hilton <bhilton@...>
Hello,
"Brad Hilton" <bhilton@vpop.net> wrote in
[#34206] Anonymous class support — David Corbin <dcorbin@...>
I find Java anonymous classes to be very helpful when writing UnitTests,
[#34217] Ruby for web development — beripome@... (Billy)
Hi all,
Hey!
[#34228] RE: Ruby, PickAxe, FreeRIDE mentioned on BYTE magazine — "Curt Hibbs" <curt@...>
Horacio Lopez wrote:
[#34284] advice on dispatch tables — Mark Probert <probertm@...>
[#34294] Java JNI and Ruby — "Rich Kilmer" <rich@...>
I know about the JRuby project, but has anyone looked in to just embedding
[#34304] strings embedded inside strings — Paul Brannan <paul@...>
I've seen this on the ML before, but searching the ruby-talk archives I
[#34315] eRuby and require — beripome@... (Billy)
Hi all,
[#34329] ruby booting? — Chris Moore <kurisu@...>
This is gonna sound crazy but how hard would it be to make ruby boot as
[#34335] patch to allow dump/load to work on DATA objects — Joel VanderWerf <vjoel@...>
[#34350] FAQ for comp.lang.ruby — "Hal E. Fulton" <hal9000@...>
RUBY NEWSGROUP FAQ -- Welcome to comp.lang.ruby! (Revised 2001-2-18)
> Ruby selectively integrates many good ideas taken from Perl,
Hi,
matz@ruby-lang.org (Yukihiro Matsumoto) writes:
[#34361] REBOL vs Ruby — beripome@... (Billy)
Hi all,
Hi,
[#34375] Setting the Ruby continued — <jostein.berntsen@...>
Hi,
Also VERY important:
Hello,
Ok, I can't take part in developing ruby not becouse of the language
-----BEGIN PGP SIGNED MESSAGE-----
[#34379] including files in eruby — Martin Maciaszek <mmaciaszek@...>
I'm using eruby on some of my web pages. Now they became big and
[#34405] Now I'm really confused! — Chris Gehlker <gehlker@...>
I'm still struggling with producing RubyStudio. The following example
[#34412] dang it, CGI::Session is broken again — dmcnulty@... (Dan McNulty)
What is wrong with this? I swear this was working yesterday, but now
[#34446] eRuby and erb — moontoeki@... (Sung Moon)
I would like to use either of eRuby or erb for my web design.
[#34457] Help with blocks? — "Pattern-chaser" <patternChaser@...>
I'm trying to learn Ruby; just started. I like what I've understood
[#34467] recursive require — Ron Jeffries <ronjeffries@...>
I'm having a really odd thing happen with two files that mutually
[#34489] IPSocket.getaddress and signals — Joseph McDonald <joe@...>
[#34503] special characters — Tobias Reif <tobiasreif@...>
Hi all,
Urban Hafner wrote:
[#34515] Rubicon Failure — Urban Hafner <ruby-lists@...>
Hey hey,
[#34517] Windows Installer Ruby 166-0 available — Andrew Hunt <andy@...>
[#34554] dispatching and class references — Mark Probert <probertm@...>
On Sat, Feb 23, 2002 at 04:19:19AM +0900, Mark Probert wrote:
[#34566] Ruby's Future — Paulo Schreiner <paulo@...>
Hello, folks, what are the plans for the future of ruby? What new
Speaking of which, I remember and argument I brought up (and some of
Hi,
[#34597] rdoc/xml questions — Dave Thomas <Dave@...>
> From: dave@thomases.com [mailto:dave@thomases.com]On Behalf Of Dave
james@rubyxml.com writes:
james@rubyxml.com wrote:
[#34631] Object/Memory Management — "Sean O'Dell" <sean@...>
I'm new to Ruby and the community here (I've been learning Ruby for a grand
"Sean O'Dell" <sean@celsoft.com> writes:
On 2/23/02 5:15 PM, "Dave Thomas" <Dave@PragmaticProgrammer.com> wrote:
"Sean Middleditch" <elanthis@awesomeplay.com> wrote in message > On Sat,
On Sun, 2002-02-24 at 04:22, Sean O'Dell wrote:
[#34661] Re: Newbie question — "roktas" <roktas@...>
Hi,
Hello --
Hi!
[#34682] duplicate method name — Ron Jeffries <ronjeffries@...>
I just found a case in a test file where i had two tests of the same
Hi Ron.
On Sun, 24 Feb 2002 15:49:49 GMT, Dave Thomas
[#34732] Hash.each block parameters — "Sean O'Dell" <sean@...>
I ran into a problem where I should have called .each_key for a hash, but I
[#34735] TestUnit 0.1.1 — <nathaniel@...>
From the README:
[#34748] Assignment Rules — "Sean O'Dell" <sean@...>
I'm trying to get in my head what the rules about assignment are. So far
[#34750] inconsistence in class complex — juergen.katins@... (Juergen Katins)
While translating the book "Programming Ruby" by Dave Thomas and
[#34753] 9 years with Ruby — matz@... (Yukihiro Matsumoto)
Hi,
[#34762] Directory copy recursively — kwatch@... (kwatch)
Hi,
[#34777] CONFIG['(site|ruby)libdir'] policies? — Massimiliano Mirra <list@...>
On my system (Debian Linux), Config::CONFIG['sitelibdir'] and
Massimiliano Mirra <list@chromatic-harp.com> writes:
[#34778] Re: Windows Installer Ruby 166-0 available — Andrew Hunt <andy@...>
Alexander writes:
[#34780] RCR 65: IO orthogonalization, improved reusability — "Thomas Sdergaard" <tsondergaard@...>
I hope I'm not violating the rubiqette by cross-posting this from
"Thomas Sdergaard" <tsondergaard@speakanet.com> writes:
[#34783] Re: [ANN] TestUnit 0.1.1 — Tobias Reif <tobiasreif@...>
Dave, it would be nice if you could explain what I'm missing.
[#34791] Style Question — Ron Jeffries <ronjeffries@...>
So I'm building this set theory library. The "only" object is supposed
[#34823] Can't get stderr to flush — Chris Gehlker <gehlker@...>
[#34835] Standard preambles and prompting on standard error? — Chris Gehlker <gehlker@...>
I've been testing RubyStudio against the sample programs that come with
[#34857] TestUnit 0.1.3 — <nathaniel@...>
From the README:
[#34896] New OS for Old Mac — Chris Gehlker <gehlker@...>
I have an old Mac 6400 that I want to use as a server. Ruby for the old Mac
[#34905] Rescue Clause — "Sean O'Dell" <sean@...>
Where all can you put rescue clauses? Are these correct:
[#34912] RCR?: parallel to until: as_soon_as — Tobias Reif <tobiasreif@...>
Hi,
Hi --
[#34920] RE: Kernel.system incongurity - Windows98 — "Morris, Chris" <chris.morris@...>
[#34941] rpkg 0.3 pre-release and beta testers — Massimiliano Mirra <list@...>
I've just uploaded rpkg 0.3 to www.allruby.com/rpkg/rpkg-0.3.tar.gz
[#34961] RE: RCR 65: IO orthogonalization, improved reusability — =?Windows-1252?Q?Thomas_S=F8ndergaard?= <tsondergaard@...>
"Thomas Sdergaard" <tsondergaard@speakanet.com> wrote in message
[#34971] RDoc and XML - opinions please — Dave Thomas <Dave@...>
[#34972] OT A Question on work styles — Chris Gehlker <gehlker@...>
As a Mac baby I just had to step through ruby in GDB *from the command line*
Hi,
On Thu, 28 Feb 2002 05:21:24 GMT, Chris Gehlker <gehlker@fastq.com> wrote:
[#34998] Matrix class in Ruby — jasa <jasa@...>
Hi,
[#35007] DRb TupleSpace Example Poofter — edwardhatfield1@... (Edward Hatfield)
Hello All,
[#35008] RDoc with XML — Dave Thomas <Dave@...>
[#35015] Time Comparison — "Sean O'Dell" <sean@...>
I am using the time object to compare times between two files and I'm
Hi
Ruby + XML Proposal
The following is a sample application that will be included with the next revision
of the Ruby Publication Framework (which will hopefully be released sometime early
next week):
require 'rexml/document'
require 'RPF/console'
serializer = Framework::Serializer::REXMLSerializer.new()
parser = Framework::XML::FrameworkParser.new(serializer)
parser.register(Framework::Transformer::XIncludeTransformer.new())
parser.parse(File.new('default.xml'))
doc = serializer.document
# The rest of this is 100% REXML code
print "doc is an instance of: #{doc.class}\n\n"
doc.write $stdout
print "\n"
This application loads an XML file (default.xml) from disk, and then builds a REXML
DOM object from a SAX2-like stream events. In and of itself, this isn't a very
interesting way to create a REXML document. However, in the middle of the
application is the following line:
parser.register(Framework::Transformer::XIncludeTransformer.new())
What this line does is it registers a class that implements the W3C XInclude
specification. This class will receive ALL events that exist in the XInclude
namespace, load any specified XML documents and insert their content into the
middle of the XML stream!
So, what I've effectively done is added XInclude support into REXML. But the fun
doesn't stop there!
Because of the way the framework is built, these events are fired off to components
based upon their namespaces (if they don't exist in any particular namespace, they
are sent directly to the Serializer which sits at the end of the chain). Because
each event goes back to the same dispatcher, if XML document A includes XML
document B, and then XML document B includes XML document C, then XML document A
will be able to include XML document C as part of XML document B without you having
to do any extra work on your part (as long as they all agree on the same include
standard and you register the transformer that implements it).
I can register as many of these transformers as I feel necessary. For instance,
what if I want to include a SQL statement in my XML document, execute the SQL
statement, and transform it's results into part of the XML document? Just write a
new transformer and register it. What if I want a looping construct to repeat a
part of the XML document a number of times? Create another transformer. Or how
about an XSL transformer that transforms only a part of the XML document, creates
an XInclude tag, and then the XInclude tag gets expanded out to contain the
contents of the included document? Very easy to implement!
What the framework essentially gives you is the ability to create smart tags for
your XML documents that behave a lot like Java Tag Libraries, but are completely
seperate from web applications!! But there's more:
The framework also has the ability to get the input stream of events from any
number of sources. Maybe you don't want to go through the trouble of creating a
component that implements a custom set of tags, and want to generate the XML
document a bit more programmaticaly. With the framework, you can swap out the
default generator which reads XML documents from disk for another one. The first
alternate generator already built into the framework uses ERuby to generate XML
documents. You could put all your logic into an ERuby XML document, yet still use
the framework to implement XInclude support (or any other transformers which may be
available):
generator = Framework::Generator::ERubyGenerator.new()
generator.source = "default.erb"
parser.generator = generator
Or maybe you have a REXML document already loaded in memory and want to run that
through the processor. Easy enough, use the included REXMLGenerator which takes a
REXML DOM document and converts it into a stream of events:
generator = Framework::Generator::REXMLGenerator.new()
generator.source = my_rexml_obj
parser.generator = generator
The RPF also includes a few other nifty abilities. One of those is the ability to
explicitly apply Transformers that capture *ALL* streamed events. A stylesheet for
the whole XML document is an example of when you'd need one. You can have an XML
document on disk, and then use the built in SablotronTransformer to apply a
stylesheet to the XML document before you load it into the REXML dom:
xsl = Framework::Transformer::SablotronTransformer.new()
xsl.source = 'default.xsl'
parser.addTransformer(xsl)
These transformers are applied in the order they are added (you can add as many as
you want), and you can control whether the namespace based transformers are
dispatched inbetween them or not.
The best part about this is that since the dispatcher only dispatches the events
that a transformer will recognize, this greatly simplifies transformer
development! In fact, the XInclude transformer (which admittedly isn't 100%
compliant) is only about 20 lines of code right now, and most of that is for
loading the XML document and creating a new XML parser to originate the new event
stream.
Finally, the last part the framework does is it adds infrastructure for building
dynamic Web applications using this stuff by changing the pipeline on the fly via
an XML base sitemap. This of course, a discussion completely on it's own. ;)
Now, you ask, why am I posting this instead of just releasing the newest code?
Well, I'm at a bit of a cross-roads. The REXML stuff is a good example. The next
version of the framework will have integrated support for cooperating with REXML,
but I want to go a step further. I want to not just cooperate with REXML, but
*ALL* other Ruby XML stuff out there (NQXML, XMLParser, XSLT4R, you name it).
There are two ways to accomplish this, the quick easy short term method: build the
support into the framework. And the harder but more rewarding long term method:
build the support directly into the corresponding Ruby libraries.
An ideal example would be to abstract away the REXML(Generator|Serializer) and
replace it with a Stream(Generator|Serializer). The stream based components would
work explicitly with the SAX2-like stream of events. The code that generates the
stream from a REXML document would then be moved into REXML, and the code which
generates a REXML document from a stream would be moved into REXML as well. All
other libraries could implement similar code, and then plug in directly with the
Stream components in the framework. Overtime, the actual implementations
themselves could become less hacky and use real stream based implementations for
additional speed benefits. A side effect is that you would then be able to connect
a REXML stream generator to an NQXML document creator and convert a REXML document
into an NQXML document (and vice versa) as efficiently as possible and in a
standardized way (or do the same with any other conformant library).
I can provide the initial code for the various XML libraries (and will have the
starting REXML code ready early next week). But to really do this well, we all
need to agree on a streaming model for Ruby. Below is my proposal on what this
model should be. This is more or less how my framework is implemented at the
moment. Below it is some commentary on why certain things are as they are. I'd
like for us to come to an agreement (if at all possible) before I get any futher
into building the RPF framework, as the more code I write, the harder it will be to
implement any major changes:
module DocumentHandler
# Contains unencoded character content (needs to be encoded when inserted into
# the XML stream so it doesn't screw up the final XML document). ch is a
# string, and start and length are used so that ch can actually be a substring
# of a larger string (avoids some uneccessary string copying).
def characters(ch, start, length)
# Similar to characters, however contains the contents of a comment *excluding*
# the <!-- begin and --> end tags.
def comment(ch, start, length)
# Notifies the end of an XML stream
def endDocument()
# Notifies the end of an XML element. URI is the namespace that the element
# exists in (nil if there is none). localName is the name of the XML tag.
# qName is the fully qualified name (i.e. if there was a namespace qualifier,
# it would contain "qualifier:#{localName}" otherwise it would be the
# "#{localName}").
def endElement(uri, localName, qName)
# Passes ignorable whitespace the same way characters are passed.
def ignorableWhitespace(ch, start, length)
# Passes a processing instruction (excluding the <? begin and ?> end tags)
def processingInstruction(target, data)
# This I'm open for debate, I never liked this anyway. Passes an object that
# contains a means to get information about the current position within the
# current XML document).
def setDocumentLocator(locator)
# returns the name of an entity that the previous XML stream couldn't
# figure out. For instance, if the XML document contained an
# element, this would receive a string containg: 'nbsp'
def skippedEntity(name)
# Notifies the beginning of an XML stream.
def startDocument()
# Notifies the start of an XML document. This *INCLUDES* namespace entries.
# All the params are the same as the endElement tag, and attrs is a Hash that
# contains all the attibutes (including any namespace entries) for this tag.
def startElement(uri, localName, qName, attrs)
end
Also, do we need to standardize on the ErrorHandler interface as well, or can we
simply rely on exceptions? (Personally I'd choose exceptions).
The major differences between this model and the XMLParser streaming model is that
this model formalizes namespace support, and greatly simplifies working with
namespaces.
The differences between this model and the SAX2 model are:
1. I've removed the startPrefixMapping and endPrefixMapping events, and moved
namespace declarations back into the attributes where they are in the XML
document. For the life of me I can't figure out why SAX2 implemented them this
way. The RPF framework originally used them, but I found it much simpler to move
them into the attrs hash.
2. Attributes are a hash, and not an object (though this is, like everything else,
open for discussion). I'm of the opinion that if you need to worry about attribute
namespaces, you should check the attribute names explicitly using regexps. There
are definitely good reasons to use a programmatic interface, however. Perhaps we
can have the best of both worlds by using a hash like object with extra
functionality (Ruby seems to be good at giving us the best of both worlds).
Finally, the differences between this and other currently available streaming
models:
1. Namespaces are supported.
2. We'll soon have a lot of infrastructure to coincide with this format (if you use
my stuff anyway ;)
3. A standard format that crosses XML library boundaries will give us a lot of
flexibility we just don't have right now.
That's my proposal. I'd like to hear your comments on it. I'll donate any code I
create (and some of my time) that can be used to help other projects along. If we
can come up with a standard, I'll create a writeup for the standard and add it to
the Ruby Guarden Wiki.
Finally, if you think all of this is just a load of hot air, I want you to think
about how you use IO streams. What do you do if you need to get at the contents of
a file that are compressed? You do the following:
contents = TarArchive.new(File.new('archive.tar.gz')).read()
puts contents
This works because we all agree on what an IO stream is supposed to look like. We
can have this same kind of synergy when working with XML, we just need to come up
with a standard and stick with it ;)
Thanks for reading all this!
Bryan