I am trying to fetch all <Opening> tag whose <PlanarGeometry>‘s <Polyloop> has number of CartesianPoint > 4.
Xml tag surface is child of another.
<Surface id="su-137" surfaceType="InteriorWall" constructionIdRef="ASHIW23" xmlns="http://www.gbxml.org/schema">
<Name>W-106-114-I-W-137</Name>
<Opening id="su-137-op-1" openingType="NonSlidingDoor" constructionIdRef="MDOOR">
<Name>W-106-114-I-W-137-D-1</Name>
<PlanarGeometry>
<PolyLoop>
<CartesianPoint><Coordinate>55.570238</Coordinate><Coordinate>92.571596</Coordinate>
<Coordinate>0.000000</Coordinate></CartesianPoint><CartesianPoint> <Coordinate>55.570238</Coordinate><Coordinate>92.571596</Coordinate><Coordinate>6.666667</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>55.570238</Coordinate><Coordinate>95.571596</Coordinate><Coordinate>6.666667</Coordinate></CartesianPoint>
<CartesianPoint>
<Coordinate>55.570238</Coordinate><Coordinate>95.571596</Coordinate><Coordinate>0.000000</Coordinate>
</CartesianPoint>
</PolyLoop>
</PlanarGeometry>
</Opening>
</Surface>
I got little reference from this – Xpath to select only nodes where child elements exist? SO thread and got little help from below example.
book[author/degree]
All <book> elements that contain <author> children that in turn contain at least one <degree> child.
How can i achieve this using xPath or another way???
Assuming the
Surfaceelement is your current context node then:The
gbprefix needs to be mapped to thehttp://www.gbxml.org/schemanamespace URI. This will select allOpeningelements that contain at least onePolyloopwith more than 4CartesianPointchildren.