Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between text/xml vs application/xml for webservice response

Tags:

rest

xml

jersey

This is more of a general question about the difference between text/xml and application/xml. I am fairly new to writing webservices (REST - Jersey). I have been producing application/xml since it is what shows up in most tutorials / code examples that I have been using to learn, but I recently found out about text/xml and was wondering what is different about it and when would you use it over application/xml?

like image 981
Mike Avatar asked Jan 28 '11 19:01

Mike


People also ask

Is xml and text the same?

XML file is simple and does not take a huge amount of data but plain text file is simpler and more ease than XML. Both files XML and TXT files text based lines and both can store and transport easily as well as XML files are in structured and commands document.

What is application xml?

The application.xml file is the deployment descriptor for Enterprise Application Archives. The file is located in the META-INF subdirectory of the application archive.

Where is application xml?

xml file is located in the application directory and specifies a different value than the default for an element that cannot be overridden, it is ignored, and the default is used. If the default Application.


1 Answers

From the RFC (3023), under section 3, XML Media Types:

If an XML document -- that is, the unprocessed, source XML document -- is readable by casual users, text/xml is preferable to application/xml. MIME user agents (and web user agents) that do not have explicit support for text/xml will treat it as text/plain, for example, by displaying the XML MIME entity as plain text. Application/xml is preferable when the XML MIME entity is unreadable by casual users.

(emphasis mine)

like image 179
Oded Avatar answered Oct 19 '22 14:10

Oded