[SOLVED] Help with XML parsing of Web data

That’s the one, I knew there was a REGEX that was pooling the whole string.
I never use REGEX, I just can get my head around it…

Let me understand.

With Feed Binding I can extrapolate the “description” part in an item like:

String MeteoAlarm_description            {channel="feed:feed:meteoalarm:description"}

Then I need a rule that can parse what I need in that string? can you please explain a bit more?

thanks
Andrea

No, the rule you need only, if you use this way

String s "s[%s]" {http="<[https://www.scanmatic.no/vaeret-i-kilsund/:60000:REGEX((.*?))]"}

Thanks @hr3 :slight_smile:

Interesting, it seems working :slight_smile:

if for example I try to parse
https://www.meteoalarm.eu/en_UK/1/0/EE002-Estonia.html
via https://regex101.com/
with this REGEX:

.*aw.*?([0-9]+[0-9]+).*.

I see two numbers (what I want):

53
82

Question is: how to manage the array when I have 2+ alerts? At this moment in time if I have 2 alerts, I can see only the last one.

thanks
Andrea

the first idea I have is definitely not elegant:

  • create 12 items for all 12 alerts (aw1x, aw2x, … where x is the level of criticity) and put all 12 items in one group “meteoalarms”
  • play with visibility in sitemap to see only the alerts I have in my region

any other suggestion how to play with array in regex?

Thanks
Andrea

Hi Vincent,

Would you mind helping out some more? :smiley:

I struggle a bit with the wind direction parsing. It has got both number and text value in the same separator line,
so it get overwritten with the wrong value.

2018-08-05 20:27:46.453 [ome.event.ItemCommandEvent] - Item 'Kilsund_Vindretning' received command NV

2018-08-05 20:27:46.526 [vent.ItemStateChangedEvent] - Kilsund_Vindretning changed from  to 1

I’m just interessted in the text value, in this Case “NV” for NorthWest.
Do you have any solutions for me on this matter? :slight_smile:

BR
Christian

image

Two html nodes in series
And the function node contains:

msg.payload = msg.payload[0];
return msg;

Thank you Vincent. But that doesn’t give me any output at all :S Does this work for you?

thx
Christian

It works for me. It’s the same http request node as before.

hmmm… Is this how your HTML node looks like?
image

I changed to “HTML content of the element” and now its working :smiley: Thanks again Vincent! :+1:

Sorry I couldn’t reply. My broadband Internet is down. I am replying from my phone.
Glad you got it sorted