-
Platform information:
- OS:WINDOWS 8
- openHAB version: 2
-
Issue of the topic: Trying to retrieve XML Data from this site http://ieso.ca/en/Power-Data and not getting anything, also dont seem to see the item created in the panel.
The XML is here http://ieso.ca/-/media/files/ieso/uploaded/chart/price_multiday.xml?la=en
XPATH that im using that seems to work on the tester - /Root/DataSet/Data/Value/number()
.Rules
rule "Convert XML to Item Type Number"
when
Item Price_xml changed
then
// use the transformation service to retrieve the value
// Simple
val mytest = transform("XPATH", "/*[name()='Root']
/*[name()='DataSet']
/*[name()='Data']
/*[name()='Value']
/text()",
Price_xml.state.toString )
// Fully qualified
val mytest = transform("XPATH", "/*[local-name()='Root' and namespace-uri()='http://www.w3.org/2001/XMLSchema-instance']
/*[local-name()='DataSet' and namespace-uri()='http://www.w3.org/2001/XMLSchema-instance']
/*[local-name()='Data' and namespace-uri()='http://www.w3.org/2001/XMLSchema-instance']
/*[local-name()='Value' and namespace-uri()='http://www.w3.org/2001/XMLSchema-instance']
/text()",
Price_xml.state.toString )
// post the new value to the Number Item
Price.postUpdate( newValue )
end
.item
//XPATH /Root/DataSet/Data/Value/number() TESTED ON WEBSITE
String Price_xml "Price [XPATH(/*[name()='Root']/*[name()=DataSet']/*[name()='Data']/*[name()=Value']/):%s $]" {...}
Number Price "Price [%.1f $]"
EDIT: I have updated some of the obvious errors i have made with the code, as i had the XPATH expression totally messed up.
If i can get any input on what i might be doing wrong, it will be greatly appreciated.
Thanks guy!