What type of information do you want to get out of this? You never 
posted what you *thought* your sample ruby code would give you. I ran 
your perl example, and it looks like the xml document but where < > are 
  gsub'd for { }.

Here is an example which shows some xpath usage.:

require 'rexml/document'

file = File.new("test.xml")
root = REXML::Document.new(file).root
fault_arr = root.elements.each( "fault" ) do |e1|
   e1.elements.each( "value/struct/member" ) do |e2|
     e2.elements.each( '*' ) { |e3| print e3.text.strip }
     e2.elements.each( '*/*' ){ |e3| puts " " + e3.text.strip }
   end
end

puts "Message response faulted!" if fault_arr.length > 0

Zach






Michael wrote:
> 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:
> 
> <?xml version='1.0' encoding="iso-8859-1" ?>
> <methodResponse>
>   <fault>
> 		<value>
> 			<struct>
> 				<member>
> 					<name>faultCode</name>
> 						<value>
> 							<int>5</int>
> 						</value>
> 				</member>
> 				<member>
> 					<name>faultString</name>
> 				<value>
> 					<string>system error (nologin)</string>
> 				</value>
> 			</member>
> 		</struct>
> 	</value>
> 	</fault>
> </methodResponse>
> 
> 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.