我有以下XML文件給佈局的想法,導出XML到CSV行
<weather>
<current_conditions>
<condition data="Mostly Cloudy" />
<temp_f data="48" />
<temp_c data="9" />
<humidity data="Humidity: 71%" />
<icon data="/ig/images/weather/mostly_cloudy.gif" />
<wind_condition data="Wind: W at 17 mph" />
</current_conditions>
<forecast_conditions>
<day_of_week data="Sun" />
<low data="34" />
<high data="48" />
<icon data="/ig/images/weather/mostly_sunny.gif" />
<condition data="Partly Sunny" />
</forecast_conditions>
<forecast_conditions>
<day_of_week data="Mon" />
<low data="32" />
<high data="45" />
<icon data="/ig/images/weather/sunny.gif" />
<condition data="Clear" />
</forecast_conditions>
我學習C#和想利用行導出爲CSV一週的每一天, 哪裏一天中的信息不可用,我需要在csv行中不顯示任何數據。 我明白最簡單的解決方案,我正在學習:)
我可以將數據轉換爲字符串。 – dave2012
string day =「Tue」; string path =「weather/forecast_conditions [day_of_week/@ data ='」+ day +「'/ condition」; string towrite = doc.XPathSelectElement(path).Attribute(「data」)。Value; – dave2012
我建議編輯您的帖子,並將您嘗試的內容放入您的問題中!代碼越多越好! –