Question

I want to parse XML response using robospice-google-http-client. I can parse json response as follows.

HttpRequest request = getHttpRequestFactory()//
                .buildGetRequest( new GenericUrl( url) );
        request.setParser(new JacksonFactory().createJsonObjectParser());
        return request.execute().parseAs( getResultType() );

how to parse XML? I tried this

request.setParser(new XmlObjectParser(new XmlNamespaceDictionary().set("", "test")));

but an error is thrown saying

java.lang.IllegalArgumentException: invalid XML: no alias declared for namesapce <>; work-around by setting XML namepace directly by calling the set method of com.google.api.client.xml.XmlNamespaceDictionary

i tired setting namespace but no luck

Était-ce utile?

La solution

solved this by setting new XmlNamespaceDictionary().set("", "")

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top