Geekzone: technology news, blogs, forums
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.

85 posts

Master Geek

# 42097 29-Sep-2009 11:36
Send private message

Hey guys,

I am writing a simple program in c++ and I want to use an API to read in an element from an xml file. I realise there are thousands of xml parsers out there but I just need something lightweight that will read the element in and then let me assign it to a variable.

I have googled but believe it or not can't find anything helpful. Can anyone make any recommendations?


Create new topic
Go Hawks!
945 posts

Ultimate Geek


  # 259340 29-Sep-2009 12:41
Send private message

Years ago, I used the expat library (I'm pretty sure it was straight C and not C++).

It was very light and quick and didn't require a lot of effort to get it going.

This is possibly going to fit the bill if you are only going to read in an element etc. At the time, I wasn't using any sort of DTD or validation.


85 posts

Master Geek

  # 259416 29-Sep-2009 16:17
Send private message

Thanks for your reply. I have had a big look into expat and it seems like it is really powerful and a lot of people are using it. The thing is I am a beginner programmer and I am finding expat a bit daunting with all of the functions included, also it doesn't help since I haven't worked with xml before. this page lists the 15 or so functions included with expat can anyone recommend me one that would work effectively with my goal of just reading in a single element into a standard variable?

Sorry if i sound like a noob


Go Hawks!
945 posts

Ultimate Geek


  # 259420 29-Sep-2009 16:29
Send private message

That looks suspiciously like the page I originally looked at for doing this work ...

A few questions:

Why are you doing this in C++?
Is the element always named that same?
Do you know already how to do file IO in C++?

85 posts

Master Geek

  # 259618 30-Sep-2009 09:11
Send private message

Doing it in C++ as I am doing it as a win32 console app and I am going to turn it into a service using servany. Yes and yes to the last 2 questions :-)

basically i just want to pull one element in that is always in the same place in the xml file

283 posts

Ultimate Geek

  # 259622 30-Sep-2009 09:38
Send private message

You might want to look at TinyXML, its probably easier to grasp than expat

85 posts

Master Geek

  # 259672 30-Sep-2009 11:44
Send private message

tinyxml is perfect, nice and simple :-) thanks guys for your help ill let you know how i get on

Create new topic

Twitter and LinkedIn »

Follow us to receive Twitter updates when new discussions are posted in our forums:

Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:

Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:

News » announces partnership with smartphone manufacturer HTC
Posted 16-Sep-2019 21:30

Finalists Announced for Microsoft NZ Partner Awards
Posted 16-Sep-2019 19:37

OPPO Showcases New CameraX Capabilities at Google Developer Days China 2019
Posted 15-Sep-2019 12:42

New Zealand PC Market returns to growth
Posted 15-Sep-2019 12:24

Home sensor charity director speaks about the preventable death which drives her to push for healthy homes
Posted 11-Sep-2019 08:46

Te ao Maori Minecraft world set to inspire Kiwi students
Posted 11-Sep-2019 08:43

Research reveals The Power of Games in New Zealand
Posted 11-Sep-2019 08:40

Ring Door View Cam now available in New Zealand
Posted 11-Sep-2019 08:38

Vodafone NZ to create X Squad
Posted 10-Sep-2019 10:25

Huawei nova 5T to be available 20th September
Posted 5-Sep-2019 11:55 launches prepay challenger brand Kogan Mobile in New Zealand
Posted 3-Sep-2019 11:42

Pagan Online available now
Posted 27-Aug-2019 20:22

Starship hopes new app will help combat antibiotic resistance challenges
Posted 27-Aug-2019 19:43

Intel expands 10th Gen Intel Core Mobile processor family
Posted 23-Aug-2019 10:22

Digital innovation drives new investment provider
Posted 23-Aug-2019 08:29

Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.

Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron

Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.