xml - Web 服务响应的 text/xml 与 application/xml 之间有什么区别

标签 xml rest jersey

这是关于 text/xmlapplication/xml 之间区别的一般性问题。 我对编写网络服务(REST - Jersey)还很陌生。我一直在制作 application/xml,因为它出现在我用来学习的大多数教程/代码示例中,但我最近发现了 text/xml并且想知道它有什么不同,你什么时候会在 application/xml 上使用它?

最佳答案

来自 RFC ( 3023 ),第 3 节,XML 媒体类型:

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.

(强调我的)

关于xml - Web 服务响应的 text/xml 与 application/xml 之间有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4832357/

相关文章:

java - 如何控制生成的 JAXB 枚举

javascript - 使用 jQuery 解析 XML

android - 在 Android App 中将 Retrofit Adapter 放在哪里?

spring - @InjectParam 没有按预期工作

java - 在 JsonObject 中存储资源输出时出现 com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException

c# - DataContractSerializer - 命名空间问题

javascript - 在 XML 文件中使用 JavaScript 变量

node.js - 使用 Angular.js 和 Node.js 构建实时应用程序的更好方法是什么?

rest - 您如何使用他们的 REST api 向 Atlassian confluence 发表评论?

java - 如何使用 JAXB 将 Properties 对象转换为 JSON 对象