[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

[Summary] Media type (MIME) of XML in MS Word? in Notepad? when compress

  • To: <xml-dev@l...>
  • Subject: [Summary] Media type (MIME) of XML in MS Word? in Notepad? when compressed? etc
  • From: "Costello, Roger L." <costello@m...>
  • Date: Mon, 12 Jun 2006 18:47:33 -0400
  • Thread-index: AcaMrg3dXZCi/mwNQluf0m2cRA6U7ABXk+UQABWcm4A=
  • Thread-topic: [Summary] Media type (MIME) of XML in MS Word? in Notepad? when compressed? etc

mime type notepad

Hi Folks,

 

Below I have summarized our discussion on XML and media types (MIME).  Please let me know if there are any inaccuracies in the summary.  /Roger

 

 

A Summary of XML and Media Types (MIME)

 

 

What is XML’s MIME Type?

 

At this URL is a list of the 350 different MIME types:

 

       http://www.iana.org/assignments/media-types/

 

In this list you will see two different MIME types for XML:

 

      application/xml

      text/xml

 

The later MIME type (text/xml) has been deprecated.  Thus, the official MIME type for XML is:

 

      application/xml

 

Note the format for expressing MIME types – it contains two parts, separated by a slash:

 

      type/subtype

 

The Editor used to Create the XML Determines its MIME Type

 

Interestingly, you may have a document which contains XML and yet its MIME type may not be application/xml.

For example, take this simple XML:

 

<?xml version="1.0"?>

<root>

      Blah

</root>

 

and put it into Word (save it as a .doc file).  The MIME type is:

 

      application/msword

 

Conversely, if you put the same XML into Notepad, the MIME type is: 

 

      application/xml

 

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.

 

Conversely, Notepad does not wrap the XML with anything.  The document is pure XML, it can be fed directly into an XML parser, and thus it has a MIME type of application/xml.

 

Suppose that you put the XML into Wordpad, what is its MIME type? 

 

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.  If you save it as Rich Text (SaveAs = Rich Text) then the editor will wrap the XML in some stuff, and the MIME type will be different – it will be text/richtext.

 

Lastly, suppose that you put the XML into Notepad and then compress it using Winzip, what is its MIME type?

 

Answer: application/zip

 

Further Information

 

Elliotte Rusty Harold has written an excellent article on this subject:

 

http://www-128.ibm.com/developerworks/xml/library/x-mxd2.html

 

Acknowledgements

 

I would like to gratefully acknowledge the excellent inputs from these people:

 

Mitch Amiano

Dave Pawson

Bryan Rasmussen

Henri Sivonen


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.