mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-14 00:30:31 +00:00
Parse empty <itdItinerary>
This commit is contained in:
parent
3fa417cbe8
commit
0be5a62a09
1 changed files with 349 additions and 339 deletions
|
@ -2420,17 +2420,21 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
||||||
XmlPullUtil.enter(pp, "itdTripOptions");
|
XmlPullUtil.enter(pp, "itdTripOptions");
|
||||||
XmlPullUtil.exit(pp, "itdTripOptions");
|
XmlPullUtil.exit(pp, "itdTripOptions");
|
||||||
|
|
||||||
|
final List<Trip> trips = new ArrayList<Trip>();
|
||||||
|
|
||||||
|
XmlPullUtil.require(pp, "itdItinerary");
|
||||||
|
if (!pp.isEmptyElementTag())
|
||||||
|
{
|
||||||
XmlPullUtil.enter(pp, "itdItinerary");
|
XmlPullUtil.enter(pp, "itdItinerary");
|
||||||
|
|
||||||
final Calendar time = new GregorianCalendar(timeZone());
|
final Calendar time = new GregorianCalendar(timeZone());
|
||||||
final List<Trip> trips = new ArrayList<Trip>();
|
|
||||||
|
|
||||||
XmlPullUtil.enter(pp, "itdRouteList");
|
XmlPullUtil.enter(pp, "itdRouteList");
|
||||||
|
|
||||||
while (XmlPullUtil.test(pp, "itdRoute"))
|
while (XmlPullUtil.test(pp, "itdRoute"))
|
||||||
{
|
{
|
||||||
final String id = useRouteIndexAsTripId ? pp.getAttributeValue(null, "routeIndex") + "-" + pp.getAttributeValue(null, "routeTripIndex")
|
final String id = useRouteIndexAsTripId ? pp.getAttributeValue(null, "routeIndex") + "-"
|
||||||
: null;
|
+ pp.getAttributeValue(null, "routeTripIndex") : null;
|
||||||
final int numChanges = XmlPullUtil.intAttr(pp, "changes");
|
final int numChanges = XmlPullUtil.intAttr(pp, "changes");
|
||||||
XmlPullUtil.enter(pp, "itdRoute");
|
XmlPullUtil.enter(pp, "itdRoute");
|
||||||
|
|
||||||
|
@ -2545,7 +2549,8 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
||||||
{
|
{
|
||||||
final String destinationName = normalizeLocationName(pp.getAttributeValue(null, "destination"));
|
final String destinationName = normalizeLocationName(pp.getAttributeValue(null, "destination"));
|
||||||
final String destinationIdStr = pp.getAttributeValue(null, "destID");
|
final String destinationIdStr = pp.getAttributeValue(null, "destID");
|
||||||
final int destinationId = (destinationIdStr != null && destinationIdStr.length() > 0) ? Integer.parseInt(destinationIdStr) : 0;
|
final int destinationId = (destinationIdStr != null && destinationIdStr.length() > 0) ? Integer.parseInt(destinationIdStr)
|
||||||
|
: 0;
|
||||||
final Location destination = new Location(destinationId > 0 ? LocationType.STATION : LocationType.ANY,
|
final Location destination = new Location(destinationId > 0 ? LocationType.STATION : LocationType.ANY,
|
||||||
destinationId > 0 ? destinationId : 0, null, destinationName);
|
destinationId > 0 ? destinationId : 0, null, destinationName);
|
||||||
final String lineLabel;
|
final String lineLabel;
|
||||||
|
@ -2823,6 +2828,11 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
||||||
|
|
||||||
XmlPullUtil.exit(pp, "itdRouteList");
|
XmlPullUtil.exit(pp, "itdRouteList");
|
||||||
XmlPullUtil.exit(pp, "itdItinerary");
|
XmlPullUtil.exit(pp, "itdItinerary");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XmlPullUtil.next(pp);
|
||||||
|
}
|
||||||
|
|
||||||
return new QueryTripsResult(header, uri, from, via, to, new Context(commandLink((String) context, requestId)), trips);
|
return new QueryTripsResult(header, uri, from, via, to, new Context(commandLink((String) context, requestId)), trips);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue