Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!talisker.lacave.net!lacave.net!not-for-mail From: "Kyle X." Newsgroups: comp.lang.ruby Subject: Can you search in REXML by attributes? Date: Thu, 31 Mar 2011 19:53:43 -0500 Organization: Service de news de lacave.net Lines: 52 Message-ID: <6680e1dd986ba2ce87d806950a81ee57@ruby-forum.com> NNTP-Posting-Host: bristol.highgroove.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: talisker.lacave.net 1301619243 34860 65.111.164.187 (1 Apr 2011 00:54:03 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Fri, 1 Apr 2011 00:54:03 +0000 (UTC) X-Received-From: This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway X-Mail-Count: 380721 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: <6680e1dd986ba2ce87d806950a81ee57@ruby-forum.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:2075 Hello and thank you to all the wonderful and helpful people at this forum. I am trying to figure out how to search through an XML file and grab information. I have been reading the REXML tutorials but could not see an answer to my problem in them (http://www.germane-software.com/software/rexml/docs/tutorial.html). The problem is I need to search by an attribute (in this case the ref) and cannot figure out how. Here is a snippet of the XML I am trying to extract information from: 117.4 119.7 0. So basically I have to start with IfcWallStandardCase and from there work my way through the "ref"'s until I get to the 3 IfcLengthMeasures. I know how to grab the first ref "i1671" using: XPath.match(doc,"/IfcWallStandardCase/ObjectPlacement/IfcLocalPlacement") and some additional code. My problem is I cannot figure out how to use this "i1671" to search the xml and grab the next ref. This ref is the only thing linking the items together, so it is the only thing that I can use. Is it possible to search a document by using an attribute, and if so how? In this case to use the ref, "i1671" to search the document for where it is used as id="i1671" so I can grab the next ref from there and so on. Any help would be greatly appreciated. Thank you all. Sincerely, Kyle -- Posted via http://www.ruby-forum.com/.