rapidxml

Rapidxml is writing wrong characters

元气小坏坏 提交于 2019-12-11 07:44:14
问题 I've been using Rapidxml lately and have faced following problem. When I try to add attributes, which are not hardcoded, but generated during program runtime rapidxml inserts wrong characters. Here is my sample of code: void ProcessInfo::retriveInfo() { HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); PROCESSENTRY32 pe = { sizeof(pe) }; BOOL fOk = ProcessFirst( &pe, hSnapshot ); using namespace rapidxml; xml_document<> doc; xml_node<>* decl = doc.allocate_node(node

check for variable number of sibling nodes & different siblings in Rapidxml

痞子三分冷 提交于 2019-12-11 05:25:36
问题 I am using Rapidxml in c++ to read in a xml file I have two questions based on the following example <?xml version="1.0" encoding="utf-8"?> <rootnode version="1.0" type="example"> <childnode1 entry="1"> <evendeepernode attr1="cat" attr2="dog"/> <evendeepernode attr1="lion" attr2="wolf"/> </childnode1> <childnode2 entry="1"> </childnode2> </rootnode> 1- if the number of same type of siblings(evendeepernode) is variable. How can I check for it? 2- if there are different siblings (e.g.

RapidXML giving empty CDATA nodes

喜你入骨 提交于 2019-12-10 19:19:12
问题 I wrote the code bellow to get CDATA node value too, I got the node's name, but the values are in blank. I changed the parse Flags to parse_full, but it not worked too. If I manually remove "<![CDATA[" and "]]>" from the XML, It gives the value as expected, but removing it before parse is not a option. The code: #include <iostream> #include <vector> #include <sstream> #include "rapidxml/rapidxml_utils.hpp" using std::vector; using std::stringstream; using std::cout; using std::endl; int main

c++ rapidxml node_iterator example?

做~自己de王妃 提交于 2019-12-08 19:51:29
问题 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 siblings while(texNode->next_sibling() != 0){ string test = texNode->first_attribute("path")->value(); cout << test << endl; texNode = texNode->next_sibling(); } as a basic test and

RapidXML compilation error parsing string

我只是一个虾纸丫 提交于 2019-12-07 16:29:27
问题 I have been having some trouble using RapidXML to parse a string. I receive an error from within Eclipse claiming the parse function does not exist. make all Building file: ../search.cpp Invoking: Cross G++ Compiler g++ -DDEBUG -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"search.d" -MT"search.d" -o "search.o" "../search.cpp" ../search.cpp: In function ‘void search(CURL*, CURLcode, std::string, std::string)’: ../search.cpp:29:27: error: no matching function for call to ‘rapidxml::xml

rapidxml: how to iterate through nodes? Leaves out last sibling

ε祈祈猫儿з 提交于 2019-12-01 16:56:30
Using rapidxml I'm wanting to loop through a set of nodes, and am using what I found to be the best way to do this (from trusty stackoverflow, the doc doesn't appear to have an example of iteration): while (curNode->next_sibling() !=NULL ) { string shiftLength = curNode->first_attribute("shiftLength")->value(); cout << "Shift Length " << "\t" << shiftLength << endl; curNode = curNode->next_sibling(); } Unfortunately, on my OSX 10.6 this is leaving out the last sibling node - I guess because in the last iteration of the loop, next_sibling is called twice. I can get at this last node if I write,

How to fix RapidXML String ownership concerns?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 04:01:35
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 values manually, by using xml_base::name(const Ch *) or xml_base::value(const Ch *) functions. Care must be taken to ensure that lifetime of the string passed is at least as long as lifetime of the node/attribute. The easiest way to achieve it is to allocate the string from memory

How to parse an XML file with RapidXml

落爺英雄遲暮 提交于 2019-11-30 01:51:49
I have to parse an XML file in C++. I was researching and found the RapidXml library for this. I have doubts about doc.parse<0>(xml) . Can xml be an .xml file or does it need to be a string or char * ? If I can only use 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 a file because I would need to change the XML file inside the code also. If that is not possible in RapidXml then please suggest some other XML libraries in C++. Thanks!!! Ashd Superfly Jon RapidXml comes with a

rapidxml - overwriting previous xml_nodes

一世执手 提交于 2019-11-29 12:51:57
I just started using rapidxml. I 1st create an xml file to read from. Worked so fast an easy. This is what I manual crated. <?xml version="1.0" encoding="utf-8"?> <GPS> <Path> <Point X="-3684.136" Y="3566.282" Z="285.2893" /> <Point X="-3681.816" Y="3540.431" Z="283.3658" /> <Point X="-3687.079" Y="3515.315" Z="282.6284" /> </Path> </GPS> I could easy read that with no problems. I then wanted to write it to a new file. But the problem is that it keeps overwriting previous xml_nodes. For example, <?xml version="1.0" encoding="UTF-8"?> <GPS> <Path> <Point X="-3687.08" Y="3515.31" Z="282.628"/>

rapidxml - overwriting previous xml_nodes

杀马特。学长 韩版系。学妹 提交于 2019-11-28 06:28:50
问题 I just started using rapidxml. I 1st create an xml file to read from. Worked so fast an easy. This is what I manual crated. <?xml version="1.0" encoding="utf-8"?> <GPS> <Path> <Point X="-3684.136" Y="3566.282" Z="285.2893" /> <Point X="-3681.816" Y="3540.431" Z="283.3658" /> <Point X="-3687.079" Y="3515.315" Z="282.6284" /> </Path> </GPS> I could easy read that with no problems. I then wanted to write it to a new file. But the problem is that it keeps overwriting previous xml_nodes. For