Content-model for structure of binary file

wxdqz

New Member
EDIT: Sorry this is not a web-development related question. I am looking purely for XML expertise. I am developing a C++ desktop application.

I am about to read data from a binary file, like millions of people have done a million times before me. But I was wondering if somebody knows of any generic way to define a model of the file to read (a model of how to read it). Any XML based standards? It seems like an old standard problem - there simply must exist some form of standard model definition. But I am not able to find it. I understand basic XML but I haven't worked with schema or DTD.

The datafile contains raw (binary) data from an underwater sonar camera. I am simply trying to implement a "parser/reader" for such a file in C++. The file has a 512 byte header, and after it has N blocks of image frames. All of these blocks has a 256 byte frame header and then a dynamic length of image-pixel data etc. Not a new problem really. It can't be.

Any XML standard way to define how read such a file (or more like, what's inside of it)? I also need a way to name all data fields such they are easily referred to later on. Some of the fields (strings, pixel-data) also have dynamic length which can be calculated using fields from the headers. How to define such information? I have looked at possible solutions like XSIL and the derivative Binary Format Description (BFD). I believe BFD is close to what I am looking for, only I need a parser/BFD processor implemented in C/C++. It seems like much of this is Java only.

My problem is not really a problem (is it?). It's more and issue of distinguishing between program and data models. I have already made a C++ class with "hard coded" functionality necessary for reading my data files. But hard coding how data should read and understood in a class definition, is what I want to get away from. I would like to have any data model(s) external to my program. Who doesn't?

Thanks,
Kofler
 
Back
Top