1 #include "httpclient_p.h"
4 #include <QXmlStreamReader>
7 HttpClientPrivate::HttpClientPrivate( QObject *parent ) :
13 HttpClientPrivate::~HttpClientPrivate()
17 RouteData HttpClientPrivate::parseReply( const QByteArray &reply )
21 QXmlStreamReader xml( reply );
25 while ( !xml.atEnd() ) {
27 if ( xml.isStartElement() && xml.name() == "LINE" ) {
28 QString lineCode( xml.attributes().value("code").toString() );
30 retVal.lineCode = lineCode;
34 if ( inLine && xml.name() == "STOP" ) {
37 if ( inLine && inStop && xml.name() == "ARRIVAL" ) {
38 QString arrivalTime( xml.attributes().value("time").toString() );
40 retVal.arrivalTime = arrivalTime;
44 if ( xml.isEndElement() && xml.name() == "STOP" ) {
47 if ( xml.isEndElement() && xml.name() == "LINE" ) {
52 if ( xml.hasError() ) {
53 qDebug() << "xml error";
59 void HttpClientPrivate::setFromLocation( Location fromLocation )
61 m_fromLocation = fromLocation;
64 Location HttpClientPrivate::fromLocation()
66 return m_fromLocation;
69 void HttpClientPrivate::setToLocation( Location toLocation )
71 m_toLocation = toLocation;
74 Location HttpClientPrivate::toLocation()