[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: [Summary] Media type (MIME) of XML in MS Word? in Notepad?
Hi. The first part of this summary is fine, but the second type may be missing some context. > The Editor used to Create the XML Determines its MIME Type Applications have a variety of ways of encoding data when they save it to a file. XML specs specify the method valid XML documents may use to represent data. The extension of a file in windows is used by the OS and by windows applications to guess at the method of data representation that is used in the file, and what application should be used to open/view/edit the file. However, the extension is merely a string pattern in the filename and may or may not provide this information accurately. In windows, applications and the OS often also use the file extension to guess at an appropriate mime type to assign to a file. The mime type is "meta-data" that is often sent along with a file (in email for example) that can help other applications or operating systems know what to do with the file. It's often useful to make sure that your XML documents get assigned a mime type of application/xml by any application or OS that is assigning mime types. This is most likely to happen in windows if you give your XML file the .xml extension. In order for the file to be a well formed XML file, you must also make sure that it follows the rules for properly encoding XML. > Interestingly, you may have a document which contains XML and > yet its MIME type may not be application/xml. The implication that files "have" a mime type as a permanent characteristic is not true under windows and many other OS's. > For example, take this simple XML: > and put it into Word (save it as a .doc file). The MIME type is: > > application/msword It would be more accurate to say that the file extension is .doc and that most windows applications will map that to the mime type application/msword. Also, you've created a binary file and there's never a time when an MS word formatted file is also an XML document. The word document may contain things that a human would recognize as XML were they to open the document in word, but word documents do not conform to the specifications of what an XML document must/may contain. > Conversely, if you put the same XML into Notepad, the MIME type is: > > application/xml Again, it will depend what extension you save it as and what the next application decides to do with files of that extension. I believe the next two paragraphs are inaccurate: > Why is that? Why is it that if you put XML into one editor > (Word) you get a MIME type that is specific to the editor, > whereas if you put XML into another editor (Notepad) you get > a MIME type that is independent of the editor? > > The answer is this: when the XML is put into Word, the Word > application wraps the XML with a bunch of Word-specific stuff > (the wrapper stuff is not visible). Consequently, the Word > document isn't something you can feed directly into an XML parser. > > <snip> > > Answer: it depends on how you save the file. If you save it > as a text document (SaveAs = Text Document) then the MIME > type will be application/xml. This is also inaccurate. Unless you force it not to, notepad will give you a text file with the .txt extension and most application will map that to a mime type of text/plain. ---->N
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|