开发者

Alternative file extension for XML file?

i just have a simple question to ask. For XML file, i know that the file extension is .xml but can it be possible to have 开发者_运维知识库an file extension of .pro/.m?


You can store anything you want in any file of any extension.

If you are returning the file from a website, you will need to ensure that you are setting the correct mimetype for the file extension though (text/xml or application/xml for raw xml)

You can do this by adding a static mimetype for the extension, or if your using server-side code you can set this in the Http Headers


The only significance of a file extension is that the operating system or web server typically allows you to set up a mapping from file extensions to applications that can process the file (or to MIME types, which amounts to the same thing). And of course it will probably have a default mapping. Given that the mapping is configurable, you can use any file extensions you like.


You can give any file any extension.


Yes.

Just specify what extension you want.

Of course, depending on the OS, the default action when a user selects that file might change depending on the extension, but there is nothing inherent in XML that requires a file containing XML to be named .xml. (For a start a different extension, like .xsd, is often used for XML-Schema documents which are also XML.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜