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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] [Summary] Media type (MIME) of XML in MS Word? in Notepad?

[ Lists Home | Date Index | Thread Index ]
  • To: "Costello, Roger L." <costello@mitre.org>, <xml-dev@lists.xml.org>
  • Subject: RE: [xml-dev] [Summary] Media type (MIME) of XML in MS Word? in Notepad? when compressed? etc
  • From: "Nathan Young -X \(natyoung - Artizen at Cisco\)" <natyoung@cisco.com>
  • Date: Mon, 12 Jun 2006 17:15:29 -0700
  • Authentication-results: sj-dkim-2.cisco.com; header.From=natyoung@cisco.com; dkim=pass (sig from cisco.com verified; );
  • Dkim-signature: a=rsa-sha1; q=dns; l=3453; t=1150157731; x=1151021731;c=relaxed/simple; s=sjdkim2001; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version;d=cisco.com; i=natyoung@cisco.com; z=From:=22Nathan=20Young=20-X=20\(natyoung=20-=20Artizen=20at=20Cisco\)=22=20<natyoung@cisco.com>|Subject:RE=3A=20[xml-dev]=20[Summary]=20Media=20type=20(MIME)=20of=20XML=20in=20MS=20Word?=20in=20Notepad?=20when=20compressed?=20etc;X=v=3Dcisco.com=3B=20h=3DBngtVW8JiGRmHwmCCoZMLzTuocI=3D; b=jK5aW/3m/E319L/h9SIRpKltFYL3njN+dNgVC+b6L0xAU6R/7fmBtF/4jYi+DSknRZovWzWhfCwgUrSzMh4HnxKW2fzoucst6n63sQLPLsriQofWtNH38Lx89eTiXvN7;
  • Thread-index: AcaMrg3dXZCi/mwNQluf0m2cRA6U7ABXk+UQABWcm4AABQUc0A==
  • Thread-topic: [xml-dev] [Summary] Media type (MIME) of XML in MS Word? in Notepad? when compressed? etc

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




 

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

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