0

I am trying to send an xml file as a httpresponse to a post from an android application.
I understood how to send data from a php page here.
Is it possible to send a xml file as a response?
Or do I have to send the content of xml file as a string and parse it in the application?
If it is possible, How do I read the file in my application, so that I can parse it for information?
Thank you.

Community
  • 1
  • 1
Brahadeesh
  • 2,245
  • 8
  • 40
  • 58

2 Answers2

0

Of course you can. just you can send the xml format type in a php source file.

like following code. sorry for writing [ instead of < or > as this post doesn't allow tag elements.

echo '[?xml version="1.0" encoding="utf-8"?]'; echo '[something][/something]';

0

Send the xml from the server as a string. And in the application side parse the string either using SaxParser, XmlPullParser or DomParser. These are all commonly used.

This is a tutorial from IBM which gives an overview of parsing in android http://www.ibm.com/developerworks/opensource/library/x-android/index.html

blessanm86
  • 31,439
  • 14
  • 68
  • 79