views:

277

answers:

1

I have to parse a xml file in C++. I was researching and found rapidxml library for this.

I have doubt about "doc.parse<0>(xml)"

can xml be .xml file or it needs to be a string or char *?

If can take only string or char * then I guess I need to read the whole file and store it in a char array and pass the pointer of it to the function?

Is there a way to directly use file because I would need to change the xml file inside the code also.

If it is not possible in RapidXML then please suggest some other xml libraries in C++.

Thanks!!!

Ashd

A: 

The manual tells us:

function xml_document::parse

[...] Parses zero-terminated XML string according to given flags.

RapidXML leaves loading the character data from a file to you. Either read the file into a buffer, like anno suggested or alternatively use some memory mapping technique. (But look up parse_non_destructive flag first.)

Martin