Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Question about REXML

Reply
Thread Tools

Question about REXML

 
 
Brad
Guest
Posts: n/a
 
      09-19-2008
I'm trying to follow this tutorial: http://www.germane-software.com/soft.../tutorial.html

When I use the IRB and do:
require "rexml/document"
include REXML
doc = Document.new File.new("mydoc.xml")

I get an error:
<UNDEFINED> ... </>

I copied the source file right from the website and created an XML
document called 'mydoc.xml'

Why is it failing?

Thank you

Brad

 
Reply With Quote
 
 
 
 
matt neuburg
Guest
Posts: n/a
 
      09-19-2008
Brad <(E-Mail Removed)> wrote:

> When I use the IRB and do:
> require "rexml/document"
> include REXML
> doc = Document.new File.new("mydoc.xml")
>
> I get an error:
> <UNDEFINED> ... </>
>
> I copied the source file right from the website and created an XML
> document called 'mydoc.xml'
>
> Why is it failing?


It isn't. Say

puts doc

....and you will see that all is well. m.

--
matt neuburg, phd = http://www.velocityreviews.com/forums/(E-Mail Removed), http://www.tidbits.com/matt/
Leopard - http://www.takecontrolbooks.com/leop...stomizing.html
AppleScript - http://www.amazon.com/gp/product/0596102119
Read TidBITS! It's free and smart. http://www.tidbits.com
 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      09-20-2008
On 19.09.2008 20:33, Brad wrote:
> I'm trying to follow this tutorial: http://www.germane-software.com/soft.../tutorial.html
>
> When I use the IRB and do:
> require "rexml/document"
> include REXML
> doc = Document.new File.new("mydoc.xml")
>
> I get an error:
> <UNDEFINED> ... </>
>
> I copied the source file right from the website and created an XML
> document called 'mydoc.xml'
>
> Why is it failing?


As Matt said, it isn't. But you should make it a habit to properly
close file handles; use any of these:

doc = Document.new File.read("mydoc.xml")
doc = File.open("mydoc.xml") {|io| Document.new(io)}
doc = File.open("mydoc.xml", "rb") {|io| Document.new(io)}

Kind regards

robert
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
REXML::Element.write is deprecated. See REXML::Formatters Phlip Ruby 0 01-15-2008 08:23 PM
rexml error - REXML::Validation Daniel Berger Ruby 2 10-12-2004 04:19 PM
Rexml xpath question Han Holl Ruby 7 03-06-2004 01:23 PM
REXML & Extended characters - newbie question Ralph Mason Ruby 2 01-13-2004 12:36 AM
soap4r 1.4.8.1 with REXML 2.7.1 - no REXML::VERSION_MAJOR Damphyr Ruby 2 07-16-2003 09:49 AM



Advertisments