application / xml and text / xml difference
Often see the xml mentioned "application / xml" and "text / xml" two types, both function exactly the same, only difference is the encoding format, text / xml ignore xml header encoding format specified by the default use of us -ascii encoding, and application / xml xml header according to the specified encoding format to encode:
XML has two MIME types, application / xml and text / xml. These are often used interchangeably, but there is a subtle difference which is why application / xml is generally recommended over the latter.
Let me explain why: according to the standard, text / *-MIME types have a us-ascii character set unless otherwise specified in the HTTP headers. This effectively means that any encoding defined in the XML prolog (eg <? Xml version = " 1.0 "encoding =" UTF-8 "?>) is ignored. This is of course not the expected and desired behaviour.
To further complicate matters, most / all browser implementations actually implement nonstandard behaviour for text / xml because they process the encoding as if it were application / xml.
So, text / * has encoding issues, and is not implemented by browsers in a standards-compliant manner, which is why using application / * is recommended.
text / xml and application / xml character set encoding
Keywords: text / xml application / xml
For Webservice application, we usually use UTF-8 transport network, but there are also transmitted by GBK and GB2312 situation, but the code in our Webservice, in fact, is not concerned about the specific transmission coding, because, according to RFC2376 definition, Webservice engine (axis, cxf, jaxws ..) according to the ContentType of the file transfer part of the definition and the XML declaration encoding will automatically transfer over the network content (string) into unicode (jvm run-time string are there as unicode). The following is a description of RFC2376: