This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Help with scripts for reading and searching in xml files!
#1
Heart 
Can anyone help me?
I have an XML info via a "Get http" :
http:/ip/xml/zone/get.xml?xxx
----------------------------
<rows>
<runtime>
<class>zone</class>
<id>2</id>
<source>
<description>SNR 1001121.46</description>
<basic>
<sourceID>0</sourceID>
<sourceType>Z</sourceType>
<sourceDescription>SNR 1001121.46</sourceDescription>
<sourceStatusCode>0</sourceStatusCode>
<sourceStatusText>Working OK</sourceStatusText>
<sourceMode>2</sourceMode>
<player>127.0.0.1:1335</player>
<cmd>
<action>14</action>
<page>240</page>
<slot>0</slot>
<iconUrl>/imgs/visuIconSearch_128px.png</iconUrl>

</cmd>
<cmdCount>1</cmdCount>

</basic>
<status>
<sourceStatusInfoCount>0</sourceStatusInfoCount>
<airPlay>1</airPlay>
<artist>Cao_20Thai_20Son_2CHuong_20Tram</artist>
<album>Se_20Co_20Nguoi_20Can_20Anh_20_28Single_29</album>
<track>Se_20Co_20Nguoi_20Can_20Anh</track>
<imageURL>/~cover/get?key=airplay:2809</imageURL>
<imageURL>/imgs/visuIconNoCoverart_400px.png</imageURL>
<playerIP>127.0.0.1</playerIP>
<playerPort>1335</playerPort>
<submenu>/xml/music/getSubMenu.xml?which=trackMenuAirPlay</submenu>
<info>
<key>AirPlay</key>
<value>Se Co Nguoi Can Anh</value>
<size>0</size>

</info>
<info>
<key>Artist</key>
<value>Cao Thai Son,Huong Tram</value>
<size>0</size>

</info>
<info>
<key>Album</key>
<value>Se Co Nguoi Can Anh (Single)</value>
<size>0</size>

</info>
<info>
<key>Playing</key>
<value>AirPlay</value>
<size>0</size>

</info>
<info>
<key>Status</key>
<value>Playing 44.1 kHz</value>
<size>1</size>

</info>
<infoCount>5</infoCount>
<mostImportantInfo>0</mostImportantInfo>
<infoLevel>0</infoLevel>

</status>

</source>
<outputcount>0</outputcount>
<status>on</status>
<volume>33</volume>

</runtime>
<info>
<message>not all elements are shown</message>

</info>
<db>
<defined>1</defined>
<description>Living room</description>
<language>Lang-german.cfg</language>
<MaxVolumeZoneOn>56</MaxVolumeZoneOn>
<MaxVolume>99</MaxVolume>
<AlarmAction>0</AlarmAction>
<AlarmVolume>25</AlarmVolume>
<AlarmDue>30</AlarmDue>
<Timer1Active>0</Timer1Active>
<Timer1Mode>0</Timer1Mode>
<Timer1Volume>25</Timer1Volume>
<Timer1FromDayMinute>0</Timer1FromDayMinute>
<Timer1ToDayMinute>0</Timer1ToDayMinute>
<Timer2Active>0</Timer2Active>
<Timer2Mode>0</Timer2Mode>
<Timer2Volume>25</Timer2Volume>
<Timer2FromDayMinute>0</Timer2FromDayMinute>
<Timer2ToDayMinute>0</Timer2ToDayMinute>

</db>
<userdata name="rc">0</userdata>
<userdata name="version">
trivum V9.13 build 12489 (compiled May 8 2017 14:32:50)
</userdata>
<userdata name="time">2017-11-25 11:59:36</userdata>
<userdata name="message">done</userdata>

</rows>
===============================
Here:
<basic>

<sourceID>0</sourceID>

<sourceType>Z</sourceType>

<sourceDescription>SNR 1001121.46</sourceDescription>

<sourceStatusCode>0</sourceStatusCode>

<sourceStatusText>Working OK</sourceStatusText>
<sourceMode>2</sourceMode>
<player>127.0.0.1:1335</player>

<cmd>

<action>14</action>

<page>240</page>

<slot>0</slot>

<iconUrl>/imgs/visuIconSearch_128px.png</iconUrl>

</cmd>

<cmdCount>1</cmdCount>
</basic>
Who can write a script to find the string "SNR 1001121.46" in the above paragraph, or the entire XML above?
And write to 1/1/1 on KNX address on Lm3
Or here:
<sourceStatusText>Working OK</sourceStatusText>
who can write a script to find the string "Working OK" ?

Here:
<info>
<key>AirPlay</key>
<value>Se Co Nguoi Can Anh</value>
<size>0</size>
</info>
Who can get the string in "Se Can Nguoi Can Anh" inside <value> Se Can Nguoi Can Anh </ value>. And write to 1/1/2 on KNX address on Lm3
I am very thankful to everyone!  Heart Heart Heart
Reply


Messages In This Thread
Help with scripts for reading and searching in xml files! - by phongvucba - 25.11.2017, 07:21

Forum Jump: