mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-15 17:10:30 +00:00
Check some XML tag names more strictly
This commit is contained in:
parent
c1f6727a4e
commit
a5a4e47830
2 changed files with 8 additions and 13 deletions
|
@ -338,11 +338,11 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
pp.setInput(reader);
|
||||
|
||||
assertResC(pp);
|
||||
XmlPullUtil.enter(pp);
|
||||
XmlPullUtil.enter(pp, "ResC");
|
||||
|
||||
XmlPullUtil.require(pp, "LocValRes");
|
||||
XmlPullUtil.requireAttr(pp, "id", "req");
|
||||
XmlPullUtil.enter(pp);
|
||||
XmlPullUtil.enter(pp, "LocalValRes");
|
||||
|
||||
while (pp.getEventType() == XmlPullParser.START_TAG)
|
||||
{
|
||||
|
@ -361,7 +361,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
XmlPullUtil.next(pp);
|
||||
}
|
||||
|
||||
XmlPullUtil.exit(pp);
|
||||
XmlPullUtil.exit(pp, "LocalValRes");
|
||||
|
||||
return results;
|
||||
}
|
||||
|
@ -1426,7 +1426,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
trips.add(new Trip(id, departureLocation, arrivalLocation, legs, null, capacity, numTransfers));
|
||||
}
|
||||
|
||||
XmlPullUtil.exit(pp);
|
||||
XmlPullUtil.exit(pp, "ConnectionList");
|
||||
|
||||
return new QueryTripsResult(header, null, from, via, to, context, trips);
|
||||
}
|
||||
|
@ -1463,13 +1463,13 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
while (XmlPullUtil.test(pp, "AttributeVariant"))
|
||||
{
|
||||
final String type = XmlPullUtil.attr(pp, "type");
|
||||
XmlPullUtil.enter(pp);
|
||||
XmlPullUtil.enter(pp, "AttributeVariant");
|
||||
final String value;
|
||||
if (XmlPullUtil.test(pp, "Text"))
|
||||
value = XmlPullUtil.text(pp).trim();
|
||||
else
|
||||
value = null;
|
||||
XmlPullUtil.exit(pp);
|
||||
XmlPullUtil.exit(pp, "AttributeVariant");
|
||||
|
||||
attributeVariants.put(type, value);
|
||||
}
|
||||
|
|
|
@ -20,11 +20,6 @@ public final class XmlPullUtil
|
|||
pp.require(XmlPullParser.START_TAG, null, tagName);
|
||||
}
|
||||
|
||||
/**
|
||||
* enters current tag
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void enter(final XmlPullParser pp) throws XmlPullParserException, IOException
|
||||
{
|
||||
if (pp.getEventType() != XmlPullParser.START_TAG)
|
||||
|
@ -82,8 +77,8 @@ public final class XmlPullUtil
|
|||
|
||||
if (!pp.isEmptyElementTag())
|
||||
{
|
||||
enter(pp);
|
||||
exit(pp);
|
||||
enter(pp, tagName);
|
||||
exit(pp, tagName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue