0

I am trying to write a ASP.net Web API that sends XML files from the database and recieve/read it on android

The XML file that I send is something like this

<ArrayOfMerchant xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MvcApplication1.Models">
    <Merchant>
        <Address>ABC</Address>
        <City>HHHH</City>
        <Country>EEEE</Country>
        <Id>1</Id>
        <Latitude/>
        <Longitude/>
        <Name>Some store</Name>
    </Merchant>
</ArrayOfMerchant>

Opened on browser and it looks fine.

On the Android side I am trying to receive and read it with HttpURLConnection. Everything works , but when I try to convert the Input-stream into string, the string is something like

String = [{"Id":1,"Name":"Some store","Address":"ABC","City:"EEEE","Country":"Canada","Longitude":"","Latitude":""}]

Question:

1)Why does it display differently with different markup and also different ordering of the elements?

2)How can I receive / retrieve it as a normal XML file so I can parse it?

SheetJS
  • 22,470
  • 12
  • 65
  • 75
noobiehacker
  • 1,099
  • 2
  • 12
  • 24

1 Answers1

0

1) I dot know, depends on your ASP code and configuration. You can try to change parameters of your HTTP request to see how your ASP app respond when you change Accept header or User-Agent. There are some tools.

2) Actually, you don't need XML to parse the data .

Community
  • 1
  • 1
Damian
  • 2,930
  • 6
  • 39
  • 61