0

Android の新しい Java API を介してフィーチャ フィードからマップ フィーチャを取得する際に、実際に問題が発生しています。(特定の MapFeed から) ID とタイトルを含む featureFeed を取得できますが、FeatureContent をリクエストに追加するとすぐに (目印の詳細を取得するため)、FeatureFeed.executeGet() は「400 bad request」エラーを返します。私は何か間違ったことをしていますか、それとも現時点で実際にエラーがありますか? 以下は私のコードの一部です - 私はこれに3日間頭をぶつけていたので、どんな情報でも大歓迎です! (FeatureContent クラスで「kml:placemark」、「atom:placemark」、「placemark」を試しました)


public class FeatureFeed { 
    @Key("atom:id") 
    public String id; 
    @Key("atom:title") 
    public String title; 
    @Key("atom:entry") 
    public List features; 

public List<FeatureEntry> maps = new ArrayList<FeatureEntry>();

public static FeatureFeed executeGet( HttpTransport transport,
                BuildMapsUrl url) throws IOException {
 url.fields = GData.getFieldsFor(FeatureFeed.class);
 AtomParser parser = new AtomParser();
 parser.namespaceDictionary = Namespace.FEED_NAMESPACE_DICTIONARY;
 transport.addParser(parser);
 HttpRequest request = transport.buildGetRequest();
 request.url = url;
 return (FeatureFeed) RedirectHandler.
                  execute(request).parseAs(FeatureFeed.class);
}

}

public class FeatureEntry implements Cloneable { @Key("atom:id") public String id; @Key("atom:title") public String title; @Key("atom:content") public FeatureContent content;

public FeatureEntry() { // required } public FeatureEntry(String title, FeatureContent content) { this.title = title; this.content = content; } }

public class FeatureContent implements Cloneable {

@Key("@type") public String contentType = "application/vnd.google-earth.kml+xml";

@Key ("kml:Placemark") // adding this always fails with Bad Request
public FeaturePlaceMark placemark; // adding this always fails with Bad Request

public FeatureContent() { //required }

public FeatureContent(FeaturePlaceMark placemark) { this.placemark = placemark; } }

FEED_NAMESPACE_DICTIONARY.namespaceAliasToUriMap; feedMap.put("", "http://www.w3.org/2005/Atom"); feedMap.put("kml", "http://www.opengis.net/kml/2.2"); feedMap.put("atom", "http://www.w3.org/2005/Atom"); feedMap.put("exif", "http://schemas.google.com/photos/exif/2007"); feedMap.put("gd", "http://schemas.google.com/g/2005"); feedMap.put("gm", "http://schemas.google.com/g/2008#mapfeature"); feedMap.put("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#"); feedMap.put("georss", "http://www.georss.org/georss"); feedMap.put("gml", "http://www.opengis.net/gml"); feedMap.put("gphoto", "http://schemas.google.com/photos/2007"); feedMap.put("media", "http://search.yahoo.com/mrss/"); feedMap.put("openSearch", "http://a9.com/-/spec/opensearch/1.1/"); feedMap.put("xml", "http://www.w3.org/XML/1998/namespace");

4

1 に答える 1

0

私もそこに行ったことがあります...そして、この文を削除するurl.fields = GData.getFieldsFor(FeatureFeed.class);と、プログラムはうまく動作します。奇妙ですが効果的です。あなたはそれを試すことができます。

于 2011-03-28T08:18:46.237 に答える