Questions tagged [rapidxml]

A general purpose XML parser for C++ designed for execution speed and practical usage. It can also modify nodes and output a full xml document.

Rapidxml is a header-only XML parser with high usability, portability, and very good W3C compatibility.

  • no dependencies (except standard C++ library <cassert>, <cstdlib>, <new>, and <exception>
  • character type agnostic: supports narrow and wide, wchar_t UTF-16 and UTF-32, and UTF-8 if endianness is native
  • special memory pool object management for speed
  • not fully W3C compliant: ignores DOCTYPE declarations, and minor incompatibilities
  • robust and has a large unit test harness
  • easy to learn and use: begin writing useful parsing code in less than five minutes
  • license is Boost Software License or MIT License
  • stable since 2006
  • an additional header-only file adds the ability to stream out and format an xml document
  • other header classes simplify iterating through a document, loading from a file, and get child counts

Rapidxml is widely cross-platform compatible, its execution speed is proportional to the length of the XML data parsed, and it requires no configuration and no metadata or schema.

177 questions
3
votes
0 answers

Fastest way to read xml files with rapidxml

I'm reading huge XML files in C++ with rapidxml and trying to optimize the reading, because that part consums most of the time (I've measured it with std::chrono). I.e. I have a XML file with around 40 MB - the actual parsing from rapidxml takes…
Constantin
  • 7,926
  • 12
  • 71
  • 112
3
votes
3 answers

RapidXML, reading and saving values

I've worked myself through the rapidXML sources and managed to read some values. Now I want to change them and save them to my XML file: Parsing file and set a pointer void SettingsHandler::getConfigFile() { pcSourceConfig =…
user238801
3
votes
3 answers

How to read Unicode XML values with rapidxml

RapidXML is one of the available libraries for parsing XML in c++. For getting the values, we can use something like: node->first_node("xmlnode")->value() This command returns a char* data type. Is there any way to read the value as Unicode so I…
Ali
  • 133
  • 3
  • 12
3
votes
1 answer

Traversing a simple DOM Xml document using RapidXML

Alright guys, so Im using rapidXML to parse a very simple XML document. All I am trying to do is parse the data from the xml document into my own custom data structure. As a starting point, I'd like to be able to output each node and the data is…
MS-DDOS
  • 558
  • 5
  • 14
2
votes
1 answer

Looping through a node using rapidxml

I'm new to using XML with C++ and I want to loop through an XML node and print the 'id' attribute of into a vector. This is my XML
dotty
  • 35,833
  • 64
  • 143
  • 195
2
votes
1 answer

rapidXML, corrupted memory when traversing DOM tree

Don't understand what is going on with the attribute's memory and rapidXML. A function encapsulates the xml parsing, if success, returns a reference to the root node, when calling the traverse DOM tree inside this function I get the correct data…
notNullGothik
  • 402
  • 5
  • 18
2
votes
1 answer

RapidXml and memory pool

Using RapidXML I need to create and destroy a lot of XML nodes and XML attributes. I read in memory pool documentation that there is not a way to free a single string created in memory pool with allocate_string function. But in this way size of…
user1052149
  • 39
  • 1
  • 5
2
votes
1 answer

Strange Exceptions using RapidXml under Windows CE 6.0/Windows Mobile/Windows Embedded Compact

I'm having a very strange problem when trying to run RapidXml 1.13 under Windows CE 6.0 compiled with Visual Studio 2005. I have an extremely small program that fails to run: #include using namespace rapidxml; int _tmain(int argc,…
Rotsiser Mho
  • 550
  • 2
  • 5
  • 19
2
votes
0 answers

How to generate a xml-stylesheet declaration using RapidXML?

I know how to generate a regular xml header () but I don't see how to generate specifically a xml-stylesheet declaration. Has anyone out there done it before? Googling the question yielded nothing relevant.
Bokeh
  • 923
  • 6
  • 9
2
votes
1 answer

Error handling: distinguishing between 'fatal' errors and 'unexpected input' errors

I've been working on a program that reads in an XML file, and if ifstream is unable to open the file, it will throw std::ifstream::failure. This exception is thrown whenever std::ifstream::failbit is set or std::ifstream::badbit is set, and they are…
kmore
  • 884
  • 9
  • 18
2
votes
1 answer

RapidXML: Unable to print - Compile-time Error

I'm trying to print the XML document data in the console using the RapidXML Library in my C++ application. I'm following the RapidXML Manual link here, but I got a compile-time error. Here is my C++ code: #include #include…
Nycholas Maia
  • 169
  • 1
  • 10
2
votes
3 answers

rapidxml parse error with url attribute

I'm getting a strange error with rapidxml when parsing a xml file like It throws "expected >". Im using a code like the following to parse the…
P3trus
  • 5,540
  • 6
  • 34
  • 50
2
votes
1 answer

write to an xml file using rapidxml in c++

#include "rapidxml-1.13/rapidxml.hpp" #include "rapidxml-1.13/rapidxml_print.hpp" #include "rapidxml-1.13/rapidxml_utils.hpp" #include #include using namespace std; using namespace rapidxml; int main() { std::ofstream…
2
votes
3 answers

compile rapidxml under linux with g++

The following simple program can't be compiled with gcc 4.4.3 #include "rapidxml.hpp" #include "rapidxml_utils.hpp" #include "rapidxml_print.hpp" #include "rapidxml_iterators.hpp" int main() { return 0; } Compile produces following…
Boris
  • 21
  • 3
2
votes
2 answers

Cloning rapidxml::xml_document

How do I get a complete copy of a RapidXML xml_document? There is a clone_node function; how to use to to create a complete copy of an existing document?
Petrus Theron
  • 25,051
  • 30
  • 137
  • 263
1
2
3
11 12