The best way to write a parser of your own for the blockchain is to find the source code of one that already exists and from that deduce the precise underlying data structure and how to parse and interpret it. e.g. here in C++ and here in C# - and there are many others.
The data in the blockchain is stored in a custom binary format that is a little tricky to untangle without some help; this link seems as good as any to get started on the overall structure.
There are many"gotcha's" to watch out for. For example:
- 'endianess' i.e. having to reverse binary digits before interpretation and
- some of the interesting values associated with a transaction have to be calculated e.g. for addresses
- 'big numbers' where the numbers used internally are so huge you may need custom code/libraries to deal with them
Comparing your results to those that are freely available via the blockchain and blockexplorer as well as the bitcoind.exe API would be a must. Otherwise it is easy to pull out seemingly valid transactions that are just nonsense. I speak from experience.
While writing your own parser for the blockchain is a worthwhile learning exercise you would be much better off IMHO using the bitcoin API and ignoring the underlying blockchain database for any 'real' code.