I need some ideas on XML parsing.....



I've been struggling with this concept for a while, and I'm getting a bit burned out...

I've got a piece of equipment that has data that I need to get.

The data is stored in "bytes" for lack of a better word, and I need to parse it out according to an XML file format.

Here goes:

data is stored in rows like this:

uint From uint To uint bitmap
....

The row is defined by this bit of XML:

<items orientation="row" start="40079" inc="3" order="From,To,auxA,auxB,auxC,auxD" format="nFrom/nTo/nbitmap">
<From format="n" />
<To format="n"/>
<bitmap format="n">
<auxA bit="0x01"/>
<auxB bit="0x02"/>
<auxC bit="0x04"/>
<auxD bit="0x08"/>
</bitmap>
</items>

Assume that I get a binary string, consisting of 6 bytes with the above information. I have to create an array with the following elements:

From To auxA auxB auxC auxD

with the values parsed out of the 6 bytes according to the XML definition. The XML can change if the data structure changes, so the code has to parse the XML first, then create a format string, and finally unpack the binary string.

I'm having a heck of a time getting a concept worked out for this. It should be easy but I've been working on related bits of code for so long that it all barely makes sense right now.... :-)

Anyway I would appreciate any suggestions on this.

And Happy New Year to all!

--Yan
.