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

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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"/>

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!


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

1. Do not understand your structure, but:

 <item attribute="value">
 <item attribute="anothervalue">

could match multiple rows.

2. I wonder if the item tag attribute that matches the structure of the
contained data is perhaps leading you to create dynamic structures?
Interesting.  Is that parsed by XSL switch statements that use the
variant structure?  Something tells me you may need a uniformly named
container for the object being defined therein?

I am fairly new to XSL so forgive me if I am barking up wrong trees


CptDondo wrote:
Quoted text here. Click to load it

Site Timeline