这是关于 text/xml
和 application/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/