[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?

  • To: "Costello, Roger L." <costello@m...>, <xml-dev@l...>
  • Subject: RE: [Summary] Media type (MIME) of XML in MS Word? in Notepad? when compressed? etc
  • From: "Nathan Young -X \(natyoung - Artizen at Cisco\)" <natyoung@c...>
  • Date: Mon, 12 Jun 2006 17:15:29 -0700
  • Authentication-results: sj-dkim-2.cisco.com; header.From=natyoung@c...; 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@c...; z=From:=22Nathan=20Young=20-X=20\(natyoung=20-=20Artizen=20at=20Cisco\)=22=20<natyoung@c...>|Subject:RE=3A=20=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: [Summary] Media type (MIME) of XML in MS Word? in Notepad? when compressed? etc

word xml mime type
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!

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.