473,387 Members | 1,528 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,387 software developers and data experts.

Efficient XML parsing

Hello,

I'm working on a project and I need to parse an XML file containing the
description of a lot of images.
Here's an example of the XML data:

<db_name>
<picture>
<pic_id>2033</pid_id>
<pic_name>foo</pic_name>
...
</picture>
</db_name>

What I'd like to do is to store each images as a C++ object, for example:

class Image
{
int pic_id;
std::string pic_name;
...
};

Is there any efficient library to do this? Or must I do it all myself
using libxml?

By the way I hope i'm posting in the right newsgroup...

Thanks,

Thomas
--
Thomas Lecomte de**********@gmail.com Solaris User & Developer
http://blog.hinyx.info - http://guses.org - http://www.sunwizard.net

Sep 6 '06 #1
9 3817

Thomas Lecomte wrote:
Hello,

I'm working on a project and I need to parse an XML file containing the
description of a lot of images.
Here's an example of the XML data:

<db_name>
<picture>
<pic_id>2033</pid_id>
<pic_name>foo</pic_name>
...
</picture>
</db_name>

What I'd like to do is to store each images as a C++ object, for example:

class Image
{
int pic_id;
std::string pic_name;
...
};

Is there any efficient library to do this? Or must I do it all myself
using libxml?

By the way I hope i'm posting in the right newsgroup...

Thanks,

Thomas
--
Thomas Lecomte de**********@gmail.com Solaris User & Developer
http://blog.hinyx.info - http://guses.org - http://www.sunwizard.net
you may use XERCES by apache(xml parser for c++)

Sep 6 '06 #2
Thomas Lecomte wrote:
Is there any efficient library to do this? Or must I do it all myself
using libxml?
Just get tinyxml, and use it until you need a high-end parser. You probably
won't.

XML was designed to be light, so use it lightly.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Sep 6 '06 #3
On Wed, 06 Sep 2006 06:01:56 +0000, Phlip wrote:
Thomas Lecomte wrote:
>Is there any efficient library to do this? Or must I do it all myself
using libxml?

Just get tinyxml, and use it until you need a high-end parser. You probably
won't.

XML was designed to be light, so use it lightly.
Thanks for the answers.
Forgive me about the clone message, I had some problems with my client.
Thanks!

Thomas

--
Thomas Lecomte de**********@gmail.com Solaris User & Developer
http://blog.hinyx.info - http://guses.org - http://www.sunwizard.net

Sep 6 '06 #4
Phlip wrote :
XML was designed to be light
You probably missed most of XML's design.
Sep 6 '06 #5
Thomas Lecomte wrote :
Is there any efficient library to do this? Or must I do it all myself
using libxml?
It would be smarter to use libxml++, libxml2's C++ wrapper.
Sep 6 '06 #6

Thomas Lecomte wrote:
Is there any efficient library to do this?
If you want efficiency you shouldn't be using xml.

Sep 6 '06 #7
loufoque wrote:
Phlip wrote :
>XML was designed to be light

You probably missed most of XML's design.
You snipped the half of my sentence that balanced it, then complained my
sentence was unbalanced.

I have seen people, on 'net forums, snip answering paragraphs and then claim
a question was not answered. But half a sentence??

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Sep 6 '06 #8
Noah Roberts wrote:
Thomas Lecomte wrote:
>Is there any efficient library to do this?

If you want efficiency you shouldn't be using xml.
Premature Optimization takes many forms, Noah.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Sep 6 '06 #9
On Wed, 06 Sep 2006 16:54:24 +0200, loufoque wrote:
Thomas Lecomte wrote :
>Is there any efficient library to do this? Or must I do it all myself
using libxml?

It would be smarter to use libxml++, libxml2's C++ wrapper.
Thanks for pointing me out this interesting project.
I'll give it a try. Seems well-documented.

Thomas

--
Thomas Lecomte de**********@gmail.com Solaris User & Developer
http://blog.hinyx.info - http://guses.org - http://www.sunwizard.net

Sep 8 '06 #10

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

Similar topics

14
by: Tina Li | last post by:
Hello, I've been struggling with a regular expression for parsing XML files, which keeps giving the run time error "maximum recursion limit exceeded". Here is the pattern string: ...
6
by: Sridhar R | last post by:
I am looking for a class browser that has these features. 1. Given a symbol (class, method or function) it should giveback the lineno n source code 2. It should be efficient and quick. I...
18
by: Eirik WS | last post by:
Is there a more efficient way of comparing a string to different words? I'm doing it this way: if(strcmp(farge, "kvit") == 0) peikar_til_glas_struktur->farge = KVIT; if(strcmp(farge, "raud") ==...
4
by: Beren | last post by:
Hello, Can anyone give some tips to efficiently update a remote project ? I prefer to keep my projects locally, compile as release and then copy everything it to the remote server. What is...
20
by: laredotornado | last post by:
Hi, I'm using PHP 4.3. I have 15 pages in which I need to take the content of the BODY and put it in a little table ... <table> <tr><td colspan="3"><img src="header.gif"></td></tr> <tr>...
3
by: Bill nguyen | last post by:
I'm looking for a good routine to parse the following text pattern: a:18: {i:0;i:408;i:1;i:409;i:2;i:410;i:3;i:411;i:4;i:413;i:5;i:414;} a: = page_id a:18 -page_id = 18 Those within curly...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
3
by: cokofreedom | last post by:
I've written up a little piece of code that isn't that foolproof to scan through a file (java presently) to find functions and then look for them throughout the document and output the name of the...
4
by: Tom | last post by:
I am trying to update another developers code, and am stuck in a cludge. It works like this: A user uploads a file from the web page. Our code reads from a NetworkStream to a Filestream, and...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.