Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Delphi [игнор отключен] [закрыт для гостей] / XML как обратится к item? / 1 сообщений из 1, страница 1 из 1
23.03.2020, 13:18
    #39940245
Tech N9ne
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
XML как обратится к item?
Доброго времени суток! Есть вот такой xml с погодой.
Код: pascal
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
<?xml version="1.0" encoding="utf-8"?>

		<info lang="ru">
			
		<region id="101541" zoom="13" lat="46.623469" lon="29.910926">
			<title>Днестровск</title>
		</region>
	
			<traffic/>
			
		<weather climate="1" region="101541">
			<source>mb3d</source>
			
		<day>
			<title>Днестровск</title>
			<country>Молдова</country>
			<time_zone>Europe/Kiev</time_zone>
			<summer-time>1</summer-time>
			<sun_rise>05:56</sun_rise>
			<sunset>18:17</sunset>
			<daytime>d</daytime>
			<date date="2020-03-23T00:00:00Z">
				<day weekday="пн">23</day>
				<month name="марта">3</month>
				<year>2020</year>
				<daytime>d</daytime>
			</date>
			
		<day_part typeid="2" type="день">
			<weather_type>облачно</weather_type>
			<weather_code>overcast</weather_code>
			<image>https://yastatic.net/weather/i/icons/blueye/24/ovc.png</image>
			<image-v2 size="22x22">http://yandex.st/weather/v-1/i/icons/22x22/ovc_+4.png</image-v2>
			<image-v3 size="48">https://yastatic.net/weather/i/icons/blueye/48/ovc.png</image-v3>
			<image_number>5</image_number>
			<wind_speed>6</wind_speed>
			<wind_direction id="ne">северо-восток</wind_direction>
			<dampness>50</dampness>
			<hectopascal>1023</hectopascal>
			<torr>767</torr>
			<pressure>767</pressure>
			<temperature class_name="t6" color="F2F0E6">+5</temperature>
			<time_zone>Europe/Kiev</time_zone>
			<observation_time>09:00</observation_time>
			<observation>2020-03-23T09:00:00</observation>
		</day_part>
	
			
		<day_part typeid="3" type="вечер">
			<image-v2 size="22x22">http://yandex.st/weather/v-1/i/icons/22x22/ovc_+4.png</image-v2>
			<image-v3 size="30">https://yastatic.net/weather/i/icons/blueye/30/ovc.png</image-v3>
			
			<temperature_from class_name="t2" color="F0F0EC">+2</temperature_from>
			<temperature_to class_name="t4" color="F1F0E9">+4</temperature_to>
		
		</day_part>
	

		<day_part typeid="4" type="ночь">
			<image-v2 size="22x22">http://yandex.st/weather/v-1/i/icons/22x22/ovc_0.png</image-v2>
			<image-v3 size="30">https://yastatic.net/weather/i/icons/blueye/30/ovc.png</image-v3>
			
			<temperature_from class_name="t-2" color="EAEDEF">-1</temperature_from>
			<temperature_to class_name="t2" color="F0F0EC">+1</temperature_to>
		
		</day_part>
	

		<day_part typeid="1" type="утро">
			<image-v2 size="22x22">http://yandex.st/weather/v-1/i/icons/22x22/ovc_+2.png</image-v2>
			<image-v3 size="30">https://yastatic.net/weather/i/icons/blueye/30/ovc.png</image-v3>
			
			<temperature_from class_name="t-2" color="EAEDEF">-2</temperature_from>
			<temperature_to class_name="t4" color="F1F0E9">+3</temperature_to>
		
		</day_part>
	

		<day_part typeid="2" type="день">
			<image-v2 size="22x22">http://yandex.st/weather/v-1/i/icons/22x22/ovc_+4.png</image-v2>
			<image-v3 size="30">https://yastatic.net/weather/i/icons/blueye/30/ovc.png</image-v3>
			
			<temperature_from class_name="t4" color="F1F0E9">+4</temperature_from>
			<temperature_to class_name="t6" color="F2F0E6">+5</temperature_to>
		
		</day_part>
	
			
			<night_short><temperature class_name="t2" color="F0F0EC">+2</temperature></night_short>,
			<tomorrow><temperature class_name="t6" color="F2F0E6">+5</temperature></tomorrow>
		
		</day>
	
			<url slug="dnestrovsk">http://pogoda.yandex.ru/dnestrovsk/</url>
		</weather>
	
		</info>
	


Не могу понять как парсить часть кода..
XML viewer :

Парсинг в 0-ом итеме делаю так:
Код: pascal
1.
2.
XMLDocument1.DocumentElement.ChildNodes['weather'].ChildNodes['day'].ChildNodes['day_part']
      .ChildNodes['weather_type'].Text;
...
Рейтинг: 0 / 0
Форумы / Delphi [игнор отключен] [закрыт для гостей] / XML как обратится к item? / 1 сообщений из 1, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]