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

Ultimate 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!
943 posts

Ultimate 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 »

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


Catalyst Cloud becomes a Kubernetes Certified Service Provider (KCSP)
Posted 23-Aug-2019 08:21


New AI legaltech product launched in New Zealand
Posted 21-Aug-2019 17:01


Yubico launches first Lightning-compatible security key, the YubiKey 5Ci
Posted 21-Aug-2019 16:46


Disney+ streaming service confirmed launch in New Zealand
Posted 20-Aug-2019 09:29


Industry plan could create a billion dollar interactive games sector
Posted 19-Aug-2019 20:41


Personal cyber insurance a New Zealand first
Posted 19-Aug-2019 20:26


University of Waikato launches space for esports
Posted 19-Aug-2019 20:20


D-Link ANZ expands mydlink ecosystem with new mydlink Mini Wi-Fi Smart Plug
Posted 19-Aug-2019 20:14


Kiwi workers still falling victim to old cyber tricks
Posted 12-Aug-2019 20:47


Lightning Lab GovTech launches 2019 programme
Posted 12-Aug-2019 20:41


Epson launches portable laser projector
Posted 12-Aug-2019 20:27


Huawei launches new distributed HarmonyOS
Posted 12-Aug-2019 20:20


Lenovo introduces single-socket servers for edge and data-intensive workloads
Posted 9-Aug-2019 21:26



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.