468,457 Members | 1,590 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,457 developers. It's quick & easy.

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 3608

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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Tina Li | last post: by
6 posts views Thread by Sridhar R | last post: by
18 posts views Thread by Eirik WS | last post: by
4 posts views Thread by Beren | last post: by
20 posts views Thread by laredotornado | last post: by
3 posts views Thread by Bill nguyen | last post: by
13 posts views Thread by Chris Carlen | last post: by
3 posts views Thread by cokofreedom | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by subhajit12345 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.