Manipulate[
years =
Import["http://www.fueleconomy.gov/ws/rest/vehicle/menu/year",
"XML"];
y = Cases[years, XMLElement["menuItem", _, _], Infinity] /.
XMLElement[_, _, {val_}] -> val /.
XMLElement["menuItem", _, list_] -> list;
Do[y[[i]] = DeleteDuplicates[y[[i]]], {i, 1, Length[y], 1}];
years = y[[All, 1]];
makes =
Import[StringJoin[
"http://www.fueleconomy.gov/ws/rest/vehicle/menu/make?year=",
ToString@year], "XML"];
m = Cases[makes, XMLElement["menuItem", _, _], Infinity] /.
XMLElement[_, _, {val_}] -> val /.
XMLElement["menuItem", _, list_] -> list;
Do[m[[i]] = DeleteDuplicates[m[[i]]], {i, 1, Length[m], 1}];
makes = m[[All, 1]];
models =
Import[URLEncode[
StringJoin[
"http://www.fueleconomy.gov/ws/rest/vehicle/menu/model?year=",
ToString@year, "&make=", ToString@make]], "XML"];
mo = Cases[models, XMLElement["menuItem", _, _], Infinity] /.
XMLElement[_, _, {val_}] -> val /.
XMLElement["menuItem", _, list_] -> list;
Do[mo[[i]] = DeleteDuplicates[mo[[i]]], {i, 1, Length[mo], 1}];
models = mo[[All, 1]];
options =
Import[URLEncode[
StringJoin[
"http://www.fueleconomy.gov/ws/rest/vehicle/menu/options?year=",
ToString@year, "&make=", ToString@make, "&model=",
ToString@model]], "XML"];
o = Cases[options, XMLElement["menuItem", _, _], Infinity] /.
XMLElement[_, _, {val_}] -> val /.
XMLElement["menuItem", _, list_] -> list;
Do[o[[i]] = DeleteDuplicates[o[[i]]], {i, 1, Length[o], 1}];
options = o[[All, 1]];
Row[{makesoptions}],
{year, years},
{make, makes},
{model, models},
{option, options},
TrackedSymbols :> {make, year, model, option}
]