From: "Kyle X." Date: 2011-04-11T08:27:45+09:00 Subject: Re: Can you search in REXML by attributes? Kyle X. wrote in post #992033: > "Jesús Gabriel y Galán" wrote in post > #990433: >> >> I usually use Nokogiri to handle XML documents, and find css selectors >> easier than XPath. I'd do it like this: >> >> doc = Nokogiri::XML(<> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> 117.4 >> 119.7 >> 0. >> >> >> >> END >> ) >> >> reference = doc.css("#i1671 Location >> IfcCartesianPoint").attribute("ref").value >> doc.css("##{reference} Coordinates IfcLengthMeasure").map {|element| >> element.text} >> >> This returns: => ["117.4", "119.7", "0."] Please disregard the previous post. I figured out how to load the files, but it does not appear to be reading correctly. Using- fname = File.open("C:/Users/Kyle/Desktop/CSUF/Research Winter 11/IFXCML/automation trials/one.xml") $doc = Nokogiri::XML(fname) reference = $doc.css(" IfcCartesianPoint Coordinates IfcLengthMeasure").first This produce and output of nil when it should be "117.4" correct? What is going wrong here? -- Posted via http://www.ruby-forum.com/.