api.tfl.gov.uk/TrackerNet/PredictionDetailed/ malformed output


#1

Sorry, little buglet…

I’m using the following API call to add “departing” tube data for Stratford and Ealing Broadway to the MTR Crossrail staff app.

api.tfl.gov.uk/TrackerNet/PredictionDetailed/

and the results come back in XML. However it’s sometimes badly formed and fails when I try to simplexml_load_string it Entity: line 1: parser error : attributes construct error’s…

<T LCID='2448031' SetNo='275' TripNo='0' SecondsTo='587' TimeTo='10:00' Location='Approaching Shepherd's Bush Market' Destination='Check Front of Train' DestCode='518' Order='0' DepartTime='17:57:56' DepartInterval='587' Departed='0' Direction='0' IsStalled='0' TrackCode='TBHTHSBMO' LN='H' />

Yes, the code has Approaching Shepherd’s Bush Market wrapped inside single quotes. So… the XML fails.