473,379 Members | 1,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

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
Dec 30 '06 #1
1 1195
1. Do not understand your structure, but:

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

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

Cheers
Nicholas

CptDondo wrote:
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
Dec 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Jack | last post by:
I have a text file of data in a file (add2db.txt) where the entries are already entered on separate lines in the following form: INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great...
0
by: Doug R | last post by:
Hello, I have a system that I am writing to automaticly import Credit Transaction data into a SQL Server 2000 Database. I am using a VB.Net application to detect when the file arives and prep...
6
by: Martijn van Oosterhout | last post by:
I've had some fun in the past where I've had to grant a lot of tables and other similar system commands. Unfortunatly, you can't use queries to fill in fields for you. Anyway, I've implemented a...
2
by: Greg | last post by:
I need to create an aspx page that accepts an uploaded text file from a user and parses the file contents into various, normalized database tables/columns. The input file is an industry standard,...
27
by: comp.lang.tcl | last post by:
My TCL proc, XML_GET_ALL_ELEMENT_ATTRS, is supposed to convert an XML file into a TCL list as follows: attr1 {val1} attr2 {val2} ... attrN {valN} This is the TCL code that does this: set...
9
by: Paulers | last post by:
Hello, I have a log file that contains many multi-line messages. What is the best approach to take for extracting data out of each message and populating object properties to be stored in an...
2
by: Anders B | last post by:
I want to make a program that reads the content of a LUA array save file.. More precicely a save file from a World of Warcraft plugin called CharacterProfiler, which dumps alot of information about...
25
by: Jon Slaughter | last post by:
I have some code that loads up some php/html files and does a few things to them and ultimately returns an html file with some php code in it. I then pass that file onto the user by using echo. Of...
5
by: Charles May | last post by:
Anyone have a simple concept for the best way to store timeclock information in a database. I currently have my table set up like this with a typical daily entry. tcID empID Type ...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.