From: Michael Date: 2005-08-29T03:16:32+09:00 Subject: Help needed with rexml I've been struggling to properly parse some XML with rexml. I will fully admit my XML ignorance in advance. It would be easy enough to parse this with a regular expression instead, but I would prefer to use the right tool. Here's a sample XML response: faultCode 5 faultString system error (nologin) However, I can't anything useful out of it. For instance, I've been trying something like this: require 'rexml/document' file = File.new("test.xml") xml = REXML::Document.new(file) xml.elements.each { |i| i.texts.each { |t| puts "Class: #{t.class}" puts "Value: #{t.value}" puts "String: #{t.to_s}" } } This doesn't print anything useful for the class. Where am I going wrong with this? I've been digging through the documentation but I'm must not getting it. For what it's worth, I can parse this in perl easily enough (which suggests to me the XML is valid): use Data::Dumper; use XML::Simple; # AKA "XML For Idiots" my $ref = XMLin("test.xml"); # A file containing the XML above print Dumper $ref, "\n"; I can then use the results to figure out how to dereference $ref to pull the error information returned by the server. Responses to the list or the newsgroup, please, for future googlers to find.