openLuup and comments in XML

Pay attention on comments in the XML files of definition : they are parsed.
It may result in unwanted behaviors (specially with relatedStateVariable).

Yes, the XML parser code has the comments

-- 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!

an example :

		<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.

Could you just check that this replacement for openLuup/xml.lua does the business?

Thanks

Seems to work fine !

relatedStateVariable is correctly parsed.

Thanks - I’ll update GitHub.