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.




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!
1010 posts

Uber Geek

Trusted
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



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

 
 
 
 


Go Hawks!
1010 posts

Uber Geek

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



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

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



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 »

OPPO Find X2 Lite brings flagship features to mid-range 5G smartphone
Posted 29-May-2020 12:52


Sony introduces the digital camera ZV-1 for content creators
Posted 27-May-2020 12:47


Samsung Announces 2020 QLED TV Range
Posted 20-May-2020 16:29


D-Link A/NZ launches AI-Powered body temperature measuring system
Posted 20-May-2020 16:22


NortonLifeLock Online Banking Protection now available for New Zealand banks
Posted 20-May-2020 16:14


SD Express delivers new gigabyte speeds for SD memory cards
Posted 20-May-2020 15:00


D-Link A/NZ launches Nuclias cloud managed network solution hosted in Australia
Posted 11-May-2020 17:53


Logitech introduces new video streaming solution for home studios
Posted 11-May-2020 17:48


Next generation Volvo cars to be powered by Luminar LiDAR technology
Posted 7-May-2020 13:56


D-Link A/NZ launches Wi-Fi Certified EasyMesh system
Posted 7-May-2020 13:51


Spark teams up with Microsoft to bring Xbox All Access to New Zealand
Posted 7-May-2020 13:01


Microsoft plans to establish its first datacenter region in New Zealand
Posted 6-May-2020 11:35


Genesis School-gen has joined forces with Mind Lab Kids
Posted 1-May-2020 12:53


Malwarebytes expands into privacy with fast, frictionless VPN
Posted 30-Apr-2020 16:06


Kordia to donate TV airtime on Channel 200 to community groups
Posted 30-Apr-2020 16:00



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.