[dvblast-devel] Badly formed xml output

Zoran Turalija zoran.turalija at gmail.com
Fri Oct 28 09:42:12 CEST 2016


On Thu, Oct 27, 2016 at 01:32:00PM +0200, cmassiot at openheadend.tv wrote:
> Le 27.10.2016 12:14, Zoran Turalija a écrit :
> 
> >>ParseError: not well-formed (invalid token): line 4, column 135
> >
> >Offender is ampersand character that has special meaning in XML. Beside
> >ampersand, there are greater-than, less-than, apostrophe, quote etc. that
> >also have special meaning in XML. Therefore, they must be substituted with
> >character references when used as data in XML. In this case, ampersand
> >must
> >be substituted with & in order to comply to XML standard.
> >
> >Basically, code that writes data of selector_byte_txt must substitute all
> >XML
> >special characters before sending data to XML output generator.
> 
> We have a dvb_string_xml_escape function that can escape those characters.
> However, considering that the value is not meant to be user-readable anyway,
> we could avoid printing it in the first place. Is anyone relying on that?

If a value is not meant to be user-readable, then no one should rely on it,
especially since data hex value is provided and is easily converted to real
data if needed by user build parser in application or script. I think it is
both safe and correct to omit printing selector_byte_txt.

-- 
Kind regards,
Zoran Turalija


More information about the dvblast-devel mailing list