[dvblast-devel] Badly formed xml output

Zoran Turalija zoran.turalija at gmail.com
Thu Oct 27 12:14:03 CEST 2016


On Wed, Oct 26, 2016 at 11:15:37AM +0200, Daniel Kučera wrote:
> Hello all!
> 
> I'm getting errors when processing XML output from dvblastctl. The output looks
> like this:
> 
> <PMT program="1092" version="2" current_next="1" pcrpid="8191">
> <ES pid="992" streamtype="0x0b" streamtype_txt="13818-6 type B">
> <DESC id="0x66" length="27" value="000a1800267ff1c21293100000a002
> 000004db00000001ffffff01">
> <DATA_BROADCAST_ID_DESC broadcast_id="0x000a" selector_byte="
> 1800267ff1c21293100000a002000004db00000001ffffff01" selector_byte_txt="..
> &....................."/>
> </DESC>
> </ES>
> </PMT>
> 
> and getting this error when parsing:
> 
> 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.

XML is notorious for this, and maybe original author intentionally created
non compliant XML output, to preserve sanity. XML standard is great idea, but
subpar realisation. If possibe, best to avoid its use.

-- 
Kind regards,
Zoran Turalija


More information about the dvblast-devel mailing list