Help with domoticz_applyXPath

Moderator: leecollings

Post Reply
glsf91
Posts: 58
Joined: Tuesday 14 November 2017 21:56
Target OS: Linux
Domoticz version:
Contact:

Help with domoticz_applyXPath

Post by glsf91 »

I have this XML:

Code: Select all

            <data>
               <location>
                  <block>
                     <field_id>Kop</field_id>
                     <valid_id>dag00_01</valid_id>
                     <field_content>Snijdend koud. Morgen droog en meer zon</field_content>
                  </block>
                  <block>
                     <field_id>Kort</field_id>
                     <valid_id>dag00_01</valid_id>
                     <field_content>Zeer koud met een snijdende oostenwind. Morgen op meer plaatsen zon en droog.</field_content>
                  </block>
               </location>
            </data>
I want field_content from block with <field_id>Kort</field_id>.

If I try

Code: Select all

            local report_id2 = domoticz_applyXPath(XML_string,'//data/location/block[2]/field_content/text()')
            local report_id3 = domoticz_applyXPath(XML_string,'//data/location/block[field_id="Kort"]/field_content/text()')
then the first one is working but the second one is not working.

I need the second one. I think it has something to do with the quotes in "Kort". I cannot manage to get this working.

Please advice.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest