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

Re: Formatless files

  • From: Tony Graham <tgraham@antenna.co.jp>
  • To: xml-dev@lists.xml.org
  • Date: Wed, 10 Aug 2022 11:27:28 +0100

Re:  Formatless files
On 09/08/2022 21:01, Roger L Costello wrote:
A file has no inherent format.

The format of a file is determined by the programs that use it.

Since file types are not determined by the file system, the "kernel"
can't tell you the type of file: it doesn't know.
Yet the Unix 'file' [1] command has been doing a pretty good job of it
since 1973. [2]

The 'file' command firstly uses filesystem tests to determine if a file
is empty or is a special file, such as a socket or a symbolic link.

It secondly uses 'magic' tests to detect the file type. The 'file'
manpage includes:

The magic tests are used to check for files with data in particular
fixed formats.

The magic tests use "magic patterns" from a 'magic' file. [3]

The 'magic' file on my Linux system includes 11 patterns that start with
'<?xml'. They are mostly followed by other tests to try to determine
the type of XML, e.g.:

0 string \<?xml\ version="
>15 string >\0
>>19 search/4096 \<svg SVG Scalable Vector Graphics image

There's even a test for '<?XML' that will be reported as 'broken XML document'.

Regards,


Tony Graham.
--
Senior Architect
XML Division
Antenna House, Inc.
----
Skerries, Ireland
tgraham@antenna.co.jp

[1] https://www.man7.org/linux/man-pages/man1/file.1.html
[2] https://www.man7.org/linux/man-pages/man1/file.1.html#HISTORY
[3] https://man7.org/linux/man-pages/man4/magic.4.html


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.