What are fixed format files and how is XML better than them?

xml

Solution

The biggest advantage of a FFF over XML is built-in capability of index-based random-access. The contra-positive is obvious, the biggest disadvantage of XML compared to FFF is the linear fashion in which it must be parsed.

Suppose you have a data file holding person records. The records can hold an id, name, address, and telephone number.

Fixed Format

ID          : 8 chars
Surname     : 36 chars
Firstname   : 36 chars
Address     : 100 chars
Phone       : 20 chars
-----------------------
Total Space: 200 chars

XML Format (contrived, could be a number of formats)

<Person id="...">
   <Surname>...</>
   <Firstname>...</>
   <Address>...</>
   <Phone>...</>
</Person>

Total Space : Variant

Now, suppose this has 1000 "records" Lets see how difficult it is to get to the 600th person record with both forms.

Fixed Format

Offset = (600-1)*200 = 119800 bytes
fseek() + fread() = done

XML Format

Um..... 

XML's biggest forte is extensibility (that X didn't come from nothing). XML makes a fantastic data-snippet, RSS feed, configuration file, etc. It is easy to emit without special libraries and only basic knowhow, and can be reasonable in storage space (so long as you don't go `<LoveThoseSuperDuperLongElementNames>` nuts). It is easy to understand, backed by boatloads of standards, and just about everyone that's anyone has an XML parser in their toolkit. Universal "understanding" is just a schema document (DTD for the old-schoolers) away, as is validation, etc.

But XML's biggest downside has been, is now, and until quantum computing leaps a long way, always will be: speed. XML is a terrible throughput-mandated storage system.

Problem

I searched google for fixed format file (FFF) and got these to results: - pcsupport.about.com/od/fileextensions/f/fixed-file.htm - www.softinterface.com/Convert-XLS%5CFeatures%5CFixed-Width-Text-File-Definition.htm I am not sure which one is a fixed format file. Is the second one FFF or its something else ? What problems did FFF solve and how does XML solve them better than FFF ? Are there any disadvantages of XML format when compared to FFF ? Thanks in advance.

Original source