Ticket #125 (new bug)
Parser exception on " H"
| Reported by: | MH | Owned by: | pietercolpaert |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | API | Keywords: | SAXParseException |
| Cc: |
Description
I've been using the api to parse liveboards of stations but I keep getting an exception: "org.xml.sax.SAXParseException: The element type "hr" must be terminated by the matching end-tag "</hr>"." whenever I parse the liveboard of the following stations: "Ham Sur Heure", "Oud Heverlee", "De Hoek" and others. The only common property I have found is that the names of the stations all contain a space followed with a capital H.
Any solution known?
Change History
comment:2 Changed 14 months ago by MH
Turns out the problem was related to the name of the station not being url-endcoded. " H" was translated to "%20H". The strings should be url-encoded like:
public synchronized Liveboard getLiveboard(Station station) throws Exception
{
String encodedurl = URLEncoder.encode(station.getName(),"UTF-8");
URLFactory urlFactory=new URLFactory(providerURL,"liveboard/");
urlFactory.addQuery("station",encodedurl);
urlFactory.addQuery("lang",language);
return IRailParser.parseLiveboard(urlFactory.getURL());
}
It works fine then.
Note: See
TracTickets for help on using
tickets.

Hi MH,
Sadly, I don't have an idea why this issue occurs. I'm currently not maintaining the source code any longer. I hope you can share your solution when you found one?
Kind regards,
Pieter