Please Help XML Parsing with XPATH

Tags: #<Tag:0x00007fe0580e45f8>

(Matei Garici) #24

No. Now I did install it and also changed to 60000ms, but still no result. The only difference is that now the dash is gone.

(Vincent Regaud) #25

Try that:
This will check if we get any data at all

String Info "Info [%s]" {http="<[]"}

(Matei Garici) #26

thx but it makes no difference :frowning:

(Vincent Regaud) #27

I now have:

String Info "Info [%s]" { http="<[]" }

I have tried with t full regex and It got the data
I have checked the XPATH in
and your XPATH is correct
I don’t know why it doesn’t work

(Josar) #28

@gsmatei and @vzorglub The xpath does not work as it does not address the namespace.

(Matei Garici) #29

thx @vzorglub!!!


Starting from the example in your link:

String Temperature_xml “Temperature [JSONPATH([name()=‘PTZStatus’]/[name()=‘AbsoluteHigh’]/[name()=‘azimuth’]/):%s °C]” {…}

i’ve tried with this but it’s not working:

String Info “Info [JSONPATH([name()=‘liveStreams’]/[name()=‘stream’]/[name()=‘label’]/) %s]” {http="<[]"}

What I’m doing wrong?


(Josar) #30

Documentation has an typo JSONPATH vs XPATH

(Matei Garici) #31


Still something else is wrong with that example. Look what i get:

with this: String Info “Info [XPATH([name()=‘liveStreams’]/[name()=‘stream’]/[name()=‘label’]/) %s]” {http="<[]"}

(Josar) #32

you have to give a closer look :wink:

there is something missing " : "

azimuth’]/):%s °C]

(Matei Garici) #33

I added “:”. Still no difference then the last print screen :frowning:

(Josar) #34
[name()='PTZStatus']/*[name()='AbsoluteHigh']/*[name()='azimuth']/):%s °C]


[name()='liveStreams']/[name()='stream']/[name()='label']/) %s]

you could try it with

String Info "Info [XPATH(/*[name()='liveStreams']/*[name()='stream']/*[name()='label']/):%s]" {...}

(Josar) #35

@gsmatei and using code fences makes reading the post a lot easier.

(Matei Garici) #36

Sorry for not using code fences.

Nope, still not working with the same code from you :frowning:

String Info "Info [XPATH(/*[name()='liveStreams']/*[name()='stream']/*[name()='label']/):%s]"  {http="<[]"}

(Josar) #37

But you have installed the XPATH transformation!

What does the log say?

(Josar) #38

@gsmatei this works

String http_Info "Info [%s]" {http="<[*[name()='liveStreams']/*[name()='stream']/*[name()='label'])]"}

(Matei Garici) #39

Looks like it’s installed.

Log file says:

2018-05-07 15:46:22.416 [ERROR] [el.item.internal.GenericItemProvider] - Binding configuration of type 'http' of item 'Info' could not be parsed correctly.
org.eclipse.smarthome.model.item.BindingConfigParseException: bindingConfig '' doesn't represent a valid in-binding-configuration. A valid configuration is matched by the RegExp '(.*?)(\{.*\})?:(?!//)(\d*):(.*)'
	at org.openhab.core.binding.internal.BindingConfigReaderDelegate.processBindingConfiguration([176:org.openhab.core.compat1x:2.1.0]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings([123:org.eclipse.smarthome.model.item:0.9.0.b5]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings([123:org.eclipse.smarthome.model.item:0.9.0.b5]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.processBindingConfigsFromModel([123:org.eclipse.smarthome.model.item:0.9.0.b5]
	at org.eclipse.smarthome.model.item.internal.GenericItemProvider.modelChanged([123:org.eclipse.smarthome.model.item:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners([122:org.eclipse.smarthome.model.core:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel([122:org.eclipse.smarthome.model.core:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile([122:org.eclipse.smarthome.model.core:0.9.0.b5]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processWatchEvent([122:org.eclipse.smarthome.model.core:0.9.0.b5]

(Matei Garici) #40

Yes!!! Now it’s working!!!

String http_Info "Info [%s]" {http="<[*[name()='liveStreams']/*[name()='stream']/*[name()='label'])]"}

Super thx!!!

(Vincent Regaud) #41

Thanks, I was basically copying the one use for openhab service
Learned something, always good

(Josar) #42

Just as an additional information, there is/was a bug in the label transformation. But it schould be fixed in future reaeases.
Thats why the transformation had to be done at the binding which is a better solution if the content of the xml is not needed anywhere else, imho.

( ) #43


I´d like to receive the current tv show via xml, this expression would normaly return me the current running tv-show on that specific channel 'ARD':


With the help of this post, I was able to create an Item which returns me the channel name as result, as expected. But how can I add the value that I´m searching for 'ARD' and the desired output value in the field <title>?

String      TV_Channel_ARD_CurrentShow      "Aktuell laeuft [%s]"     { http="<[*[name()='rss']/*[name()='channel']/*[name()='item']/*[name()='dc:subject'])]"}