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


jamesla

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
wazzageek
1093 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

  #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.

HTH



jamesla

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.

http://www.xml.com/pub/a/1999/09/expat/index.html 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

wazzageek
1093 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

  #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++?



jamesla

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

mikerussellnz
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

http://code.google.com/p/ticpp/

jamesla

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





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









Geekzone Live »

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



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.