Code example for XPath

Methods: evaluate

0
   * @param xpath 
   * @throws XPathExpressionException 
   */ 
  private void parseRequest(OperationContext context, Node ndReq, XPath xpath) throws XPathExpressionException{
	  ReverseGeocodeParams reqParams = context.getRequestOptions().getReverseGeocodeOptions();
	  Node ndPosition = (Node)xpath.evaluate("xls:Position",ndReq,XPathConstants.NODE);
      if(ndPosition != null){
	    	Node ndPoint = (Node)xpath.evaluate("gml:Point",ndPosition,XPathConstants.NODE);
	    	if(ndPoint != null){
	    		Node ndPos = (Node)xpath.evaluate("gml:pos",ndPoint,XPathConstants.NODE);
	    		if(ndPos != null){
	    			String[] vals = ndPos.getTextContent().split(" ");
	    			reqParams.setLat(vals[0]);
	    			reqParams.setLng(vals[1]);
	    		} 
	    	} 
      }  
      Node ndPreference = (Node)xpath.evaluate("xls:ReverseGeocodePreference",ndReq,XPathConstants.NODE);
      if(ndPreference != null){
      	reqParams.setPreference(ndPreference.getTextContent());
      } 
  }