OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

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

[ Lists Home | Date Index | Thread Index ]
  • To: <xml-dev@lists.xml.org>
  • Subject: [Summary] Media type (MIME) of XML in MS Word? in Notepad? when compressed? etc
  • From: "Costello, Roger L." <costello@mitre.org>
  • 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

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





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS