xpath express

<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
       <soap:Body>
	      <GetAirAvailResponse xmlns=\"http://tempuri.org/\">
			<GetAirAvailResult></GetAirAvailResult>
		</GetAirAvailResponse>
	</soap:Body>
</soap:Envelope>
 

SAXReader saxReader = new SAXReader(new DOMDocumentFactory());

InputSource is =  new InputSource();

is.setCharacterStream(new StringReader(str1));

DOMDocument doc = (DOMDocument) saxReader.read(is);

 

doc.selectNodes("/soap:Envelope/soap:Body/ GetAirAvailResponse /GetAirAvailResult")

 

如果这种方式无法获取结果集时,请使用如下方式

 

doc.selectNodes("/soap:Envelope/soap:Body/*[name()='GetAirAvailResponse']/*[name()='GetAirAvailResult']");

你可能感兴趣的:(express)