Forum: Ruby LibXML-Ruby 0.3.6

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-02-23 20:35
(Received via mailing list)
LibXML-Ruby 0.3.6 is now available from Rubyforge. LibXML-Ruby is (as
you may have guessed) a C-language Ruby binding to the Gnome LibXML2
library, supporting a wide range of XML technologies and offering very
competitive performance across the board.

You can obtain LibXML-Ruby via Rubygems:

	gem install libxml-ruby

Or as standard tarball/zip packages:

	http://rubyforge.org/frs/?group_id=494&release_id=4388

This release is essentially our 'ground zero' release after a recent
effort to revive the sleeping LibXML-Ruby project with the help of
original author Sean Chittenden. Although fixes for a number of bugs in
the build and the code are included, no new functionality has yet been
added. We are keen to gain feedback from the community, whether positive
or negative, with a view to fixing the direction of the project. Our
mailing list:

	libxml-devel@rubyforge.org

You can find (a bit) more information, and API documentation, at the
project website on Rubyforge:

	http://libxml.rubyforge.org/

(Please note, *not* xml-tools as was previously the case).

For more information on the XML technologies supported by LibXML2, or
for help obtaining or installing it, please see:

	http://xmlsoft.org/
4c8a9bec5a27b66b28d3c5cddeb70e93?d=identicon&s=25 Mr. Big (Guest)
on 2006-02-23 20:48
Will this library be renamed LibXML2-Ruby soon? The current name is
slightly misleading.
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-02-23 21:02
(Received via mailing list)
On Fri, 2006-02-24 at 04:48 +0900, Mr. Big wrote:
> Will this library be renamed LibXML2-Ruby soon? The current name is
> slightly misleading.
>

Yes, I have to agree. But the project was previously under the name
'libxml-ruby' and we wanted to get a release out quickly, with minimal
changes (beyond fixing things). This release should be completely
compatible with existing code, including the "require 'xml/libxml'"
part.

We're hoping to get feedback from this release and work that into the
next minor release, 0.4.0. Maybe between now and then we can slip a name
change in there ...
D111305c32e46f7dd2794a956208d347?d=identicon&s=25 E. Saynatkari (Guest)
on 2006-02-23 21:14
Ross Bamford wrote:
> On Fri, 2006-02-24 at 04:48 +0900, Mr. Big wrote:
>> Will this library be renamed LibXML2-Ruby soon? The current name is
>> slightly misleading.
>>
>
> Yes, I have to agree. But the project was previously under the name
> 'libxml-ruby' and we wanted to get a release out quickly, with minimal
> changes (beyond fixing things). This release should be completely
> compatible with existing code, including the "require 'xml/libxml'"
> part.
>
> We're hoping to get feedback from this release and work that into the
> next minor release, 0.4.0. Maybe between now and then we can slip a name
> change in there ...

Good work! I prefer the API (and, obviously, the speed)
over that of REXML. I do concur about the naming. Either
make it libxml2-ruby or bump the version to 2.3.6 :)

Thanks!


E
6ff7cc79a09836e7930763a9d8b6ba9a?d=identicon&s=25 Dominic Sisneros (Guest)
on 2006-02-23 22:31
(Received via mailing list)
Tried to install it under windows and it failed because I didn't have
Zlib.
This is with the ruby one click installer.

Thanks
C475cffda1800fbc3f3af17bc10c220f?d=identicon&s=25 Curt Hibbs (Guest)
on 2006-02-24 13:00
(Received via mailing list)
Strange, because ZLib *is* included in the one-click installer.

Curt
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-02-24 14:05
(Received via mailing list)
On Fri, 2006-02-24 at 21:00 +0900, Curt Hibbs wrote:
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-02-24 14:12
(Received via mailing list)
On Fri, 2006-02-24 at 22:05 +0900, Ross Bamford wrote:
> On Fri, 2006-02-24 at 21:00 +0900, Curt Hibbs wrote:
> > On 2/23/06, Dominic Sisneros <dsisnero@gmail.com> wrote:
> > > Tried to install it under windows and it failed because I didn't have Zlib.
> > > This is with the ruby one click installer.
> > Strange, because ZLib *is* included in the one-click installer.
> >
> > Curt
> >

(Wrong button, excuse the noise)

Does it include the zlib.h header ?

If so, OP could maybe try passing --with-zlib=<path> option to a manual
install, but I'm not sure yet how it could work with gems...
C475cffda1800fbc3f3af17bc10c220f?d=identicon&s=25 Curt Hibbs (Guest)
on 2006-02-24 16:55
(Received via mailing list)
On 2/24/06, Ross Bamford <rossrt@roscopeco.co.uk> wrote:
> (Wrong button, excuse the noise)
>
> Does it include the zlib.h header ?
>
> If so, OP could maybe try passing --with-zlib=<path> option to a manual
> install, but I'm not sure yet how it could work with gems...

No, it just includes the executable. The release notes show the exact
version, so you could download the source and extract the header.

Curt
01d68aff859065b5cbc1cfc67cb16871?d=identicon&s=25 Keith Fahlgren (Guest)
on 2006-02-24 17:33
(Received via mailing list)
On Thursday 23 February 2006 2:32 pm, Ross Bamford wrote:
> LibXML-Ruby 0.3.6 is now available from Rubyforge. LibXML-Ruby is (as
> you may have guessed) a C-language Ruby binding to the Gnome LibXML2
> library, supporting a wide range of XML technologies and offering
> very competitive performance across the board.

Wow, this is a pretty incredible speedup!

<meaningless:benchmark filled-with-mistakes="true">
Input doc:
keith@devel /work/frame/templates/main $ du -h main.chap.mx && wc
main.chap.mx
2.2M    main.chap.mx
  21063   75272 2287526 main.chap.mx


LibXML
keith@devel /work/frame/templates/main $ time ruby -e "require
'rubygems'; require 'xml/libxml'; d =
XML::Document.file('main.chap.mx'); d.find('//String').each{|n| puts
n}" | wc
   2090    9200   99275

real    0m0.785s
user    0m0.728s
sys     0m0.068s


REXML:
time ruby -e "require 'rexml/document'; d =
REXML::Document.new(File.new('main.chap.mx')); REXML::XPath.each(d,
'//String/'){|n| puts n.text}" | wc
   2090    9200   60422

real    1m41.021s
user    1m40.710s
sys     0m0.308s

Computer: 2 x PIII 650Mhz, 1GB RAM
</meaningless:benchmark>

Nice work, folks.

Keith
Ccfe7d097475a32dc3ff78d6fc42c852?d=identicon&s=25 List Recv (lstrecv)
on 2006-02-24 17:39
(Received via mailing list)
Great!

Could you please explain to us uninitiated the advantages (and
disadvantages) of this over REXML?
65bd9e4c5aebde25ebf16d599339d570?d=identicon&s=25 Adam Sanderson (Guest)
on 2006-02-24 18:36
(Received via mailing list)
This sounds great.  Thanks for producing these bindings.  I am really
glad to see this as it adds a simple interface for validating against
an xml schema.

Sadly I'll eventualy need to get this compiled on windows, which I've
never had much luck with ;)

  .adam
C8da03a9f69be8910fa9b16b4db969ed?d=identicon&s=25 unknown (Guest)
on 2006-02-24 20:08
(Received via mailing list)
Ross Bamford <rossrt@roscopeco.co.uk> wrote:

>
> You can obtain LibXML-Ruby via Rubygems:
>
>       gem install libxml-ruby
>
> Or as standard tarball/zip packages:
>
>       http://rubyforge.org/frs/?group_id=494&release_id=4388

looks really great, thanks for your work.

i plane to use this binding within a MacOS X application.

for me, including "libxml-ruby" is easy using stadalonift.rb from
Jonathan Paisley, but i wonder on how to embed also the gnome libxml2
correctly bind to ruby...

do you have some advices for that point ?
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-02-25 04:15
(Received via mailing list)
On Sat, 2006-02-25 at 01:38 +0900, listrecv@gmail.com wrote:
> Great!
>
> Could you please explain to us uninitiated the advantages (and
> disadvantages) of this over REXML?

I'll try, but I have to admit I've never made serious use of REXML.

I think the main difference really is that REXML is implemented in Ruby,
whereas LibXML-Ruby is a C-language binding to a native library (that
being, somewhat confusingly I must admit, the Gnome LibXML2 library).

The main upshot of this is speed, and supported functionality - most
(though not all) operations are faster with LibXML-Ruby than with REXML,
mainly due to the native implementation, but partly because LibXML2 is
itself pretty quick too. Thanks to it's place in Gnome, LibXML2 also
allows us to support a range of XML-related technologies that REXML
doesn't (as far as I'm aware?), including stable support for namespaces,
XPointer, XInclude, catalogues, and more. Obviously full support is
present for XPath, too (as in REXML I think).

Possibly more important than any of that depending on your usage is
validation: LibXML2 (and by extension LibXML-Ruby) fully support DTD
validation, and has some support for XML Schema (not exactly sure on the
current status of this).

I won't get into any 'our library is better than your library'
discussions, because it's not about that - the two are different animals
that happen to share a hunting ground. The reasons for choosing one or
the other come down to a combination of your requirements in terms of
performance, what you need to do with your XML, whether or not you can
compile LibXML2 and extensions on your target platform, and your
personal preference in terms of which API you prefer.
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-02-25 04:21
(Received via mailing list)
On Sat, 2006-02-25 at 02:33 +0900, Adam Sanderson wrote:
> This sounds great.  Thanks for producing these bindings.  I am really
> glad to see this as it adds a simple interface for validating against
> an xml schema.
>
> Sadly I'll eventualy need to get this compiled on windows, which I've
> never had much luck with ;)

Hopefully if you have the required libraries it will work, but I have to
admit to not knowing much about compiling stuff on Windows...

One of the things we're interested in with this release is getting a
handle on cross-platform issues. There have been long-standing OSX
issues which are hopefully now fixed, but with limited hardware/software
for testing it's really important that we get reports of any problems
from OSX and Windows users.
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-02-25 04:30
(Received via mailing list)
On Sat, 2006-02-25 at 04:08 +0900, Une bévue wrote:
>
> looks really great, thanks for your work.
>
> i plane to use this binding within a MacOS X application.
>
> for me, including "libxml-ruby" is easy using stadalonift.rb from
> Jonathan Paisley, but i wonder on how to embed also the gnome libxml2
> correctly bind to ruby...
>
> do you have some advices for that point ?

I'm afraid I can't be much help there, I've no experience with OSX. I've
seen standaloneify.rb but it lost me at "Takes a built RubyCocoa app
bundle (as produced by the Xcode/ProjectBuilder template)..."
C8da03a9f69be8910fa9b16b4db969ed?d=identicon&s=25 unknown (Guest)
on 2006-02-25 09:44
(Received via mailing list)
Ross Bamford <rossrt@roscopeco.co.uk> wrote:

>
> I'm afraid I can't be much help there, I've no experience with OSX. I've
> seen standaloneify.rb but it lost me at "Takes a built RubyCocoa app
> bundle (as produced by the Xcode/ProjectBuilder template)..."

even not general advices ?

what i think about that :

make a try apart (in my HOME)

with a fresh ruby, libxml2 and RubyLibxml.


what i have to know is the process of binding that's to say how your
RubyLibxml find ruby and libxml2, probably this is done at the config
step.

then, i can catch the right parameters to get that binding into my fresh
HOME Ruby and Libxml2 ?

anyway i'll ask on the RubyCocoa-talk list...
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-02-25 15:56
(Received via mailing list)
On Sat, 2006-02-25 at 17:43 +0900, Une bévue wrote:
>
> make a try apart (in my HOME)
>
> with a fresh ruby, libxml2 and RubyLibxml.
>
>
> what i have to know is the process of binding that's to say how your
> RubyLibxml find ruby and libxml2, probably this is done at the config
> step.
>

Yes, it's handled by ext/xml/extconf.rb . The Ruby version you build
against is determined by the Ruby you run that script with. You can pass
in the path to libxml in usual extconf style (--with-xml2-dir or
--with-xml2-lib and --with-xml2-include).

You'll need to manually run the extconf (rather than relying on the
Rakefile) to pass in those options and then run make as usual.
C8da03a9f69be8910fa9b16b4db969ed?d=identicon&s=25 unknown (Guest)
on 2006-02-25 20:09
(Received via mailing list)
Ross Bamford <rossrt@roscopeco.co.uk> wrote:

>
> Yes, it's handled by ext/xml/extconf.rb . The Ruby version you build
> against is determined by the Ruby you run that script with. You can pass
> in the path to libxml in usual extconf style (--with-xml2-dir or
> --with-xml2-lib and --with-xml2-include).
>
> You'll need to manually run the extconf (rather than relying on the
> Rakefile) to pass in those options and then run make as usual.

OK, fine i'll give it a try ASAP and let you know.
7243f9f4653bf65af7938c68c7e3c182?d=identicon&s=25 Joe (Guest)
on 2006-02-25 23:51
(Received via mailing list)
This is great news - does the library include bindings for libxslt as
well?
9358cc96c46055cd68d4a76a9aefe026?d=identicon&s=25 Daniel Harple (Guest)
on 2006-02-26 00:06
(Received via mailing list)
On Feb 23, 2006, at 8:32 PM, Ross Bamford wrote:
> LibXML-Ruby 0.3.6 is now available from Rubyforge

I am having some trouble with building.

1) I have two libiconvs installed, one supplied with my OS in
    /usr and another in /opt/local. Using
    --with-iconv-dir=/opt/local fails to locate libiconv, but
    --with-iconv-dir=/usr works. I made a change to extconf.rb:

$ diff libxml-ruby-0.3.6.orig/ext/xml/extconf.rb libxml-ruby-0.3.6/
ext/xml/extconf.rb
45,46c45,49
< unless have_library('iconv','iconv_open') or have_library
('c','iconv_open') or
<   have_library('recode','iconv_open')
---
 >
 > unless have_library('iconv') or
 >        have_library('iconv','iconv_open') or
 >        have_library('c','iconv_open') or
 >        have_library('recode','iconv_open')

    and --with-iconv-dir=/opt/local worked.

2) You call two shell commands, xml2-config and xslt-config. I
    have two versions of libxml2 and libxslt installed, so this
    command is dependent on the correct command being in my PATH
    before the other one. I am not sure what to do about this
    problem.

-- Daniel
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-02-26 00:15
(Received via mailing list)
On Sun, 2006-02-26 at 07:48 +0900, Joe wrote:
> This is great news - does the library include bindings for libxslt as
> well?
>

We're working separately on bringing the libxslt bindings up to date in
the same way. We decided to concentrate on a first libxml release before
moving on to that.

I'm hoping to get baseline code into CVS this week, with a release to
follow ASAP.
6ff7cc79a09836e7930763a9d8b6ba9a?d=identicon&s=25 Dominic Sisneros (Guest)
on 2006-02-26 01:31
(Received via mailing list)
What is the difference between this and xml-smart.  It looks like
xml-smart
has bindings for libxml also.
http://raa.ruby-lang.org/project/ruby-xml-smart
http://www.pri.univie.ac.at/~mangler/ruby-xml-smart/
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-02-26 01:34
(Received via mailing list)
On Sun, 2006-02-26 at 08:04 +0900, Daniel Harple wrote:
> $ diff libxml-ruby-0.3.6.orig/ext/xml/extconf.rb libxml-ruby-0.3.6/
>  >        have_library('recode','iconv_open')
>
>     and --with-iconv-dir=/opt/local worked.
>

I'm not sure about this - I'm still finding my way around some things
here, but I'm pretty sure we do need iconv_open(3) in libiconv. Does it
compile with this change?

I'm going to forward this as a possible change to the mailing list at
libxml-devel@rubyforge.org .

> 2) You call two shell commands, xml2-config and xslt-config. I
>     have two versions of libxml2 and libxslt installed, so this
>     command is dependent on the correct command being in my PATH
>     before the other one. I am not sure what to do about this
>     problem.

If you are passing --with-xml2-<whatever> settings, you should be fine
to comment-out the lines that run those scripts (for both CFLAGS and
LDFLAGS). If that works for you I'll fix it with a default to the
dir_config and commit it.

(I'm still finding new stuff in mkmf so if I'm missing anything, please
let me know :))
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-02-26 01:59
(Received via mailing list)
On Sun, 2006-02-26 at 09:28 +0900, Dominic Sisneros wrote:
> What is the difference between this and xml-smart.  It looks like xml-smart
> has bindings for libxml also.
> http://raa.ruby-lang.org/project/ruby-xml-smart
> http://www.pri.univie.ac.at/~mangler/ruby-xml-smart/
>

In all honesty, I've no idea. A quick glance suggests some differences
in API, I think this is a slightly thinner layer on top of LibXML2 but
then I could be entirely wrong...

I should mention that I'm just helping to maintain this code, it's been
around for some time...
9358cc96c46055cd68d4a76a9aefe026?d=identicon&s=25 Daniel Harple (Guest)
on 2006-02-26 02:59
(Received via mailing list)
On Feb 26, 2006, at 1:32 AM, Ross Bamford wrote:

> I'm not sure about this - I'm still finding my way around some things
> here, but I'm pretty sure we do need iconv_open(3) in libiconv.
> Does it
> compile with this change?

The problem is really strange. I have libiconv-1.9 installed in
/usr, and libiconv-1.10 installed in /opt/local. mkmf says
iconv_open(3) isn't available in v1.10, but it is. Have you
tested with libiconv-1.10? Was there ever a libiconv that did not
have iconv_open()?

> If you are passing --with-xml2-<whatever> settings, you should be fine
> to comment-out the lines that run those scripts (for both CFLAGS and
> LDFLAGS). If that works for you I'll fix it with a default to the
> dir_config and commit it.

I did this, and all unittests passed.

-- Daniel
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-02-26 04:03
(Received via mailing list)
On Sun, 2006-02-26 at 10:59 +0900, Daniel Harple wrote:
> tested with libiconv-1.10? Was there ever a libiconv that did not
> have iconv_open()?
>

Hmm. The website lists 1.9.1 as the latest stable release. I need to
look more into this I think, but one thing you might try is specifying
--with-iconv-lib and --with-iconv-include separately, rather than
--with-iconv-dir.

> > If you are passing --with-xml2-<whatever> settings, you should be fine
> > to comment-out the lines that run those scripts (for both CFLAGS and
> > LDFLAGS). If that works for you I'll fix it with a default to the
> > dir_config and commit it.
>
> I did this, and all unittests passed.

Thanks, I'll commit that fix tomorrow.
9358cc96c46055cd68d4a76a9aefe026?d=identicon&s=25 Daniel Harple (Guest)
on 2006-02-26 04:15
(Received via mailing list)
On Feb 26, 2006, at 4:02 AM, Ross Bamford wrote:

> Hmm. The website lists 1.9.1 as the latest stable release.

http://ftp.gnu.org/pub/gnu/libiconv/. I think the website is a
little out-of-date -- Last updated: $Date: 2003/08/05 20:02:34 $
$Author: haible $

> I think, but one thing you might try is specifying
> --with-iconv-lib and --with-iconv-include separately, rather than
> --with-iconv-dir.

I tried this too, it did not work.

-- Daniel
9358cc96c46055cd68d4a76a9aefe026?d=identicon&s=25 Daniel Harple (Guest)
on 2006-02-26 05:01
There is small  documentation error at
http://libxml.rubyforge.org/doc/classes/XML/Dtd.html

The class is named Dtd, but DTD is used. Also, the name of two classes,
Dtd and SaxParser, is inconsistent with the naming conventions of the
library -- it should be DTD and SAXParser. </pedantic>

-- Daniel
This topic is locked and can not be replied to.