From: "Kyle X." Date: 2011-04-20T05:42:12+09:00 Subject: Re: Can you search in REXML by attributes? Hello, Nokogiri has been going well for me but recently I have been having trouble trying to read some xml, and from my reading online I cannot find the proper way to write it using Nokogiri. Here are the two lines I am having trouble with: 1) I am trying to get the reference for exp:pos="1", and I had this working with using REXML with the following - XPath.match( $doc, "//IfcWallStandardCase//*[@pos='1']" ) With nokogiri I can get it to read both pos 0 and 1, using .css and .xpath- $doc_noko.css("uosNS|IfcWallStandardCase uosNS|IfcShapeRepresentation", {"uosNS" => $http}) and $doc_noko.xpath("//uosNS:IfcWallStandardCase//uosNS:IfcShapeRepresentation", {"uosNS" => $http}) But cannot figure out how to get it to read only pos=1 using either method and continuously get error or nil. 2) 1. 0. 0. The issue I am having here is that I am reading this with Nokogiri using .xpath and the colon in exp:double is giving me trouble since the xpath is written - ref = "i1574" $doc_noko.xpath("//uosNS:*[@id='#{ref}']//uosNS:exp:double-wrapper", {"uosNS" => $http}).map {|element| element.text} I am guessing that it would be easier to use .css here rather than .xpath. So I have tried using it but cannot seem to get it correct. Trying - ref = "i1574" $doc_noko.css("uosNS|#{ref} uosNS|exp:double-wrapper", {"uosNS" => $http}).map {|element| element.text} As I read in a previous post that you call the ref using #{} for css, but this returns nil for me. Any ideas? -- Posted via http://www.ruby-forum.com/.