使用FilterXML选择特定节点

时间:2018-06-14 20:21:57

标签: xml excel

我正在使用= Webservice从api.openweathermap.org获取5天的天气预报。 它运行良好,它返回以下XML:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<weatherdata>
<location>
<name>Miami</name>
<type/>
<country>US</country>
<timezone/>
<location altitude="0" latitude="25.7743" longitude="-80.1937" geobase="geonames" geobaseid="4164138"/>
</location>
<credit/>
<meta>
<lastupdate/>
<calctime>0.0025</calctime>
<nextupdate/>
</meta>
<sun rise="2018-06-14T10:29:04" set="2018-06-15T00:13:32"/>
<forecast>
<time from="2018-06-14T18:00:00" to="2018-06-14T21:00:00">
<symbol number="500" name="light rain" var="10d"/>
<precipitation unit="3h" value="0.365" type="rain"/>
<windDirection deg="127.001" code="SE" name="SouthEast"/>
<windSpeed mps="2.22" name="Light breeze"/>
<temperature unit="celsius" value="25.86" min="25.86" max="30.54"/>
<pressure unit="hPa" value="1030.36"/>
<humidity value="70" unit="%"/>
<clouds value="scattered clouds" all="48" unit="%"/>
</time>
<time from="2018-06-14T21:00:00" to="2018-06-15T00:00:00">
<symbol number="500" name="light rain" var="10n"/>
<precipitation unit="3h" value="1.45" type="rain"/>
<windDirection deg="235" code="SW" name="Southwest"/>
<windSpeed mps="0.76" name="Calm"/>
<temperature unit="celsius" value="22.76" min="22.76" max="26.27"/>
<pressure unit="hPa" value="1031.42"/>
<humidity value="85" unit="%"/>
<clouds value="broken clouds" all="76" unit="%"/>
</time>
<time from="2018-06-15T00:00:00" to="2018-06-15T03:00:00">
<symbol number="803" name="broken clouds" var="04n"/>
<precipitation/>
<windDirection deg="290.003" code="WNW" name="West-northwest"/>
<windSpeed mps="1.11" name="Calm"/>
<temperature unit="celsius" value="22.66" min="22.66" max="25"/>
<pressure unit="hPa" value="1031.75"/>
<humidity value="91" unit="%"/>
<clouds value="broken clouds" all="76" unit="%"/>
</time>
<time from="2018-06-15T03:00:00" to="2018-06-15T06:00:00">
<symbol number="801" name="few clouds" var="02n"/>
<precipitation/>
<windDirection deg="332.507" code="NNW" name="North-northeast"/>
<windSpeed mps="1.17" name="Calm"/>
<temperature unit="celsius" value="22.38" min="22.38" max="23.55"/>
<pressure unit="hPa" value="1030.65"/>
<humidity value="99" unit="%"/>
<clouds value="few clouds" all="20" unit="%"/>
</time>
<time from="2018-06-15T06:00:00" to="2018-06-15T09:00:00">
<symbol number="801" name="few clouds" var="02n"/>
<precipitation/>
<windDirection deg="342.001" code="NNW" name="North-northeast"/>
<windSpeed mps="1.31" name="Calm"/>
<temperature unit="celsius" value="22.47" min="22.47" max="22.47"/>
<pressure unit="hPa" value="1030.11"/>
<humidity value="100" unit="%"/>
<clouds value="few clouds" all="12" unit="%"/>
</time>
<time from="2018-06-15T09:00:00" to="2018-06-15T12:00:00">
<symbol number="801" name="few clouds" var="02d"/>
<precipitation/>
<windDirection deg="2.50912" code="N" name="North"/>
<windSpeed mps="1.96" name="Light breeze"/>
<temperature unit="celsius" value="24.95" min="24.95" max="24.95"/>
<pressure unit="hPa" value="1031.41"/>
<humidity value="92" unit="%"/>
<clouds value="few clouds" all="20" unit="%"/>
</time>
<time from="2018-06-15T12:00:00" to="2018-06-15T15:00:00">
<symbol number="802" name="scattered clouds" var="03d"/>
<precipitation/>
<windDirection deg="17.5013" code="NNE" name="North-northeast"/>
<windSpeed mps="1.41" name="Calm"/>
<temperature unit="celsius" value="30.21" min="30.21" max="30.21"/>
<pressure unit="hPa" value="1032.11"/>
<humidity value="79" unit="%"/>
<clouds value="scattered clouds" all="44" unit="%"/>
</time>
<time from="2018-06-15T15:00:00" to="2018-06-15T18:00:00">
<symbol number="500" name="light rain" var="10d"/>
<precipitation unit="3h" value="2.97" type="rain"/>
<windDirection deg="116.503" code="ESE" name="East-southeast"/>
<windSpeed mps="1.81" name="Light breeze"/>
<temperature unit="celsius" value="29.46" min="29.46" max="29.46"/>
<pressure unit="hPa" value="1031.4"/>
<humidity value="86" unit="%"/>
<clouds value="broken clouds" all="76" unit="%"/>
</time>
<time from="2018-06-15T18:00:00" to="2018-06-15T21:00:00">
<symbol number="500" name="light rain" var="10d"/>
<precipitation unit="3h" value="2.205" type="rain"/>
<windDirection deg="108.001" code="ESE" name="East-southeast"/>
<windSpeed mps="0.61" name="Calm"/>
<temperature unit="celsius" value="28.53" min="28.53" max="28.53"/>
<pressure unit="hPa" value="1030.33"/>
<humidity value="82" unit="%"/>
<clouds value="broken clouds" all="80" unit="%"/>
</time>
<time from="2018-06-15T21:00:00" to="2018-06-16T00:00:00">
<symbol number="802" name="scattered clouds" var="03n"/>
<precipitation/>
<windDirection deg="142.5" code="SE" name="SouthEast"/>
<windSpeed mps="1.06" name="Calm"/>
<temperature unit="celsius" value="28.41" min="28.41" max="28.41"/>
<pressure unit="hPa" value="1030.03"/>
<humidity value="78" unit="%"/>
<clouds value="scattered clouds" all="48" unit="%"/>
</time>
<time from="2018-06-16T00:00:00" to="2018-06-16T03:00:00">
<symbol number="801" name="few clouds" var="02n"/>
<precipitation/>
<windDirection deg="164.001" code="SSE" name="South-southeast"/>
<windSpeed mps="1.61" name="Light breeze"/>
<temperature unit="celsius" value="25.43" min="25.43" max="25.43"/>
<pressure unit="hPa" value="1031.06"/>
<humidity value="90" unit="%"/>
<clouds value="few clouds" all="20" unit="%"/>
</time>
<time from="2018-06-16T03:00:00" to="2018-06-16T06:00:00">
<symbol number="802" name="scattered clouds" var="03n"/>
<precipitation/>
<windDirection deg="194" code="SSW" name="South-southwest"/>
<windSpeed mps="1.51" name=""/>
<temperature unit="celsius" value="23.8" min="23.8" max="23.8"/>
<pressure unit="hPa" value="1030.26"/>
<humidity value="98" unit="%"/>
<clouds value="scattered clouds" all="36" unit="%"/>
</time>
<time from="2018-06-16T06:00:00" to="2018-06-16T09:00:00">
<symbol number="802" name="scattered clouds" var="03n"/>
<precipitation/>
<windDirection deg="238" code="WSW" name="West-southwest"/>
<windSpeed mps="1.47" name="Calm"/>
<temperature unit="celsius" value="23.07" min="23.07" max="23.07"/>
<pressure unit="hPa" value="1029.89"/>
<humidity value="100" unit="%"/>
<clouds value="scattered clouds" all="32" unit="%"/>
</time>
<time from="2018-06-16T09:00:00" to="2018-06-16T12:00:00">
<symbol number="800" name="clear sky" var="02d"/>
<precipitation/>
<windDirection deg="357.003" code="" name=""/>
<windSpeed mps="2.07" name="Light breeze"/>
<temperature unit="celsius" value="25.68" min="25.68" max="25.68"/>
<pressure unit="hPa" value="1031.3"/>
<humidity value="88" unit="%"/>
<clouds value="clear sky" all="8" unit="%"/>
</time>
<time from="2018-06-16T12:00:00" to="2018-06-16T15:00:00">
<symbol number="800" name="clear sky" var="02d"/>
<precipitation/>
<windDirection deg="42.0001" code="NE" name="NorthEast"/>
<windSpeed mps="2.11" name="Light breeze"/>
<temperature unit="celsius" value="30.55" min="30.55" max="30.55"/>
<pressure unit="hPa" value="1031.81"/>
<humidity value="80" unit="%"/>
<clouds value="clear sky" all="8" unit="%"/>
</time>
<time from="2018-06-16T15:00:00" to="2018-06-16T18:00:00">
<symbol number="500" name="light rain" var="10d"/>
<precipitation unit="3h" value="0.47" type="rain"/>
<windDirection deg="90.0024" code="E" name="East"/>
<windSpeed mps="3.66" name="Gentle Breeze"/>
<temperature unit="celsius" value="31.23" min="31.23" max="31.23"/>
<pressure unit="hPa" value="1030.48"/>
<humidity value="72" unit="%"/>
<clouds value="scattered clouds" all="36" unit="%"/>
</time>
<time from="2018-06-16T18:00:00" to="2018-06-16T21:00:00">
<symbol number="500" name="light rain" var="10d"/>
<precipitation unit="3h" value="0.46" type="rain"/>
<windDirection deg="103.502" code="ESE" name="East-southeast"/>
<windSpeed mps="4.25" name="Gentle Breeze"/>
<temperature unit="celsius" value="31.44" min="31.44" max="31.44"/>
<pressure unit="hPa" value="1029.39"/>
<humidity value="63" unit="%"/>
<clouds value="scattered clouds" all="44" unit="%"/>
</time>
<time from="2018-06-16T21:00:00" to="2018-06-17T00:00:00">
<symbol number="802" name="scattered clouds" var="03n"/>
<precipitation/>
<windDirection deg="110.501" code="ESE" name="East-southeast"/>
<windSpeed mps="3.58" name="Gentle Breeze"/>
<temperature unit="celsius" value="29.28" min="29.28" max="29.28"/>
<pressure unit="hPa" value="1030.52"/>
<humidity value="66" unit="%"/>
<clouds value="scattered clouds" all="44" unit="%"/>
</time>
<time from="2018-06-17T00:00:00" to="2018-06-17T03:00:00">
<symbol number="802" name="scattered clouds" var="03n"/>
<precipitation/>
<windDirection deg="108.51" code="ESE" name="East-southeast"/>
<windSpeed mps="2.45" name="Light breeze"/>
<temperature unit="celsius" value="26.24" min="26.24" max="26.24"/>
<pressure unit="hPa" value="1031.73"/>
<humidity value="81" unit="%"/>
<clouds value="scattered clouds" all="36" unit="%"/>
</time>
<time from="2018-06-17T03:00:00" to="2018-06-17T06:00:00">
<symbol number="802" name="scattered clouds" var="03n"/>
<precipitation/>
<windDirection deg="92.5013" code="E" name="East"/>
<windSpeed mps="1.97" name="Light breeze"/>
<temperature unit="celsius" value="24.57" min="24.57" max="24.57"/>
<pressure unit="hPa" value="1031.2"/>
<humidity value="90" unit="%"/>
<clouds value="scattered clouds" all="32" unit="%"/>
</time>
<time from="2018-06-17T06:00:00" to="2018-06-17T09:00:00">
<symbol number="801" name="few clouds" var="02n"/>
<precipitation/>
<windDirection deg="86.5096" code="E" name="East"/>
<windSpeed mps="1.61" name="Light breeze"/>
<temperature unit="celsius" value="23.6" min="23.6" max="23.6"/>
<pressure unit="hPa" value="1030.66"/>
<humidity value="95" unit="%"/>
<clouds value="few clouds" all="12" unit="%"/>
</time>
<time from="2018-06-17T09:00:00" to="2018-06-17T12:00:00">
<symbol number="801" name="few clouds" var="02d"/>
<precipitation/>
<windDirection deg="58.0014" code="ENE" name="East-northeast"/>
<windSpeed mps="2.31" name="Light breeze"/>
<temperature unit="celsius" value="26.89" min="26.89" max="26.89"/>
<pressure unit="hPa" value="1031.92"/>
<humidity value="81" unit="%"/>
<clouds value="few clouds" all="12" unit="%"/>
</time>
<time from="2018-06-17T12:00:00" to="2018-06-17T15:00:00">
<symbol number="500" name="light rain" var="10d"/>
<precipitation unit="3h" value="0.14" type="rain"/>
<windDirection deg="70.0045" code="ENE" name="East-northeast"/>
<windSpeed mps="2.56" name="Light breeze"/>
<temperature unit="celsius" value="30.82" min="30.82" max="30.82"/>
<pressure unit="hPa" value="1032.65"/>
<humidity value="74" unit="%"/>
<clouds value="clear sky" all="8" unit="%"/>
</time>
<time from="2018-06-17T15:00:00" to="2018-06-17T18:00:00">
<symbol number="501" name="moderate rain" var="10d"/>
<precipitation unit="3h" value="5.4" type="rain"/>
<windDirection deg="97.5001" code="E" name="East"/>
<windSpeed mps="4.13" name="Gentle Breeze"/>
<temperature unit="celsius" value="29.09" min="29.09" max="29.09"/>
<pressure unit="hPa" value="1032.47"/>
<humidity value="85" unit="%"/>
<clouds value="scattered clouds" all="36" unit="%"/>
</time>
<time from="2018-06-17T18:00:00" to="2018-06-17T21:00:00">
<symbol number="802" name="scattered clouds" var="03d"/>
<precipitation/>
<windDirection deg="90.5048" code="E" name="East"/>
<windSpeed mps="5.02" name="Gentle Breeze"/>
<temperature unit="celsius" value="30.08" min="30.08" max="30.08"/>
<pressure unit="hPa" value="1031.34"/>
<humidity value="74" unit="%"/>
<clouds value="scattered clouds" all="36" unit="%"/>
</time>
<time from="2018-06-17T21:00:00" to="2018-06-18T00:00:00">
<symbol number="803" name="broken clouds" var="04n"/>
<precipitation/>
<windDirection deg="92.501" code="E" name="East"/>
<windSpeed mps="4.31" name="Gentle Breeze"/>
<temperature unit="celsius" value="28.11" min="28.11" max="28.11"/>
<pressure unit="hPa" value="1031.68"/>
<humidity value="77" unit="%"/>
<clouds value="broken clouds" all="76" unit="%"/>
</time>
<time from="2018-06-18T00:00:00" to="2018-06-18T03:00:00">
<symbol number="802" name="scattered clouds" var="03n"/>
<precipitation/>
<windDirection deg="90.006" code="E" name="East"/>
<windSpeed mps="3.57" name="Gentle Breeze"/>
<temperature unit="celsius" value="26.67" min="26.67" max="26.67"/>
<pressure unit="hPa" value="1032.47"/>
<humidity value="82" unit="%"/>
<clouds value="scattered clouds" all="32" unit="%"/>
</time>
<time from="2018-06-18T03:00:00" to="2018-06-18T06:00:00">
<symbol number="802" name="scattered clouds" var="03n"/>
<precipitation/>
<windDirection deg="84.5025" code="E" name="East"/>
<windSpeed mps="3.32" name=""/>
<temperature unit="celsius" value="25.68" min="25.68" max="25.68"/>
<pressure unit="hPa" value="1031.29"/>
<humidity value="86" unit="%"/>
<clouds value="scattered clouds" all="32" unit="%"/>
</time>
<time from="2018-06-18T06:00:00" to="2018-06-18T09:00:00">
<symbol number="804" name="overcast clouds" var="04n"/>
<precipitation/>
<windDirection deg="81.0002" code="E" name="East"/>
<windSpeed mps="3.16" name="Light breeze"/>
<temperature unit="celsius" value="25.64" min="25.64" max="25.64"/>
<pressure unit="hPa" value="1030.65"/>
<humidity value="83" unit="%"/>
<clouds value="overcast clouds" all="92" unit="%"/>
</time>
<time from="2018-06-18T09:00:00" to="2018-06-18T12:00:00">
<symbol number="803" name="broken clouds" var="04d"/>
<precipitation/>
<windDirection deg="78.0018" code="ENE" name="East-northeast"/>
<windSpeed mps="3.91" name="Gentle Breeze"/>
<temperature unit="celsius" value="27.03" min="27.03" max="27.03"/>
<pressure unit="hPa" value="1031.67"/>
<humidity value="77" unit="%"/>
<clouds value="broken clouds" all="68" unit="%"/>
</time>
<time from="2018-06-18T12:00:00" to="2018-06-18T15:00:00">
<symbol number="800" name="clear sky" var="02d"/>
<precipitation/>
<windDirection deg="78.5011" code="ENE" name="East-northeast"/>
<windSpeed mps="5.02" name="Gentle Breeze"/>
<temperature unit="celsius" value="29.56" min="29.56" max="29.56"/>
<pressure unit="hPa" value="1032.53"/>
<humidity value="72" unit="%"/>
<clouds value="clear sky" all="8" unit="%"/>
</time>
<time from="2018-06-18T15:00:00" to="2018-06-18T18:00:00">
<symbol number="800" name="clear sky" var="01d"/>
<precipitation/>
<windDirection deg="78.5038" code="ENE" name="East-northeast"/>
<windSpeed mps="5.67" name="Moderate breeze"/>
<temperature unit="celsius" value="30.41" min="30.41" max="30.41"/>
<pressure unit="hPa" value="1031.84"/>
<humidity value="66" unit="%"/>
<clouds value="clear sky" all="0" unit="%"/>
</time>
<time from="2018-06-18T18:00:00" to="2018-06-18T21:00:00">
<symbol number="800" name="clear sky" var="01d"/>
<precipitation/>
<windDirection deg="83.0002" code="E" name="East"/>
<windSpeed mps="5.62" name="Moderate breeze"/>
<temperature unit="celsius" value="30.12" min="30.12" max="30.12"/>
<pressure unit="hPa" value="1030.65"/>
<humidity value="61" unit="%"/>
<clouds value="clear sky" all="0" unit="%"/>
</time>
<time from="2018-06-18T21:00:00" to="2018-06-19T00:00:00">
<symbol number="800" name="clear sky" var="01n"/>
<precipitation/>
<windDirection deg="83.0025" code="E" name="East"/>
<windSpeed mps="3.92" name="Gentle Breeze"/>
<temperature unit="celsius" value="27.86" min="27.86" max="27.86"/>
<pressure unit="hPa" value="1030.75"/>
<humidity value="64" unit="%"/>
<clouds value="clear sky" all="0" unit="%"/>
</time>
<time from="2018-06-19T00:00:00" to="2018-06-19T03:00:00">
<symbol number="801" name="few clouds" var="02n"/>
<precipitation/>
<windDirection deg="71.0012" code="ENE" name="East-northeast"/>
<windSpeed mps="3.36" name=""/>
<temperature unit="celsius" value="24.58" min="24.58" max="24.58"/>
<pressure unit="hPa" value="1031.62"/>
<humidity value="84" unit="%"/>
<clouds value="few clouds" all="24" unit="%"/>
</time>
<time from="2018-06-19T03:00:00" to="2018-06-19T06:00:00">
<symbol number="801" name="few clouds" var="02n"/>
<precipitation/>
<windDirection deg="96.0031" code="E" name="East"/>
<windSpeed mps="2.56" name="Light breeze"/>
<temperature unit="celsius" value="23.43" min="23.43" max="23.43"/>
<pressure unit="hPa" value="1030.62"/>
<humidity value="96" unit="%"/>
<clouds value="few clouds" all="12" unit="%"/>
</time>
<time from="2018-06-19T06:00:00" to="2018-06-19T09:00:00">
<symbol number="801" name="few clouds" var="02n"/>
<precipitation/>
<windDirection deg="96.5022" code="E" name="East"/>
<windSpeed mps="2.11" name="Light breeze"/>
<temperature unit="celsius" value="22.54" min="22.54" max="22.54"/>
<pressure unit="hPa" value="1030.04"/>
<humidity value="98" unit="%"/>
<clouds value="few clouds" all="12" unit="%"/>
</time>
<time from="2018-06-19T09:00:00" to="2018-06-19T12:00:00">
<symbol number="803" name="broken clouds" var="04d"/>
<precipitation/>
<windDirection deg="86.5019" code="E" name="East"/>
<windSpeed mps="2.52" name="Light breeze"/>
<temperature unit="celsius" value="25.51" min="25.51" max="25.51"/>
<pressure unit="hPa" value="1030.8"/>
<humidity value="82" unit="%"/>
<clouds value="broken clouds" all="68" unit="%"/>
</time>
<time from="2018-06-19T12:00:00" to="2018-06-19T15:00:00">
<symbol number="802" name="scattered clouds" var="03d"/>
<precipitation/>
<windDirection deg="90.5029" code="E" name="East"/>
<windSpeed mps="2.96" name="Light breeze"/>
<temperature unit="celsius" value="29.13" min="29.13" max="29.13"/>
<pressure unit="hPa" value="1031.35"/>
<humidity value="69" unit="%"/>
<clouds value="scattered clouds" all="36" unit="%"/>
</time>
<time from="2018-06-19T15:00:00" to="2018-06-19T18:00:00">
<symbol number="802" name="scattered clouds" var="03d"/>
<precipitation/>
<windDirection deg="92.0027" code="E" name="East"/>
<windSpeed mps="4.26" name="Gentle Breeze"/>
<temperature unit="celsius" value="30.02" min="30.02" max="30.02"/>
<pressure unit="hPa" value="1030.42"/>
<humidity value="65" unit="%"/>
<clouds value="scattered clouds" all="36" unit="%"/>
</time>
</forecast>
</weatherdata>

现在,我想使用FilterXML()来提取5天中的每一天:

我遇到与下面链接中的人相同的问题。提取“country”,“name”或“calctime”完美地使用= FILTERXML($ C $ 10,“//”&amp; A12)A12在存储“名称”。

[https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_win10/excel-how-to-extract-xml-data-with-filterxml/4f81dea2-c218-44e2-b726-6efa073c80cf]

即使我让它工作,我如何提取特定日期的所有值,因为根据当天有不同数量的读数。

然而,我无法得到温度值。我试过了 = FILTERXML(C3,“//温度/温度”),但它不起作用。甲

非常感谢任何帮助。

非常感谢! 大卫

0 个答案:

没有答案
相关问题