سؤال

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

هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top