Search code examples
xmlrestjersey

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


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?


Solution

  • This is an old question, but one that is frequently visited and clear recommendations are now available from RFC 7303 which obsoletes RFC3023. In a nutshell (section 9.2):

    The registration information for text/xml is in all respects the same
    as that given for application/xml above (Section 9.1), except that
    the "Type name" is "text".