XML Parser for robospice-google-http-client?

868 views Asked by At

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

1

There are 1 answers

0
sooraj.e On BEST ANSWER

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