6 Replies - 1366 Views - Last Post: 09 November 2011 - 02:19 AM Rate Topic: -----

#1 AlecTaylor   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 17-December 10

How do I parse an XML file?

Posted 08 November 2011 - 10:12 AM

Good morning,

I've been trying with various libraries (everything from pugixml to RapidXML) but have been unable to parse a simple XML file. I want to grab all the inner text of each page->text into separate std::string's., so 1 page per std::string.

My RapidXML attempt: https://ideone.com/XWylb

My pugiXML attempt: https://ideone.com/RzN6X

XML file: https://ideone.com/wrG13

Can you help me get one to work?

Thanks for all suggestions,

Alec Taylor

PS: Preferably I would like the RapidXML one to work.

Is This A Good Question/Topic? 0
  • +

Replies To: How do I parse an XML file?

#2 jimblumberg   User is offline

  • member icon

Reputation: 5916
  • View blog
  • Posts: 17,932
  • Joined: 25-December 09

Re: How do I parse an XML file?

Posted 08 November 2011 - 10:24 AM

Post the code that is causing problem in code tags. If the code does not compile without errors, post the complete error messages exactly as they appear in your development environment.

If the code does compile ask specific questions on the code you post.

Also crossposted here.

Jim

This post has been edited by jimblumberg: 08 November 2011 - 10:26 AM

Was This Post Helpful? 1
  • +
  • -

#3 AlecTaylor   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 17-December 10

Re: How do I parse an XML file?

Posted 08 November 2011 - 07:12 PM

The code does compile (pugixml doesn't link, but I added that info the the ideone paste)

RapidXML doesn't give me an error though, it just doesn't print anything other than the first node's name to stdout.
Was This Post Helpful? 0
  • +
  • -

#4 AlecTaylor   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 17-December 10

Re: How do I parse an XML file?

Posted 08 November 2011 - 09:21 PM

I have just tried with TinyXML++, also didn't work:

https://ideone.com/yC1l8
Was This Post Helpful? 0
  • +
  • -

#5 #define   User is offline

  • Cannot compute!
  • member icon

Reputation: 1868
  • View blog
  • Posts: 6,763
  • Joined: 19-February 09

Re: How do I parse an XML file?

Posted 08 November 2011 - 10:43 PM

With TinyXML did you try the define before the header file? :

#define TIXML_USE_STL YES
#include "tinyxml.h"


Was This Post Helpful? 0
  • +
  • -

#6 AlecTaylor   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 17-December 10

Re: How do I parse an XML file?

Posted 08 November 2011 - 11:03 PM

View Post#define, on 08 November 2011 - 10:43 PM, said:

With TinyXML did you try the define before the header file? :

#define TIXML_USE_STL YES
#include "tinyxml.h"



Thanks, I tried that (as said in the ideone note) but it didn't work :(
Was This Post Helpful? 0
  • +
  • -

#7 AlecTaylor   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 17-December 10

Re: How do I parse an XML file?

Posted 09 November 2011 - 02:19 AM

Figured out the rapidxml version.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1