我有一個奇怪的XML文檔需要查詢。它來自Weather.gov輸出。我想要查詢的信息位於:/ Enelope/Body/NDFDgenResponse/dwmlOut。它是XML的轉換形式。是否有可能查詢單個元素下的值,或者我將不得不後處理它在其中查詢?我的懷疑是我必須發佈流程。查詢元素中的XML內容
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:NDFDgenResponse xmlns:ns1="http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl">
<dwmlOut xsi:type="xsd:string"><?xml version="1.0"?>
<dwml version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd">
<head>
<product srsName="WGS 1984" concise-name="glance" operational-mode="official">
<title>NOAA's National Weather Service Forecast at a Glance</title>
<field>meteorological</field>
<category>forecast</category>
<creation-date refresh-frequency="PT1H">2012-06-26T19:09:06Z</creation-date>
</product>
<source>
<more-information>http://graphical.weather.gov/xml/</more-information>
<production-center>Meteorological Development Laboratory<sub-center>Product Generation Branch</sub-center></production-center>
<disclaimer>http://www.nws.noaa.gov/disclaimer.html</disclaimer>
<credit>http://www.weather.gov/</credit>
<credit-logo>http://www.weather.gov/images/xml_logo.gif</credit-logo>
<feedback>http://www.weather.gov/feedback.php</feedback>
</source>
</head>
<data>
<location>
..... < /條件圖標> < /參數> < /數據> </DWML >
有了大概純的XPath不。但是,如果您從任何其他語言調用XPath,則可以先將該節點選擇爲字符串類型變量,然後將該字符串解析爲xml文檔,並使用第二個XPath表達式從內部選擇某些內容。 – biziclop
所以後處理...做出答案,我會接受 – monksy