From: "Jesús Gabriel y Galán" Date: 2011-04-21T05:23:27+09:00 Subject: Re: Nokogiri parsing question --001636e9136a9c7e6704a15f6538 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable The problem is that the attribute pos has a different namespace (exp), I have tried a couple of ways but could not make it work El 20/04/2011 17:56, "Kyle X." escribi=F3: > Thank you for the reply Robert; however, I cannot get it to work still. > I left out a lit bit of the xml when I wrote the first post. Both cases > have already have a namespace defined for them. > > > Case 1) These two lines would be added to both cases. The actual file > reads: > xmlns:doc=3D"urn:oid:1.0.10303.28.2.1.3" > xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation=3D"urn:oid:1.0.10303.28.2.1.1 ex.xsd" version=3D"2.0"> > xmlns=3D"http://www.iai-tech.org/ifcXML/IFC2x3/FINAL" > xsi:schemaLocation=3D"http://www.iai-tech.org/ifcXML/IFC2x3/FINAL > ifc2x3.xsd"> > > > > > ref=3D"i17886"/> > ref=3D"i17919"/> > > > > > > > > The exact code I have been trying to run is: > > $http =3D "http://www.iai-tech.org/ifcXML/IFC2x3/FINAL" > ref =3D "i17855" > $doc_noko =3D Nokogiri::XML(File.read(filename)) > > x =3D $doc_noko.xpath("//uosNS:*[@id=3D'#{ref}']//uosNS:*[@pos=3D'1']", > {"uosNS" =3D> $http}) > #=3D> nil > > It reads for "//uosNS:*[@id=3D'#{ref}']" but the "//uosNS:*[@pos=3D'1']" > is where it is not working as intended returning a nil value. With > these two new lines in mind any ideas for the two cases? > > -- > Posted via http://www.ruby-forum.com/. > --001636e9136a9c7e6704a15f6538--