Rexml xpath question

Hi,

The following program:

require 'rexml/document’
require 'rexml/xpath’
require ‘pp’

doc = REXML::Document.new(’



’)

REXML::XPath.each(doc.root, ‘/program/item[@rnum=“1”]’) do |el|
puts el
end

end of example program

produces:

Is this correct? I would have expected only the first item to be returned.

Cheers,

han.holl@pobox.com (Han Holl) wrote in message news:b93fa83f.0402220318.34dae140@posting.google.com

Hi,

The following program:

produces:

Is this correct? I would have expected only the first item to be returned.

Nope. That’s a bug. Thanks for finding that; in the future, you
might want to post the bug to the REXML bug page; I’m not reliable
about reading this newsgroup.

— SER

REXML is distributed with Ruby, so you’ll never be able to prevent
people from posting issues here, and nor should you. The only
reasonable process that can mitigate your lack of full attention to
this forum (which I’m not criticising) is to ask somebody else to keep
an eye out for you.

That, or set a mail/NG filter that copies messages matching /rexml/i to a
separate folder :slight_smile:

Cheers,
Gavin

···

On Tuesday, February 24, 2004, 7:04:48 AM, Sean wrote:

han.holl@pobox.com (Han Holl) wrote in message
news:b93fa83f.0402220318.34dae140@posting.google.com

Hi,

The following program:

produces:

Is this correct? I would have expected only the first item to be returned.

Nope. That’s a bug. Thanks for finding that; in the future, you
might want to post the bug to the REXML bug page; I’m not reliable
about reading this newsgroup.

ser@germane-software.com (Sean Russell) wrote in message

Nope. That’s a bug. Thanks for finding that; in the future, you
might want to post the bug to the REXML bug page; I’m not reliable
about reading this newsgroup.

— SER

Now that REXML is included in Ruby, I think (possible) bugs are of
interest to the readers of this list. I might try to crosspost in
the future, because it’s not possible for people interested in Ruby
to follow all specialized mailing lists.

The irony is that this bug is just the behaviour that I wanted!
Now I’ll have to find out how to use starts-with. I’m afraid I
don’t find XPath syntax to be very intuitive.

Cheers,

Han Holl

Gavin Sinclair gsinclair@soyabean.com.au wrote in message news:45477405382.20040224205833@soyabean.com.au

Nope. That’s a bug. Thanks for finding that; in the future, you
might want to post the bug to the REXML bug page; I’m not reliable
about reading this newsgroup.

REXML is distributed with Ruby, so you’ll never be able to prevent
people from posting issues here, and nor should you. The only

Oh, I couldn’t prevent people from posting here. What I’m saying is
that if you post your bug report to this newsgroup, it may be a long
while before I see it, and it may get lost entirely.

If someone wants to give me access to an NNTP server that carries this
newsgroup, with posting permissions, my ability to scan for bug
reports would improve. However, it is unlikely that anybody is going
to be successful at forcing me to spend more time trolling the
newsgroups for bug reports anytime soon.

REXML, like most open source projects, has an official bug reporting
mechanism. Bugs posted there have a much better chance of being
addressed.

reasonable process that can mitigate your lack of full attention to
this forum (which I’m not criticising) is to ask somebody else to keep
an eye out for you.

Are you volunteering? That is, after all, what Ruby (and REXML) is:
volunteer work. Things would be different if I were being paid for
this :slight_smile:

— SER

han.holl@pobox.com (Han Holl) wrote in message news:b93fa83f.0402240345.2b9aa7f7@posting.google.com

Now that REXML is included in Ruby, I think (possible) bugs are of
interest to the readers of this list. I might try to crosspost in

Yeah, that’s the downside to REXML in Ruby. There is a dedicated
REXML mailing list, a dedicated bug tracking system, and a dedicated
web page. There is a bunch of documentation that isn’t included in
the Ruby CVS system. I’m reluctant to cross-post from the REXML
mailing list to the newsgroup simply because I think there’s enough
noise in the group as it is; that wouldn’t solve the core problem that
people using REXML these days may not even realize that there exists a
separate forum for it.

The irony is that this bug is just the behaviour that I wanted!
Now I’ll have to find out how to use starts-with. I’m afraid I
don’t find XPath syntax to be very intuitive.

Yeah, XPath can be tricky, but it is pretty simple once you get the
hang of it, until you start doing complex filtering.

You had it almost right, though:

/program/item[ starts-with( @rnum ) = "1"]

— SER

Sean Russell wrote:

If someone wants to give me access to an NNTP server that carries this
newsgroup, with posting permissions, my ability to scan for bug
reports would improve. However, it is unlikely that anybody is going

Someone has kindly offered me access to their usenet server. If this email
makes it to the group, then I’m good to go.

···

SER

Deutsch|Esperanto|Francaise|Linux|XML|Java|Ruby|Aikido

http://www.germane-software.com/~ser jabber.com:ser ICQ:83578737

GPG: http://www.germane-software.com/~ser/Security/ser_public.gpg

REXML, like most open source projects, has an official bug reporting
mechanism. Bugs posted there have a much better chance of being
addressed.

Good point.

reasonable process that can mitigate your lack of full attention to
this forum (which I’m not criticising) is to ask somebody else to keep
an eye out for you.

Are you volunteering? That is, after all, what Ruby (and REXML) is:
volunteer work. Things would be different if I were being paid for
this :slight_smile:

What about my other suggestion: create a mail folder that collects
only messages with /rexml/i in them?

Cheers,
Gavin

···

On Thursday, February 26, 2004, 12:29:51 AM, Sean wrote:

ser@germane-software.com (Sean Russell) wrote in message >

You had it almost right, though:

/program/item[ starts-with( @rnum ) = “1”]

You also had it almost right :
/program/item[ starts-with( @rnum, “1”)]

Cheers,

Han Holl