Oh ok...its more complicated than i expected i guess.

That's why i proposed to use an existing block parser and edit it to suit your needs
IMHO, usually it's better not to re-invent the wheel...
But i wasn't kidding when i said this task will be very resource intensive. I tried parsing the blocks and inserting them into a simple mysql db a long, long time ago... I had to quit because the progress was so slow.