Suggestion for an XML and ZLIB library?

Greetings all,

Some of you might remember me. I used to be in this list, but school has
kept me out of the loop for several months.

I’m trying to re-subscribe, but the ctl address isn’t working. Until I
get that sorted out, I’ll have to ask you to put my email on the CC line.

I plan on starting a simple project, and I want to try to do it in Ruby.

Lately I have become interested in the OpenOffice.org project, and am
fairly active in the users mailing list. I have seen several requests for
a program that can search for text inside OpenOffice.org files.

OOo SXW files are actually fairly simple conceptually. They are a
collection of XML files packed in a ZIP archive. That’s it. I have
already used Perl to write a couple of tiny programs to manipulate SXW
files.

So, I guess that my project requirements are:

  1. An XML library.
    After looking through RAA, I think I’ll pick XMLSimple and REXML.

  2. A ZIP librry.
    I need some help here. I saw “ruby-zlib” in RAA, but I can’t find
    any documentation. Is it good? All I need ZIP for is to extract
    one file from a ZIP archive. That’s it.

  3. Portability (since OOo is cross-platform).

This is tricker, but this is also part of what made me think of Ruby. OOo
users are roughly speaking 60% Windows, 40% Linux (at least, on the
list). The Windows users are technicially competent, but not savvy. I
have no qualms asking them to download some dependencies, but most won’t
have a compiler.

Are there any suggestions on the best way to approach this?

···


Daniel Carrera | OpenPGP KeyID: 9AF77A88
PhD grad student. |
Mathematics Dept. | “To understand recursion, you must first
UMD, College Park | understand recursion”.

Daniel Carrera wrote:

Greetings all,

Some of you might remember me. I used to be in this list, but school has
kept me out of the loop for several months.

I’m trying to re-subscribe, but the ctl address isn’t working. Until I
get that sorted out, I’ll have to ask you to put my email on the CC line.

Welcome back.

I plan on starting a simple project, and I want to try to do it in Ruby.

Lately I have become interested in the OpenOffice.org project, and am
fairly active in the users mailing list. I have seen several requests for
a program that can search for text inside OpenOffice.org files.

OOo SXW files are actually fairly simple conceptually. They are a
collection of XML files packed in a ZIP archive. That’s it. I have
already used Perl to write a couple of tiny programs to manipulate SXW
files.

Thanks. You’ll be saving me some trouble. :slight_smile:
I was looking at the XML files the other night, thinking what would be
involved in writing a Ruby lib to work with them.

So, I guess that my project requirements are:

  1. An XML library.
    After looking through RAA, I think I’ll pick XMLSimple and REXML.

  2. A ZIP librry.
    I need some help here. I saw “ruby-zlib” in RAA, but I can’t find
    any documentation. Is it good? All I need ZIP for is to extract
    one file from a ZIP archive. That’s it.

  3. Portability (since OOo is cross-platform).

This is tricker, but this is also part of what made me think of Ruby. OOo
users are roughly speaking 60% Windows, 40% Linux (at least, on the
list). The Windows users are technicially competent, but not savvy. I
have no qualms asking them to download some dependencies, but most won’t
have a compiler.

Are there any suggestions on the best way to approach this?

I have no profound sugeestion on shipping native code/compiled code
(ship a DLL?), but might I suggest looking into the Nullsoft installer
for instaling this on Windows? It does a good job of adding registry
entries and dropping files where they should go (e.g., the system dir or
application data directory). Then bundle all the dependencies in the
installer, rather than requiing users to go download and install many
seperate items.

There is a slick NSIS editor[1] that makes things much easier, and I can
give you hand if you like, as I’ve spent a bit of time using the
installer and the editor.

[0] NSIS Wiki
[1] http://espanol.geocities.com/ranametalcr/nisedt/index.htm

James Britt

james_b AT neurogami DOT com

Welcome back.

=)

Lately I have become interested in the OpenOffice.org project, and am
fairly active in the users mailing list. I have seen several requests for
a program that can search for text inside OpenOffice.org files.
[snip]

Thanks. You’ll be saving me some trouble. :slight_smile:
I was looking at the XML files the other night, thinking what would be
involved in writing a Ruby lib to work with them.

That’s a thought. I was thinking of a stand-alone program though. In
particular, I was thinking of an implementation of “grep” that took .sxw
files as input instead of text files.

Are there any suggestions on the best way to approach this?
[snip]

There is a slick NSIS editor[1] that makes things much easier, and I can
give you hand if you like, as I’ve spent a bit of time using the
installer and the editor.

Thanks, that’s a great idea.
There wouldn’t be very many dependencies. Just ruby and the three
libraries. The XML libraries are just ruby files. They don’t have to be
compiled.

I guess that now I have to figure out the best way to extract a file from a
zip archive. I couldn’t get ruby-zlib to compile.

I am running ruby 1.8.0 under Solaris 2.8.

ruby-zlib-0.6.0 $ ruby extconf.rb
checking for deflateReset() in -lz… yes
checking for zlib.h… yes
checking for rb_block_given_p()… yes
checking for rb_str_buf_new()… yes
checking for rb_io_print()… yes
checking for rb_io_printf()… yes
checking for rb_io_puts()… yes
checking for rb_io_addstr()… yes
checking for rb_define_alloc_func()… yes
checking for rb_undef_alloc_func()… yes
checking for kind of operating system… Unix
creating Makefile
ruby-zlib-0.6.0 $ gmake
gcc -fPIC -g -O2 -I. -I/home3/dcarrera/lib/ruby/1.8/sparc-solaris2.8
-I/home3/dcarrera/lib/ruby/1.8/sparc-solaris2.8 -I. -DHAVE_ZLIB_H
-DHAVE_RB_BLOCK_GIVEN_P -DHAVE_RB_STR_BUF_NEW -DHAVE_RB_IO_PRINT
-DHAVE_RB_IO_PRINTF -DHAVE_RB_IO_PUTS -DHAVE_RB_IO_ADDSTR
-DHAVE_RB_DEFINE_ALLOC_FUNC -DHAVE_RB_UNDEF_ALLOC_FUNC -DOS_CODE=OS_UNIX -c
zlib.c
zlib.c:107: parse error before `NORETURN’
zlib.c:107: warning: data definition has no type or storage class
gmake: *** [zlib.o] Error 1

Any thoughts?f

Cheers,

···

On Sat, Oct 25, 2003 at 09:34:49PM -0700, James Britt wrote:

Daniel Carrera | OpenPGP KeyID: 9AF77A88
PhD grad student. |
Mathematics Dept. | “To understand recursion, you must first
UMD, College Park | understand recursion”.

Hi,

···

At Sun, 26 Oct 2003 14:46:54 +0900, Daniel Carrera wrote:

I guess that now I have to figure out the best way to extract a file from a
zip archive. I couldn’t get ruby-zlib to compile.

I am running ruby 1.8.0 under Solaris 2.8.

Why don’t you use zlib of 1.8.0 standard libraries?


Nobu Nakada