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." <haebooty / yahoo.com> 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:
> <doc:iso_10303_28 xmlns:exp=3D"urn:oid:1.0.10303.28.2.1.1"
> 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">
> <uos id=3D"uos_1" description=3D"" configuration=3D"i-ifc2x3" edo=3D""
> xmlns=3D"http://www.iai-tech.org/ifcXML/IFC2x3/FINAL"
> xsi:schemaLocation=3D"http://www.iai-tech.org/ifcXML/IFC2x3/FINAL
> ifc2x3.xsd">
> <IfcWallStandardCase id=3D"i17855">
> <Representation>
> <IfcProductDefinitionShape id=3D"i17925">
> <Representations id=3D"i17928" exp:cType=3D"list">
> <IfcShapeRepresentation exp:pos=3D"0" xsi:nil=3D"true"
> ref=3D"i17886"/>
> <IfcShapeRepresentation exp:pos=3D"1" xsi:nil=3D"true"
> ref=3D"i17919"/>
> </Representations>
> </IfcProductDefinitionShape>
> </Representation>
> </IfcWallStandardCase>
> </uos>
> </doc:iso_10303_28>
>
> 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/.
>