Hi,

i just found that my server is answering json althought it was said not to 
:s

Angular was adding Accept: application/json and that's why i had this 
unexpected json response.

I solved it by adding Accept: application/xml into
$http.defaults.headers.common

sry :(

Le vendredi 18 avril 2014 08:25:31 UTC+2, Luke Kende a écrit :
>
> http://rabidgadfly.com/2013/02/angular-and-xml-no-problem/
>
> On Thursday, April 17, 2014 8:04:10 AM UTC-6, Dude wrote:
>>
>> Hi All,
>>
>> I have an xml file like this :
>>
>> <Response>
>>   <Status>OK</Status>
>>   <Books>
>>     <Book>
>>       <id>1</id>
>>     </Book>
>>     <Book>
>>       <id>2</id>
>>     </Book>
>>   </Books>
>> </Response>
>>
>> it is 
>> Content-Type:
>> application/xml;charset=UTF-8
>>
>> when I call $http.get I get a strange object in return, for example if I 
>> want the first id I have to do :
>> data.Response.value.BooksBeanJSON.listBookBeanJSON[0].id
>> ???
>> why .value. ? why xxxxBeanJSON ? and listXxxxBeanJSON ?
>>
>> I which I had a String object so I could parse it myself but I don't have 
>> :(
>>
>> Secondly when I put a copy of this xml on a file accessed throught my 
>> local apache (still 
>> Content-Type:
>> application/xml;charset=UTF-8 )
>> I have a String result. Why is it different ? 
>> Then if I parse it using x2js it's fine :
>> data.Response.Books.Book[0].id
>>
>> can't find anything on the net, pls help
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to