Lua XML parse with domoticz_applyXPath

Post Reply
mikkel75
Posts: 32
Joined: Thursday 08 December 2016 21:50
Target OS: Linux
Domoticz version:
Contact:

Lua XML parse with domoticz_applyXPath

Post by mikkel75 » Wednesday 25 January 2017 22:39

Hi,

I'm having problems getting domoticz_applyXPath() to pass an XML sting like this

Code: Select all

<body>
<version>1.0</version>
<client>App</client>
<file_name>Controller</file_name>
<item_list_size>13</item_list_size>
<item_list>
	<i><n>G1.kurzID</n><v>2</v></i>
	<i><n>G1.ownerKurzID</n><v>68</v></i>
	<i><n>G1.RaumTemp</n><v>2172</v></i>
	<i><n>G1.SollTemp</n><v>2100</v></i>
	<i><n>G1.OPMode</n><v>0</v></i>
	<i><n>G1.WeekProg</n><v>0</v></i>
	<i><n>G1.TempSIUnit</n><v>0</v></i>
	<i><n>G1.SollTempMaxVal</n><v>3000</v></i>
	<i><n>G1.SollTempMinVal</n><v>500</v></i>
	<i><n>G1.SollTempStepVal</n><v>0</v></i>
	<i><n>G1.OPModeEna</n><v>1</v></i>
	<i><n>G1.WeekProgEna</n><v>1</v></i>
	<i><n>CD.rooms[1]</n><v></v></i>
</item_list>
</body>
I need to be able to index into the G1.RaumTemp value of 2172....

I have tried something like this:

Code: Select all

 domoticz_applyXPath(response_body[1],'//body/item_list/i[contains(@n, "G1.RaumTemp")]/@v')
BUT Lua reports:

Error: EventSystem: attempt to call global 'domoticz_applyXPath' (a nil value)

Hope some XML experts can help....

Thanks ;)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest