rapidxml

C++: How to extract a string from rapidxml

In my C++ program I want to parse a small piece of XML, insert some nodes, then extract the new XML (preferably as a std::string) RapidXML (http://rapidxml.sourceforge.net/) has been recommended to me, but I can't see how to retrieve the XML back as a text string. (I could iterate over the nodes and attributes and build it myself, but su...

c++ rapidxml node_iterator example?

Hi, I just started using rapidXML since it was recommended to me. Right now to iterate over multiple siblings i do this: //get the first texture node xml_node<>* texNode = rootNode->first_node("Texture"); if(texNode != 0){ string test = texNode->first_attribute("path")->value(); cout << test << endl; } //get all its sibling...

c++ RapidXml: reassign node pointer & mallocDebug

Hi, I started to use rappidXML a short time ago and I just noticed that when I reassign a node Pointer mallocDebug (I am using xCode on a mac) complains. This is what I do: xml_node<>* rootNode = doc.first_node("Root"); //find shaders xml_node<>* curNode = rootNode->first_node("Node1"); .... do something curN...

RapidXML, reading and saving values

Hello, 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 = parsing->readFileInChar(CONF); cfg.parse<0>(pcSourceConfig); } Reading values from XML void ...

How to fix RapidXML String ownership concerns?

RapidXML is a fast, lightweight C++ XML DOM Parser, but it has some quirks. The worst of these to my mind is this: 3.2 Ownership Of Strings. Nodes and attributes produced by RapidXml do not own their name and value strings. They merely hold the pointers to them. This means you have to be careful when setting these value...

Compilation errors with RapidXML

Hi, I am novice to rapidXML but first impresion was not positive, I made simple Visual Studio 6 C++ Hello World Application and added RapidXML hpp files to project and in main.cpp I put: #include "stdafx.h" #include < iostream > #include < string > #include "rapidxml.hpp" using namespace std; using namespace rapidxml; int main ( ) {...

How to parse the XML file in RapidXML.

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 functio...

Arabica's documentation (XML and HTML processing toolkit)

Beyond the doxygen file and the code examples, is there some documentation or tutorials for Arabica ? I just can't find anything. Update I gave up on Arabica. In the mean time I've also tried Xerces, the doc is better but the interface is just awful. So I settled on rapidXML and I'll look into pugixml later. ...

Why does MapViewOfFile return an unusable pointer for rapidxml?

As suggested: I have a file which is larger than 2 giga. I am mapping to memory using the following function: char* ptr = (char*) MapViewOfFile( map_handle, FILE_MAP_WRITE | FILE_MAP_READ, 0, 0, 0 ); I parse ptr to rapidxml which accepts Ch* . As per the documentation from rapidxml ptr should be modifiable but since it is decl...

Removing RapidXML newlines & whitespace in output

How can I prevent RapidXML from adding tabs and newlines between element tags when calling the print(...) function to output XML? ...

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? ...

bug of RapidXML when the value of a xml node is null

If the value of node in the xml is null, when we print the xml node, the node has no start tag, but only the end tag. For example: xml_document<char> doc; doc.append_node(doc.allocate_node(rapidxml::node_element, "mynode", "")); ofstream ofs("test.xml"); ofs<<doc; the content of test.xml is: </mynode> the expected content of test.x...

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 errors: rapidxml_iterators.hpp:21: e...

RapidXML XML parse error

I'm parsing an XML file which is quite simple: <?xml version="1.0" encoding="utf-8"?> <catalog> <book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre><price>44.95</price><publish_date>2000-10-01</publish_date> <description>An in-depth look at creati...

is there is any way to get xml value by tag in rapid xml using c++

hello, is there is any way to get the value of tag by its tagname in rapidxml using c++ <?xml version=\1.0\ encoding=\latin-1\?> <book>example</book> <book1>example1</book1> i need to get the book value ie example and book1 value ....we can use this doc.first_node()->value() get first node and next node but i need to is there is any w...