From: "Kyle X." Date: 2011-04-11T08:01:11+09:00 Subject: Re: Can you search in REXML by attributes? "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."] > Thank you for the help. I had been using REXML and it was working find with one exception, it can be very slow. So now I am trying to use Nokogiri, and am running into a very simple error, I cannot load xml files. From the Nokogiri website I have been trying what is in their tutorial: f = File.open("blossom.xml") doc = Nokogiri::XML(f) f.close But regardles of what I put in the ("...") it returns - Error: # or Error: # If I am simply trying to open an XML file named file.xml located at C:\, what would I put to open it? I have tried many things such as f =File.open("C:\file.xml") and what not with no luck. What do I need to do to open this? -- Posted via http://www.ruby-forum.com/.