We have moved at community.getvera.com

Author Topic: openLuup and comments in XML  (Read 909 times)

Offline vosmont

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 687
  • Karma: +60/-8
openLuup and comments in XML
« on: November 03, 2015, 08:13:04 am »
Pay attention on comments in the XML files of definition : they are parsed.
It may result in unwanted behaviors (specially with relatedStateVariable).

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: openLuup and comments in XML
« Reply #1 on: November 03, 2015, 08:25:58 am »
Yes, the XML parser code has the comments

Code: [Select]
-- general xml reader: this is just good enough to read device and implementation .xml files
-- doesn't cope with XML attributes or empty elements: <tag />
--
-- TODO: proper XML parser rather than nasty hack?

...so it obviously doesn't cope with comments either.

I has really hoped to stay away from a full blown SAX or DOM parser, but XML is well-known for being a nightmare to parse properly.

Can you send me an example file which is causing you grief?

--------

Edit:  I have to add that yours is the first instance of comments in Vera XML files that I have come across!

« Last Edit: November 03, 2015, 08:57:40 am by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline vosmont

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 687
  • Karma: +60/-8
Re: openLuup and comments in XML
« Reply #2 on: November 03, 2015, 08:56:29 am »
an example :
Code: [Select]
<action>
<name>GetAlarmStatus</name>
<argumentList>
<argument>
<name>retStatus</name>
<direction>out</direction>
<retval/>
<!--
<relatedStateVariable>A_ARG_TYPE_Boolean</relatedStateVariable>
-->
<relatedStateVariable>LastResult</relatedStateVariable>
</argument>
...

I've just deleted the comment and it's OK now.

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: openLuup and comments in XML
« Reply #3 on: November 03, 2015, 09:30:48 am »
Could you just check that this replacement for openLuup/xml.lua does the business?

Thanks
« Last Edit: November 03, 2015, 09:33:05 am by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline vosmont

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 687
  • Karma: +60/-8
Re: openLuup and comments in XML
« Reply #4 on: November 03, 2015, 09:36:06 am »
Seems to work fine !

relatedStateVariable is correctly parsed.

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: openLuup and comments in XML
« Reply #5 on: November 03, 2015, 09:40:00 am »
Thanks - I'll update GitHub.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.